Example #1
0
        void IUPnPDeviceFinderCallback.DeviceRemoved(int lFindData, string bstrUDN)
        {
            DispatcherOperation dispOperation = Dispatcher.BeginInvoke(DispatcherPriority.DataBind, (ThreadStart) delegate
            {
                ZonePlayer found = null;
                foreach (ZonePlayer zp in _zonePlayers)
                {
                    if (zp.UniqueDeviceName == bstrUDN)
                    {
                        found = zp;
                        break;
                    }
                }

                if (found != null)
                {
                    _zonePlayers.Remove(found);
                }
            });

            dispOperation.Completed += delegate
            {
                PropertyChanged(this, new PropertyChangedEventArgs("ZonePlayers"));
            };
        }
Example #2
0
        public ZonePlayer Intern(string uniqueDeviceName)
        {
            bool       zpAdded    = false;
            ZonePlayer zonePlayer = (ZonePlayer)Dispatcher.Invoke(DispatcherPriority.Normal, (InternHandler) delegate
            {
                foreach (ZonePlayer zpi in _zonePlayers)
                {
                    if (String.CompareOrdinal(zpi.UniqueDeviceName, uniqueDeviceName) == 0)
                    {
                        return(zpi);
                    }
                }

                ZonePlayer zp = new ZonePlayer(uniqueDeviceName);

                if (_topologyHandled == false)
                {
                    zp.ZoneGroupTopology.PropertyChanged += new PropertyChangedEventHandler(ZoneGroupTopology_PropertyChanged);
                    _topologyHandled = true;
                }

                _zonePlayers.Add(zp);
                zpAdded = true;
                return(zp);
            });

            if (zpAdded)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("ZonePlayers"));
            }

            return(zonePlayer);
        }
Example #3
0
        public ZoneGroup(Discover disc, XPathNavigator node)
        {
            _coordinator = node.SelectSingleNode("@Coordinator").Value;
            _id = node.SelectSingleNode("@ID").Value;

            foreach (XPathNavigator nav in node.Select("ZoneGroupMember"))
            {
                ZonePlayer zp = disc.Intern(String.Concat("uuid:", nav.SelectSingleNode("@UUID").Value));
                _members.Add(zp);
            }

            _coordinatorZone = disc.Intern(String.Concat("uuid:", _coordinator));
            _members.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(_members_CollectionChanged);
        }