private void OnDeviceAdded(UPnPSmartControlPoint cp, UPnPDevice device) { Console.WriteLine("found player " + device); //players.Add(new SonosPlayer(device)); // we need to save these for future reference lock (playerDevices) { playerDevices[device.UniqueDeviceName] = device; } // okay, we will try and notify the players that they have been found now. var player = players.FirstOrDefault(p => p.UUID == device.UniqueDeviceName); if (player != null) { player.SetDevice(device); } // Subscribe to events var topologyService = device.GetService("urn:upnp-org:serviceId:ZoneGroupTopology"); topologyService.Subscribe(600, (service, subscribeok) => { if (!subscribeok) return; var stateVariable = service.GetStateVariableObject("ZoneGroupState"); stateVariable.OnModified += OnZoneGroupStateChanged; }); }