Exemplo n.º 1
0
        static void OnCompleted()
        {
            if (_operationResult.HasError)
            {
                MessageBoxService.ShowError(_operationResult.Error, "Ошибка при выполнении операции");
                return;
            }

            var deviceConfiguration = _operationResult.Result;
            deviceConfiguration.Update();

            foreach (var device in deviceConfiguration.Devices)
            {
                var driver = FiresecManager.Drivers.FirstOrDefault(x => x.UID.ToString().ToUpper() == device.DriverUID.ToString().ToUpper());
                device.Driver = driver;
            }

            var autodetectionViewModel = new AutoSearchViewModel(deviceConfiguration)
            {
                DeviceViewModels = _deviceViewModel.Source
            };

            if (DialogService.ShowModalWindow(autodetectionViewModel))
                RunAutodetection(false);
        }
Exemplo n.º 2
0
		static void OnCompleted()
		{
			if (_operationResult.HasError)
			{
				MessageBoxService.ShowError(_operationResult.Error, "Ошибка при выполнении операции");
				Logger.Error("AutoDetectDeviceHelper.OnCompleted " + _operationResult.Error);
				return;
			}

			if (_operationResult.Result == null)
			{
				MessageBoxService.Show("Устройств не обнаружено");
				return;
			}

			var deviceConfiguration = _operationResult.Result;
			deviceConfiguration.Update();
			deviceConfiguration.UpdateIdPath();

			foreach (var device in deviceConfiguration.Devices)
			{
				var driver = FiresecManager.Drivers.FirstOrDefault(x => x.UID.ToString().ToUpper() == device.DriverUID.ToString().ToUpper());
				device.Driver = driver;
				if (device.Driver.DriverType == DriverType.MS_1 || device.Driver.DriverType == DriverType.MS_2)
				{
					var property = device.Properties.FirstOrDefault(x => x.Name == "SerialNo");
					if (property != null)
					{
						property.Value = null;
					}
				}
			}

			var autodetectionViewModel = new AutoSearchViewModel(deviceConfiguration);
			if (DialogService.ShowModalWindow(autodetectionViewModel))
				RunAutodetection(false);
		}