Пример #1
0
 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);
     });
 }
Пример #2
0
 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);
         }
     });
 }
Пример #3
0
 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);
         }
     });
 }
Пример #4
0
        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();
        }