private void OnWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
        {
            int target = -1;

            for (int i = 0; i < RemoteSystems.Count; i++)
            {
                if (RemoteSystems[i].Id == args.RemoteSystem.Id)
                {
                    target = i;
                    break;
                }
            }

            if (target >= 0)
            {
                DispatcherHelper.UIDispatcher.RunIdleAsync(_ =>
                {
                    var original          = RemoteSystems[target];
                    RemoteSystems[target] = args.RemoteSystem;
                    if (SelectedRemoteSystem == original)
                    {
                        SelectedRemoteSystem = args.RemoteSystem;
                    }
                });
            }
        }
コード例 #2
0
        private void DevicesWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
        {
            var updateTask = this.dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                var existDevice = devicesList.Where(x => x.Id == args.RemoteSystem.Id).FirstOrDefault();

                if (existDevice != null)
                {
                    devicesList.Remove(existDevice);
                }

                devicesList.Add(args.RemoteSystem);
            });
        }
コード例 #3
0
        private static void _watcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
        {
            // Remote and re-add remote system
            var remoteSystem = args.RemoteSystem;

            RemoteSystemList.RemoveAll(d => d.Id == remoteSystem.Id);
            RemoteSystemList.Add(remoteSystem);

            Events.TrackEvent(Events.RemoteSystemUpdated);

            DebugWrite(
                $"RemoteSystemUpdated: {remoteSystem.DisplayName} {remoteSystem.Id} {remoteSystem.IsAvailableByProximity} {remoteSystem.Kind} {remoteSystem.Status}");

            OnRemoteDeviceUpdated?.Invoke(null, remoteSystem);
        }
コード例 #4
0
 private async void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         if (DeviceMap.ContainsKey(args.RemoteSystem.Id))
         {
             DeviceList.Remove(DeviceMap[args.RemoteSystem.Id]);
             DeviceMap.Remove(args.RemoteSystem.Id);
         }
         DeviceList.Add(args.RemoteSystem);
         DeviceMap.Add(args.RemoteSystem.Id, args.RemoteSystem);
         //UpdateStatus("Device updated with Id = " + args.RemoteSystem.Id, NotifyType.StatusMessage);
     });
 }
コード例 #5
0
        private async void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
        {
            await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
            {
                var index = RemoteSystems.IndexOf(RemoteSystems.FirstOrDefault(rs => rs.Id == args.RemoteSystem.Id));

                if (index > -1)
                {
                    RemoteSystems[index] = args.RemoteSystem;
                }
            });
        }
コード例 #6
0
 private void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher watcher, RemoteSystemUpdatedEventArgs args)
 {
     RunOnUiThread(() =>
     {
         _adapter.Remove(_adapter.Items.FirstOrDefault(system => system.Id == args.P0.Id));
         _adapter.Add(args.P0);
     }
                   );
 }
コード例 #7
0
ファイル: MainActivity.cs プロジェクト: szends/project-rome
 private void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher watcher, RemoteSystemUpdatedEventArgs args)
 {
     RunOnUiThread(() =>
     {
         _remoteSystems.RemoveAll(system => system.Id == args.P0.Id);
         _remoteSystems.Add(args.P0);
     }
                   );
 }
コード例 #8
0
        private void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
        {
            CompanionDevice d = new CompanionDevice(args.RemoteSystem.Id, true, args.RemoteSystem.DisplayName, string.Empty, args.RemoteSystem.Kind);

            if ((d != null) && (listCompanionDevices != null) && (listRemoteSystems != null))
            {
                d.IsAvailableByProximity = args.RemoteSystem.IsAvailableByProximity;
                // Anniversary issue
                //d.IsAvailableBySpatialProximity = args.RemoteSystem.IsAvailableBySpatialProximity;
                d.Status = CompanionDeviceStatus.Available;
                if (listCompanionDevices.ContainsKey(args.RemoteSystem.Id))
                {
                    listCompanionDevices.Remove(args.RemoteSystem.Id);
                }
                listCompanionDevices.Add(args.RemoteSystem.Id, d);
                OnDeviceUpdated(this, d);

                if (listRemoteSystems.ContainsKey(args.RemoteSystem.Id))
                {
                    listRemoteSystems.Remove(args.RemoteSystem.Id);
                }
                listRemoteSystems.Add(args.RemoteSystem.Id, args.RemoteSystem);
            }
        }
コード例 #9
0
 private async void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         if (m_rootPage.systemMap.ContainsKey(args.RemoteSystem.Id))
         {
             m_rootPage.systemList.Remove(m_rootPage.systemMap[args.RemoteSystem.Id]);
             m_rootPage.systemMap.Remove(args.RemoteSystem.Id);
         }
         m_rootPage.systemList.Add(args.RemoteSystem);
         m_rootPage.systemMap.Add(args.RemoteSystem.Id, args.RemoteSystem);
         UpdateStatus("System updated with Id = " + args.RemoteSystem.Id, NotifyType.StatusMessage);
     });
 }
コード例 #10
0
 private static void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
 {
     remoteSystems[remoteSystems.FindIndex(x => x.Id == args.RemoteSystem.Id)] = args.RemoteSystem;
     updateSystems();
 }
