private void StopControlPoint(UpnpSmartControlPoint controlPoint) { controlPoint.ShutDown(); controlPoint.OnAddedDevice -= controPoint_OnAddedDevice; controlPoint.OnRemovedDevice -= controPoint_OnRemovedDevice; controlPoint.OnDeviceExpired -= controPoint_OnDeviceExpired; controlPoint = null; }
private void controPoint_OnAddedDevice(UpnpSmartControlPoint sender, UPnPDevice device) { if (device.StandardDeviceType == "MediaRenderer") { UPnPService service = device.GetService("AVTransport"); if (service != null) { this.Dispatcher.BeginInvoke((Action)(() => { this.deviceList.Items.Add(device); })); } } }
private void StartControlPoint() { //添列表 this.deviceList.Items.Clear(); if (this.smart != null) { StopControlPoint(this.smart); } this.smart = new UpnpSmartControlPoint(); this.smart.OnAddedDevice += controPoint_OnAddedDevice; this.smart.OnRemovedDevice += controPoint_OnRemovedDevice; this.smart.OnDeviceExpired += controPoint_OnDeviceExpired; }
private void controPoint_OnDeviceExpired(UpnpSmartControlPoint sender, UPnPDevice device) { //this.deviceList.Items.Remove(device); }