public static void AllChildren(XDeviceState deviceState) { alDevicelChildren.Add(deviceState); foreach (var child in deviceState.Children) { alDevicelChildren.Add(child); AllChildren(child); } }
public static List<XDirectionState> GetAllGKDirectionStates(XDeviceState gkDeviceState) { var directionStates = new List<XDirectionState>(); foreach (var directionState in DeviceStates.DirectionStates) { if (directionState.Direction.GkDatabaseParent == gkDeviceState.Device) { directionStates.Add(directionState); } } return directionStates; }
public DeviceCommandsViewModel(XDeviceState deviceState) { DeviceState = deviceState; SetIgnoreCommand = new RelayCommand(OnSetIgnore, CanSetIgnore); ResetIgnoreCommand = new RelayCommand(OnResetIgnore, CanResetIgnore); SetAutomaticCommand = new RelayCommand(OnSetAutomatic, CanSetAutomatic); ResetAutomaticCommand = new RelayCommand(OnResetAutomatic, CanResetAutomatic); TurnOnCommand = new RelayCommand(OnTurnOn, CanTurnOn); CancelDelayCommand = new RelayCommand(OnCancelDelay, CanCancelDelay); TurnOffCommand = new RelayCommand(OnTurnOff, CanTurnOff); StopCommand = new RelayCommand(OnStop, CanStop); CancelStartCommand = new RelayCommand(OnCancelStart, CanCancelStart); TurnOnNowCommand = new RelayCommand(OnTurnOnNow, CanTurnOnNow); TurnOffNowCommand = new RelayCommand(OnTurnOffNow, CanTurnOffNow); }
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); } }
public static List<XZoneState> GetAllGKZoneStates(XDeviceState gkDeviceState) { var zoneStates = new List<XZoneState>(); foreach (var zoneState in DeviceStates.ZoneStates) { if (zoneState.Zone.GkDatabaseParent == gkDeviceState.Device) { zoneStates.Add(zoneState); } } return zoneStates; }
public static List<XDeviceState> GetAllDeviceChildren(XDeviceState gkDeviceState) { alDevicelChildren = new List<XDeviceState>(); AllChildren(gkDeviceState); return alDevicelChildren; }