Ejemplo n.º 1
0
		static void AddTempStates()
		{
			var driver = ConfigurationManager.Drivers.FirstOrDefault(x => x.DriverType == DriverType.AM1_O);
			if (driver != null)
			{
				var state = driver.States.FirstOrDefault(x => x.Code == "Alarm_AM1O");
				if (state == null)
				{
					var alarmState = driver.States.FirstOrDefault(x => x.Code == "Alarm");
					if (alarmState != null)
					{
						state = new DriverState()
						{
							Code = "Alarm_AM1O",
							Id = "999",
							AffectChildren = alarmState.AffectChildren,
							AffectParent = alarmState.AffectParent,
							CanResetOnPanel = alarmState.CanResetOnPanel,
							IsAutomatic = alarmState.IsAutomatic,
							IsManualReset = alarmState.IsManualReset,
							Name = alarmState.Name,
							StateType = alarmState.StateType
						};
						driver.States.Add(state);
					}
				}
			}
		}
Ejemplo n.º 2
0
 public DriverState Copy()
 {
     var driverState = new DriverState();
     driverState.Id = Id;
     driverState.Name = Name;
     driverState.AffectChildren = AffectChildren;
     driverState.AffectParent = AffectParent;
     driverState.StateType = StateType;
     driverState.IsManualReset = IsManualReset;
     driverState.CanResetOnPanel = CanResetOnPanel;
     driverState.IsAutomatic = IsAutomatic;
     driverState.Code = Code;
     return driverState;
 }
Ejemplo n.º 3
0
		public StateViewModel(DriverState driverState, Device device = null)
		{
			DriverState = driverState;
			Name = driverState.Name;
			if (device != null && device.Driver.DriverType == DriverType.AM1_T)
			{
				switch (driverState.Name)
				{
					case "Состояние 1":
						var property = device.Properties.FirstOrDefault(x => x.Name == "Event1");
						if (property != null)
							Name = property.Value;
						break;

					case "Состояние 2":
						property = device.Properties.FirstOrDefault(x => x.Name == "Event2");
						if (property != null)
							Name = property.Value;
						break;
				}
			}
		}
Ejemplo n.º 4
0
 public DeviceStateViewModel(DriverState driverState)
 {
     DriverState = driverState;
 }