OpenHome.Songcast.MediaPlayerList.Add C# (CSharp) Method

Add() public method

public Add ( Object aObject ) : void
aObject Object
return void
        public void Add(Object aObject)
        {
            MediaPlayer add = aObject as MediaPlayer;

            int index = 0;

            foreach (MediaPlayer player in iList)
            {
                if (add.CompareTo(player) < 0)
                {
                    iList.Insert(index, add);

                    if (CollectionChanged != null)
                    {
                        CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, aObject, index));
                    }

                    return;
                }

                index++;
            }

            iList.Add(add);

            if (CollectionChanged != null)
            {
                CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, aObject));
            }
        }