コード例 #11
0
 private async void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         _progressRing.IsActive = true;
         if (DeviceMap.ContainsKey(args.RemoteSystem.Id))
         {
             RemoteSystems.Remove(DeviceMap[args.RemoteSystem.Id]);
             DeviceMap.Remove(args.RemoteSystem.Id);
         }
         RemoteSystems.Add(args.RemoteSystem);
         DeviceMap.Add(args.RemoteSystem.Id, args.RemoteSystem);
         UpdateList();
     });
 }
コード例 #12
0
        private void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
        {
            var system = systemList.FirstOrDefault(x => x.Id == args.RemoteSystem.Id);

            if (system != null)
            {
                systemList[systemList.IndexOf(system)] = args.RemoteSystem;
                App.Dispatcher.RunWhenIdleAsync(() =>
                {
                    RemoteSystemsListUpdated?.Invoke(this, EventArgs.Empty);
                });
            }
        }
コード例 #13
0
 private async void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         Debug.WriteLine($"Entered Remote System Updating");
     });
 }
コード例 #14
0
 private async void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
 {
     await DispatcherQueue.EnqueueAsync(() =>
     {
         RemoteSystems.Remove(RemoteSystems.First(a => a.Id == args.RemoteSystem.Id));
         RemoteSystems.Add(args.RemoteSystem);
     });
 }
コード例 #15
0
ファイル: RomeHelper.cs プロジェクト: mrandreastoth/Roamit
        private async void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
        {
            RemoteSystem remoteSystem = null;
            await DispatcherEx.RunOnCoreDispatcherIfPossible(() =>
            {
                remoteSystem = _remoteSystems.Where(s => s.Id == args.RemoteSystem.Id).FirstOrDefault();
            });

            await DispatcherEx.RunOnCoreDispatcherIfPossible(() =>
            {
                if (remoteSystem != null)
                {
                    _remoteSystems.Remove(remoteSystem);
                }
                AddToRemoteSystemsList(args.RemoteSystem);
            });
        }
 private async void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
 {
     await CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         int index = RemoteSystems.IndexOf(RemoteSystems.FirstOrDefault(rs => rs.Id == args.RemoteSystem.Id));
         if (index > -1)
         {
             RemoteSystems[index] = args.RemoteSystem;
         }
     });
 }
コード例 #17
0
        private async void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
        {
            var remoteSystem = _remoteSystems.Where(s => s.Id == args.RemoteSystem.Id).FirstOrDefault();

            if (remoteSystem != null)
            {
                return;
            }

            var existingSystem = _availableRemoteSystems.Where(s => s.RemoteSystem.Id == args.RemoteSystem.Id).FirstOrDefault();

            if (existingSystem == null)
            {
                var system = await AdventureRemoteSystem.CreateAdventureRemoteSystem(args.RemoteSystem).ConfigureAwait(false);

                if (system != null)
                {
                    var t = Helpers.RunOnCoreDispatcherIfPossible(() =>
                    {
                        if (_availableRemoteSystems.Where(s => s.RemoteSystem.Id == system.RemoteSystem.Id).Count() == 0)
                        {
                            _availableRemoteSystems.Add(system);
                            RemoteSystemAdded?.Invoke(this, system);
                        }
                    });
                }
            }
        }
コード例 #18
0
ファイル: RomeHelper.cs プロジェクト: meteorsnows/Roamit
        private void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher watcher, RemoteSystemUpdatedEventArgs args)
        {
            RemoteSystem remoteSystem = null;

            remoteSystem = RemoteSystems.Where(s => s.Id == args.P0.Id).FirstOrDefault();
            if (remoteSystem != null)
            {
                RemoteSystems.Remove(remoteSystem);
            }
            AddToRemoteSystemsList(args.P0);
        }
 private async void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         if (m_rootPage.deviceMap.ContainsKey(args.RemoteSystem.Id))
         {
             m_rootPage.deviceList.Remove(m_rootPage.deviceMap[args.RemoteSystem.Id]);
             m_rootPage.deviceMap.Remove(args.RemoteSystem.Id);
         }
         m_rootPage.deviceList.Add(args.RemoteSystem);
         m_rootPage.deviceMap.Add(args.RemoteSystem.Id, args.RemoteSystem);
         UpdateStatus("Device updated with Id = " + args.RemoteSystem.Id, NotifyType.StatusMessage);
     });
 }
コード例 #20
0
 private async void M_remoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         RemoteSystems.Remove(RemoteSystems.First(rs => rs.Id == args.RemoteSystem.Id));
         RemoteSystems.Add(args.RemoteSystem);
     });
 }
コード例 #21
0
 private async void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher sender, RemoteSystemUpdatedEventArgs args)
 {
     await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
     {
         RemoteSystems.Remove(RemoteSystems.First(a => a.Id == args.RemoteSystem.Id));
         RemoteSystems.Add(args.RemoteSystem);
     });
 }
コード例 #22
0
 private void RemoteSystemUpdated(RemoteSystemWatcher watcher, RemoteSystemUpdatedEventArgs args)
 {
 }
コード例 #23
0
        private void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher watcher, RemoteSystemUpdatedEventArgs args)
        {
            System.Diagnostics.Debug.WriteLine("KNOWZY: RemoteSystemUpdated " + args.P0.Id);
            remoteSystems.RemoveAll(system => system.Id == args.P0.Id);
            remoteSystems.Add(args.P0);

            RemoteSystemUpdated?.Invoke(this, args);
        }