Пример #1
0
        private void AddNewSocketInfoWithSave(string ip, int port, string signName, int deviceNumber, string deviceHeader, IoTSocketType iotSocketType)
        {
            var iotSocketInfo = new IoTSocketInfo(ip, port, signName, iotSocketType);

            IoTSocketInfos.Add(iotSocketInfo);
            var deviceSettings = IoTDeviceSettings.GetIoTDeviceSettings();

            deviceSettings.SocketSettings.Add(new IoTSocketSettings(ip, port, signName, iotSocketType));
            if (IoTDeviceService.SaveSettings())
            {
                iotSocketInfo.AddIoTDeviceInfoWithSave(deviceNumber, deviceHeader);
            }
        }
Пример #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);
         }
     });
 }