Esempio n. 1
0
 private void InitRemoveIpAddressCommand()
 {
     RemoveIpAddressCommand = new RelayCommand(() =>
     {
         var dialog = new RemoveItemsView("删除IP地址", IoTSocketInfos.Select(s => s.SignName).ToList());
         if (dialog.ShowDialog() == true)
         {
             var removeSignName = dialog.SelectedItems;
             foreach (var signName in removeSignName)
             {
                 var serialPortInfo = IoTSocketInfos.FirstOrDefault(s => s.SignName == signName);
                 if (serialPortInfo != null)
                 {
                     serialPortInfo.Cleanup();
                     IoTSocketInfos.Remove(serialPortInfo);
                 }
             }
             IoTDeviceService.SaveSettings();
         }
     });
 }
Esempio n. 2
0
 private void InitLoadedCommand()
 {
     LoadedCommand = new RelayCommand(() =>
     {
         if (_isLoaded)
         {
             return;
         }
         _isLoaded          = true;
         var deviceSettings = IoTDeviceSettings.GetIoTDeviceSettings();
         foreach (var ioTSocketSettings in deviceSettings.SocketSettings)
         {
             var ioTSocketInfo = new IoTSocketInfo(ioTSocketSettings.Ip, ioTSocketSettings.Port, ioTSocketSettings.SignName, IoTSocketType.Server);
             foreach (var ioTDetailDeviceSettings in ioTSocketSettings.IoTDetailDevicesSettings)
             {
                 ioTSocketInfo.IoTInfos.Add(new IoTDeviceInfo(ioTDetailDeviceSettings.DeviceNumber, ioTDetailDeviceSettings.DeviceHeader, ioTSocketSettings.SignName));
             }
             IoTSocketInfos.Add(ioTSocketInfo);
         }
     });
 }