public ParameterTemplateViewModel(ParameterTemplate parameterTemplate)
		{
			ParameterTemplate = parameterTemplate;
			DeviceParameterTemplates = new List<DeviceParameterTemplateViewModel>();
			foreach (var deviceParameterTemplate in parameterTemplate.DeviceParameterTemplates)
			{
				var deviceParameterTemplateViewModel = new DeviceParameterTemplateViewModel(deviceParameterTemplate);
				DeviceParameterTemplates.Add(deviceParameterTemplateViewModel);
			}
			SelectedDeviceParameterTemplate = DeviceParameterTemplates.FirstOrDefault();
		}
		void OnAdd()
		{
			var maxNo = FiresecManager.ParameterTemplates.Max(x => x.No);
			var parameterTemplate = new ParameterTemplate()
			{
				Name = "Шаблон " + (maxNo + 1).ToString(),
				No = maxNo + 1
			};
			FiresecManager.ParameterTemplates.Add(parameterTemplate);
			Invalidate();
			var parameterTemplateViewModel = new ParameterTemplateViewModel(parameterTemplate);
			ParameterTemplates.Add(parameterTemplateViewModel);
			SelectedParameterTemplate = parameterTemplateViewModel;
			ServiceFactory.SaveService.FSParametersChanged = true;
		}
		void Invalidate()
		{
			if (FiresecManager.FiresecConfiguration.DeviceConfiguration.ParameterTemplates.Count == 0)
			{
				var parameterTemplate = new ParameterTemplate()
				{
					Name = "По умолчанию"
				};
				FiresecManager.ParameterTemplates.Add(parameterTemplate);
			}

			foreach (var parameterTemplate in FiresecManager.ParameterTemplates)
			{
				foreach (var deviceParameterTemplate in parameterTemplate.DeviceParameterTemplates)
				{
					deviceParameterTemplate.Device.Driver = FiresecManager.Drivers.FirstOrDefault(x => x.UID == deviceParameterTemplate.Device.DriverUID);
				}
				parameterTemplate.DeviceParameterTemplates.RemoveAll(x => x.Device.Driver == null);

				foreach (var driver in FiresecManager.Drivers)
				{
					if (driver.Properties.Any(x => x.IsAUParameter))
					{
						var deviceParameterTemplate = parameterTemplate.DeviceParameterTemplates.FirstOrDefault(x => x.Device.DriverUID == driver.UID);
						if (deviceParameterTemplate == null)
						{
							deviceParameterTemplate = new DeviceParameterTemplate()
							{
								Device = new Device()
								{
									DriverUID = driver.UID,
									Driver = driver
								}
							};
							parameterTemplate.DeviceParameterTemplates.Add(deviceParameterTemplate);
						}

						var properties = new List<Property>();
						foreach (var driverProperty in driver.Properties)
						{
							if (driverProperty.IsAUParameter)
							{
								var property = deviceParameterTemplate.Device.SystemAUProperties.FirstOrDefault(x => x.Name == driverProperty.Name);
								if (property == null)
								{
									property = new Property()
									{
										Name = driverProperty.Name,
										Value = driverProperty.Default
									};
									deviceParameterTemplate.Device.SystemAUProperties.Add(property);
								}
								property.DriverProperty = driverProperty;
								properties.Add(property);
							}
						}
						deviceParameterTemplate.Device.SystemAUProperties = properties;
					}
				}
			}
		}