Click here to Skip to main content
15,884,473 members
Articles
(untagged)

User Interface Patterns

Rate me:
Please Sign up or sign in to vote.
4.94/5 (21 votes)
18 Jun 2013CPOL7 min read 51.5K   413   55  
A brief overview of common user interface patterns, and some ideas about them.
using System.Collections;
using System.Collections.Generic;


namespace ActiveMVC
{

    public class SimplePieChartData : IEnumerable<double>
    {

        private readonly List<double> _items;


        public SimplePieChartData()
        {
            _items = new List<double>();
            Total = 0;
        }


        public void Remove(double value)
        {
            _items.Remove(value);
            Total -= value;
        }


        public void Clear()
        {
            Total = 0;
            _items.Clear();
        }


        public void Add(double value)
        {
            _items.Add(value);
            Total += value;
        }


        internal void Add(double value, bool isActive)
        {
            if (isActive) ActiveItemIndex = Count;
            Add(value);
        }


        public double this[int index]
        {
            get { return _items[index]; }
        }


        IEnumerator<double> IEnumerable<double>.GetEnumerator()
        {
            return _items.GetEnumerator();
        }


        IEnumerator IEnumerable.GetEnumerator()
        {
            return _items.GetEnumerator();
        }


        public double Total { get; private set; }
        public int Count { get { return _items.Count; } }
        public int ActiveItemIndex { get; private set; }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions