Exemplo n.º 1
0
        public ZoneViewModel(XZoneState zoneState)
        {
            SelectCommand = new RelayCommand(OnSelect);
            ShowOnPlanCommand = new RelayCommand(OnShowOnPlan, CanShowOnPlan);
            ResetFire1Command = new RelayCommand(OnResetFire1, CanResetFire1);
            ResetFire2Command = new RelayCommand(OnResetFire2, CanResetFire2);
            SetIgnoreCommand = new RelayCommand(OnSetIgnore, CanSetIgnore);
            ResetIgnoreCommand = new RelayCommand(OnResetIgnore, CanResetIgnore);

            ZoneState = zoneState;
            ZoneState.StateChanged += new System.Action(OnStateChanged);
            OnStateChanged();
        }
Exemplo n.º 2
0
 public static void CreateStates()
 {
     DeviceStates = new XDeviceConfigurationStates();
     foreach (var device in DeviceConfiguration.Devices)
     {
         var deviceState = new XDeviceState()
         {
             Device = device,
             UID = device.UID,
         };
         DeviceStates.DeviceStates.Add(deviceState);
     }
     foreach (var deviceState in DeviceStates.DeviceStates)
     {
         if (deviceState.Device.Parent != null)
         {
             deviceState.Parent = DeviceStates.DeviceStates.FirstOrDefault(x => x.Device == deviceState.Device.Parent);
         }
         foreach (var childDevice in deviceState.Device.Children)
         {
             deviceState.Children.Add(DeviceStates.DeviceStates.FirstOrDefault(x => x.Device == childDevice));
         }
     }
     foreach (var zone in DeviceConfiguration.Zones)
     {
         var zoneState = new XZoneState()
         {
             Zone = zone,
             UID = zone.UID
         };
         DeviceStates.ZoneStates.Add(zoneState);
     }
     foreach (var direction in DeviceConfiguration.Directions)
     {
         var directionState = new XDirectionState()
         {
             Direction = direction,
             UID = direction.UID
         };
         DeviceStates.DirectionStates.Add(directionState);
     }
 }