public static void Run()
 {
     foreach (var device in FiresecManager.Devices)
     {
         bool hasError = false;
         if (device.Driver.CanWriteDatabase)
         {
             var deviceName = device.PresentationAddressAndDriver + ". Запись конфигурации в устройство";
             ServiceFactory.ProgressService.Run(
                 new Action
                     (
                     () =>
                     {
                         _operationResult = FiresecManager.DeviceWriteConfiguration(device.UID, false);
                         if (_operationResult.HasError)
                         {
                             MessageBoxService.ShowError(_operationResult.Error, "Ошибка при выполнении операции");
                             hasError = true;
                             return;
                         }
                     }
                     ),
                 null, deviceName);
         }
         if (hasError)
             return;
     }
     MessageBoxService.Show("Операция завершилась успешно");
 }
		public static void Run(bool showMessageBoxOnError = true)
		{
			Errors = new List<string>();
			foreach (var device in FiresecManager.Devices)
			{
				if (device.Driver.CanWriteDatabase)
				{
					var deviceName = device.PresentationAddressAndName + ". Запись конфигурации в устройство";
					ServiceFactory.ProgressService.Run(
						new Action
							(
							() =>
							{
								_operationResult = FiresecManager.DeviceWriteConfiguration(device, false);
								if (_operationResult.HasError)
								{
									Errors.Add(device.PresentationAddressAndName + " " + _operationResult.Error);
								}
							}
							),
						null, deviceName);
				}
			}
			if (showMessageBoxOnError)
			{
				if (Errors.Count > 0)
				{
					var stringBuilder = new StringBuilder();
					foreach (var error in Errors)
					{
						stringBuilder.AppendLine(error);
					}
					MessageBoxService.Show(stringBuilder.ToString());
				}
				else
				{
					MessageBoxService.Show("Операция завершилась успешно");
				}
			}
		}
예제 #3
0
 static void OnPropgress()
 {
     _operationResult = FiresecManager.DeviceGetSerialList(_device.UID);
 }
		static void OnPropgress()
		{
			_operationResult = FiresecManager.DeviceReadConfiguration(_device, _isUsb);
		}
예제 #5
0
 static void OnPropgress()
 {
     _operationResult = FiresecManager.SynchronizeDevice(_device, _isUsb);
 }
 static void OnPropgress()
 {
     _operationResult = FiresecManager.DeviceWriteConfiguration(_device.UID, _isUsb);
 }
 static void OnPropgress()
 {
     _operationResult = FiresecManager.DeviceGetInformation(Device, IsUsb);
 }
예제 #8
0
		void OnUpdateFirmwhare()
		{
		    var result = new OperationResult<bool>();
			if (SelectedDevice.Device.DriverType == SKDDriverType.Controller)
		    {
		        var openDialog = new OpenFileDialog()
		        {
		            Filter = "FSCS updater|*.fscs",
		            DefaultExt = "FSCS updater|*.fscs"
		        };
		        if (openDialog.ShowDialog().Value)
		        {
                    var gkKauKauRsr2Devices = XManager.DeviceConfiguration.Devices.FindAll(x => (x.Driver.DriverType == XDriverType.GK)||(x.Driver.IsKauOrRSR2Kau));
					//var firmWareUpdateViewModel = new FirmWareUpdateViewModel(gkKauKauRsr2Devices);
					//if (DialogService.ShowModalWindow(firmWareUpdateViewModel))
					//{
					//    var hxcFileInfo = HXCFileInfoHelper.Load(openDialog.FileName);
					//    var devices = new List<XDevice>();
					//    firmWareUpdateViewModel.UpdatedDevices.FindAll(x => x.IsChecked).ForEach(x => devices.Add(x.Device));
					//    result = FiresecManager.FiresecService.GKUpdateFirmwareFSCS(hxcFileInfo, devices);

					//}
		        }
		    }
		    else
            {
		        var openDialog = new OpenFileDialog()
		        {
		            Filter = "soft update files|*.hcs",
		            DefaultExt = "soft update files|*.hcs"
		        };
				//if (openDialog.ShowDialog().Value)
				//    result = FiresecManager.FiresecService.GKUpdateFirmware(SelectedDevice.Device, openDialog.FileName);
            }
            if (result.HasError)
                MessageBoxService.ShowError(result.Error, "Ошибка при обновление ПО");
		}
		static void OnPropgress()
		{
			OperationResult = FiresecManager.DeviceSetGuardUsersList(Device, Users);
		}
예제 #10
0
 void OnPropgress()
 {
     var userlist = CodeDateToTranslate();
     _operationResult = FiresecManager.DeviceSetGuardUsersList(SelectedDevice.UID, userlist);
 }
예제 #11
0
		static void OnUpdatePropgress()
		{
			_operationResult_2 = FiresecManager.DeviceUpdateFirmware(_device, _isUsb, new FileInfo(_fileName).FullName);
		}
예제 #12
0
		static void OnVarifyPropgress()
		{
			_operationResult_1 = FiresecManager.DeviceVerifyFirmwareVersion(_device, _isUsb, new FileInfo(_fileName).FullName);
		}
예제 #13
0
 static void OnPropgress()
 {
     _operationResult = FiresecManager.SetPassword(_deviceUID, _isUsb, _devicePasswordType, _password);
 }
 static void OnPropgress()
 {
     _operationResult = FiresecManager.DeviceCustomFunctionExecute(_device.UID, _functionCode);
 }
예제 #15
0
		static void OnPropgress()
		{
			_operationResult = FiresecManager.AutoDetectDevice(_deviceViewModel.Device, _fastSearch);
		}
예제 #16
0
		static void OnPropgress()
		{
			_operationResult = FiresecManager.ReadDeviceJournal(_device, _isUsb);
		}
예제 #17
0
 static void OnPropgress()
 {
     _operationResult = FiresecManager.DeviceGetInformation(_device.UID, _isUsb);
 }
예제 #18
0
 void OnPropgress()
 {
     _operationResult = FiresecManager.DeviceGetMDS5Data(Device.UID);
 }
예제 #19
0
		public static bool SetNewConfig()
		{
			try
			{
				ServiceFactory.Events.GetEvent<BeforeConfigurationSerializeEvent>().Publish(null);
				ServiceFactory.Events.GetEvent<ConfigurationSavingEvent>().Publish(null);

				var validationResult = ServiceFactory.ValidationService.Validate();
				if (validationResult.HasErrors())
				{
					if (validationResult.CannotSave())
					{
						MessageBoxService.ShowWarning("Обнаружены ошибки. Операция прервана");
						return false;
					}

					if (!MessageBoxService.ShowQuestion("Конфигурация содержит ошибки. Продолжить?"))
						return false;
				}

				var setConfigResult = new OperationResult<bool>();
				WaitHelper.Execute(() =>
				{
					ClientManager.RubezhService.GKAddMessage(JournalEventNameType.Применение_конфигурации, "");
					LoadingService.Show("Применение конфигурации", "Применение конфигурации", 10);

					if (ServiceFactory.SaveService.SecurityChanged)
					{
						ClientManager.RubezhService.SetSecurityConfiguration(ClientManager.SecurityConfiguration);
					}
					if (ConnectionSettingsManager.IsRemote)
					{
						var tempFileName = SaveConfigToFile(false);
						using (var fileStream = new FileStream(tempFileName, FileMode.Open))
						{
							setConfigResult = ClientManager.RubezhService.SetRemoteConfig(fileStream);
						}
						File.Delete(tempFileName);
					}
					else
					{
						SaveConfigToFile(true);
						setConfigResult = ClientManager.RubezhService.SetLocalConfig();
					}
				});
				LoadingService.Close();
				if (setConfigResult.HasError)
				{
					MessageBoxService.ShowWarning(setConfigResult.Error);
					return false;
				}
				ServiceFactory.SaveService.Reset();
				return true;
			}
			catch (Exception e)
			{
				Logger.Error(e, "MenuView.SetNewConfig");
				MessageBoxService.ShowError(e.Message, "Ошибка при выполнении операции");
				return false;
			}
		}