private async void PingPong_OnRemoteDeviceAdded(object sender, RemoteSystem e) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { var system = new RemoteSystemInfo(e); RemoteSystemInfoCollection.Add(system); }); }
private async void PingPong_OnRemoteDeviceRemoved(object sender, string e) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { var remoteSystemInfo = RemoteSystemInfoCollection.FirstOrDefault(d => d.Id == e); if (remoteSystemInfo != null) { RemoteSystemInfoCollection.Remove(remoteSystemInfo); } }); }
private async void PingPong_OnRemoteDeviceUpdated(object sender, RemoteSystem e) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { var remoteSystemInfo = RemoteSystemInfoCollection.FirstOrDefault(d => d.Id == e.Id); if (remoteSystemInfo != null) { int index = RemoteSystemInfoCollection.IndexOf(remoteSystemInfo); RemoteSystemInfoCollection.RemoveAt(index); remoteSystemInfo.RemoteSystem = e; RemoteSystemInfoCollection.Insert(index, remoteSystemInfo); } }); }
private void RefreshDevices() { DetailContentPresenter.Visibility = Visibility.Collapsed; if (_registeredHandlers == false) { PingPong.OnAppServiceConnected += PingPong_OnAppServiceConnected; PingPong.OnRemoteDeviceAdded += PingPong_OnRemoteDeviceAdded; PingPong.OnRemoteDeviceUpdated += PingPong_OnRemoteDeviceUpdated; PingPong.OnRemoteDeviceRemoved += PingPong_OnRemoteDeviceRemoved; PingPong.OnStatusUpdateMessage += PingPong_OnStatusUpdateMessage; PingPong.OnErrorMessage += PingPong_OnErrorMessage; _registeredHandlers = true; } RemoteSystemInfoCollection.Clear(); PingPong.DiscoverDevices(); }