Exemple #1
0
 private void DeviceListBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (DeviceListBox.SelectedItem is Device device)
     {
         //上一个线程如果没完成就强制结束
         _lastConnectThread?.Abort();
         _lastConnectThread = Client.StartAction(() =>
         {
             //加锁,避免出现线程安全问题
             lock ("connect")
             {
                 //连接屏幕
                 MyMirrorScreen.Connect(device);
             }
         });
         RunningModules.ItemsSource = device.RunningModules;
         var rmmd5list = from rm in device.RunningModules select rm.Md5;
         foreach (var m in Client.Modules)
         {
             if (rmmd5list.Contains(m.Md5))
             {
                 m.State = 1;
             }
             else
             {
                 m.State = 0;
             }
         }
     }
     else
     {
         MyMirrorScreen.Disconnect();
     }
 }
Exemple #2
0
 private void DeviceListBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (DeviceListBox.SelectedItem is Device device)
     {
         //上一个线程如果没完成就强制结束
         _lastConnectThread?.Abort();
         _lastConnectThread = Client.StartAction(() =>
         {
             //加锁,避免出现线程安全问题
             lock ("connect")
             {
                 //连接屏幕
                 MyMirrorScreen.Connect(device);
             }
         });
     }
 }