private void EventDeviceSelectionChanged(object sender, RoutedEventArgs e)
        {
            if (comboBoxDevices.SelectedIndex == -1)
            {
                return;
            }

            DeviceUpnp device = (DeviceUpnp)comboBoxDevices.SelectedItem;

            uglyNameTextBox.Text = ViewerManager.GetUglyName(device.Udn);
        }
Ejemplo n.º 2
0
            private ISource CreateSource(string aName, string aType, bool aVisible)
            {
                ISource source;

                if (aType == kSourceTypeUpnp)
                {
                    if (iLinnMediaRendererDevice == null)
                    {
                        iLinnMediaRendererDevice = DeviceUpnp.CreateLinnMediaRendererDevice(iDevice);
                    }

                    source = new Source(aName, aType, aVisible, iLinnMediaRendererDevice);
                }
                else
                {
                    source = new Source(aName, aType, aVisible, iDevice);
                }

                return(source);
            }
Ejemplo n.º 3
0
        public string Update()
        {
            string     err = "";
            DeviceUpnp dev = new DeviceUpnp(iUuid, iUri);

            iUpdated.Reset();
            dev.Open();
            dev.EventOpened     += new EventHandler <EventArgs>(EvOpen);
            dev.EventOpenFailed += new EventHandler <EventArgs>(EvOpenFailed);
            iTest.EventKill     += new EventHandler <EventArgs>(EvKill);
            iUpdated.WaitOne();

            if (!iKill)
            {
                if (iOpened)
                {
                    try
                    {
                        XmlDocument         document  = new XmlDocument();
                        XmlNamespaceManager nsmanager = new XmlNamespaceManager(document.NameTable);

                        iAddress = dev.Location.Split(':')[1].Substring(2);
                        iModel   = dev.Model;
                        iName    = dev.Name;

                        document.LoadXml(dev.DeviceXml);
                        nsmanager.AddNamespace("u", iUpnpNs);
                        iManufacturer = document.SelectSingleNode("/u:root/u:device/u:manufacturer", nsmanager).InnerText;
                    }
                    catch (Exception e)
                    {
                        err = "Error parsing device XML:- " + e;
                    }
                }
                else
                {
                    err = "Error retrieving device XML";
                }
            }
            return(err);
        }
Ejemplo n.º 4
0
        internal void DoCloudServerAdded(string aLocation)
        {
            try
            {
                if (!iCloudServers.ContainsKey(aLocation))
                {
                    Device      device = new DeviceUpnp(aLocation);
                    MediaServer server = new MediaServer(this, device);
                    iMediaServers.Add(device, server);
                    iCloudServers.Add(aLocation, device);

                    Trace.WriteLine(Trace.kTopology, "Cloud+                " + device);

                    if (EventMediaServerAdded != null)
                    {
                        EventMediaServerAdded(this, new EventArgsMediaServer(server));
                    }
                }
            }
            catch (Exception) { }
        }
Ejemplo n.º 5
0
 public DeviceEventArgs(DeviceUpnp aDevice)
 {
     iDevice = aDevice;
 }