コード例 #1
0
 public void AddSelectedClient(ClientInfoListItemViewModel clientInfoItemVm)
 {
     if (clientInfoItemVm != null)
     {
         var trustedClientInfo = clientInfoItemVm.GetClientInfo();
         var added = MainViewModel.WindowsClient.TrusedClientsInfos.TryAddTrustedClient(trustedClientInfo);
         if (added)
         {
             var addedClientEvent = new TrustedClientEvent();
             addedClientEvent.AddedTrustedClientInfos.Add(trustedClientInfo);
             _conductor.EventAggregator.PublishOnUIThread(addedClientEvent);
         }
     }
 }
コード例 #2
0
        private void UpdateAvailableClients()
        {
            const int delayInterval = 5000;

            while (true)
            {
                NetworkScanner.RequestUpdate.Cancel();
                var clientInfos = MainViewModel.WindowsClient.GetClientInfos();

                foreach (ClientInfo clientInfo in clientInfos)
                {
                    var clientVm = new ClientInfoListItemViewModel(clientInfo);

                    if (!AvailableClients.Contains(clientVm))
                    {
                        AvailableClients.Add(clientVm);
                    }
                }

                Task.Delay(delayInterval).Wait();
            }
        }