Inheritance: INotifyPropertyChanged
        public MediaPlayer(Receiver aReceiver, bool aEnabled)
        {
            iReceiver = aReceiver;

            iReceiver.PropertyChanged += new PropertyChangedEventHandler(EventReceiverPropertyChanged);

            iAttached = false;
            iUdn = aReceiver.Udn;
            iRoom = aReceiver.Room;
            iName = aReceiver.Name;
            iGroup = aReceiver.Group;

            Initialise(aEnabled);
        }
Exemplo n.º 2
0
        internal void Added(IReceiver aReceiver)
        {
            Receiver receiver = new Receiver(aReceiver);
            iList.Add(receiver);

            if (CollectionChanged != null)
            {
                CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, receiver));
            }
        }
Exemplo n.º 3
0
 private void ReceiverAdded(IntPtr aReceiver)
 {
     Receiver receiver = new Receiver(aReceiver);
     iReceiverList.Add(receiver);
     iReceiverHandler.ReceiverAdded(receiver);
 }
 public void ReceiverRemoved(Receiver aReceiver)
 {
     foreach (MediaPlayer player in iMediaPlayerList)
     {
         if (player.Udn == aReceiver.Udn)
         {
             player.Detach();
             return;
         }
     }
 }
        public void ReceiverAdded(Receiver aReceiver)
        {
            foreach (MediaPlayer player in iMediaPlayerList)
            {
                if (player.Udn == aReceiver.Udn)
                {
                    if (player.Attach(aReceiver))
                    {
                        Save();
                    }

                    return;
                }
            }

            MediaPlayer newplayer = new MediaPlayer(aReceiver, iEnabled);

            iMediaPlayerList.Add(newplayer);

            Save();
        }
        public void StopAndDetach()
        {
            if (iReceiver != null)
            {
                if (iEnabled && iAttached)
                {
                    Stop();
                }

                iReceiver = null;

                UpdateStatus();
            }
        }
        public void Detach()
        {
            iReceiver = null;

            UpdateStatus();
        }
        public bool Attach(Receiver aReceiver)
        {
            iReceiver = aReceiver;

            iReceiver.PropertyChanged += new PropertyChangedEventHandler(EventReceiverPropertyChanged);

            bool changed = false;

            if (iRoom != aReceiver.Room)
            {
                Room = aReceiver.Room;
                changed = true;
            }

            if (iName != aReceiver.Name)
            {
                Name = aReceiver.Name;
                changed = true;
            }

            if (Group != aReceiver.Group)
            {
                Group = aReceiver.Group;
                changed = true;
            }

            if (iEnabled)
            {
                if (iAttached)
                {
                    Play();
                }
            }

            UpdateStatus();

            return (changed);
        }