Ejemplo n.º 1
0
        public DevicesViewModel()
        {
            ResetAllCommand = new RelayCommand(OnResetAll);

            Devices = new ObservableCollection<DeviceViewModel>();
            foreach (var device in ItvManager.DeviceConfiguration.Devices)
            {
                var deviceViewModel = new DeviceViewModel(device);
                Devices.Add(deviceViewModel);
            }
        }
Ejemplo n.º 2
0
        public ZonesViewModel()
        {
            SetZoneGuardCommand = new RelayCommand(OnSetZoneGuard, CanSetZoneGuard);
            UnSetZoneGuardCommand = new RelayCommand(OnUnSetZoneGuard, CanUnSetZoneGuard);

            Zones = new ObservableCollection<ZoneViewModel>();
            foreach (var zoneState in ItvManager.DeviceStates.ZoneStates)
            {
                var deviceViewModel = new ZoneViewModel(zoneState);
                Zones.Add(deviceViewModel);
            }
        }
Ejemplo n.º 3
0
        public DeviceViewModel(Device device)
        {
            AddToIgnoreListCommand = new RelayCommand(OnAddToIgnoreList, CanAddToIgnoreList);
            RemoveFromIgnoreListCommand = new RelayCommand(OnRemoveFromIgnoreList, CanRemoveFromIgnoreList);
            Device = device;
            DeviceState = device.DeviceState;
            _stateType = DeviceState.StateType;
            ItvManager.DeviceStateChanged += new Action<DeviceState>(OnDeviceStateChanged);
            Name = Device.Driver.ShortName + " - " + Device.DottedAddress;

            DeviceCommands = new List<DeviceCommandViewModel>();
            foreach (var property in device.Driver.Properties)
            {
                if (property.IsControl)
                {
                    var deviceCommandViewModel = new DeviceCommandViewModel(device, property);
                    DeviceCommands.Add(deviceCommandViewModel);
                }
            }
        }
 public DeviceCommandViewModel(Device device, DriverProperty driverProperty)
 {
     ExecuteCommand = new RelayCommand(OnExecute);
     Device = device;
     DriverProperty = driverProperty;
 }