예제 #1
0
        public DeviceLogicViewModel(XDevice device)
        {
            Title = "Настройка логики устройства";
            AddCommand = new RelayCommand(OnAdd);
            RemoveCommand = new RelayCommand<StateLogicViewModel>(OnRemove);

            Device = device;
            if (device.DeviceLogic.StateLogics.Count == 0)
            {
                var stateLogic = new StateLogic();
                var clause = new XClause();
                stateLogic.Clauses.Add(clause);
                device.DeviceLogic.StateLogics.Add(stateLogic);
            }

            StateLogics = new ObservableCollection<StateLogicViewModel>();
            foreach (var stateLogic in device.DeviceLogic.StateLogics)
            {
                var stateLogicViewModel = new StateLogicViewModel(this, stateLogic);
                StateLogics.Add(stateLogicViewModel);
            }
        }
예제 #2
0
        public ClauseViewModel(StateLogicViewModel stateLogicViewModel, XClause clause)
        {
            SelectZonesCommand = new RelayCommand(OnSelectZones);
            SelectDevicesCommand = new RelayCommand(OnSelectDevices);

            _stateLogicViewModel = stateLogicViewModel;
            SelectedStateType = clause.StateType;
            SelectedClauseJounOperationType = clause.ClauseJounOperationType;
            SelectedClauseOperationType = clause.ClauseOperationType;
            Zones = clause.Zones.ToList();
            Devices = clause.Devices.ToList();

            ClauseJounOperationTypes = Enum.GetValues(typeof(ClauseJounOperationType)).Cast<ClauseJounOperationType>().ToList();
            ClauseOperationTypes = Enum.GetValues(typeof(ClauseOperationType)).Cast<ClauseOperationType>().ToList();

            StateTypes = new List<XStateType>();
            StateTypes.Add(XStateType.Attention);
            StateTypes.Add(XStateType.Fire1);
            StateTypes.Add(XStateType.Fire2);
            StateTypes.Add(XStateType.Test);
            StateTypes.Add(XStateType.Failure);

            SelectedStateType = clause.StateType;
        }
예제 #3
0
 void OnRemove(StateLogicViewModel stateLogicViewModel)
 {
     StateLogics.Remove(stateLogicViewModel);
 }
예제 #4
0
 void OnAdd()
 {
     var stateLogic = new StateLogic();
     var stateLogicViewModel = new StateLogicViewModel(this, stateLogic);
     StateLogics.Add(stateLogicViewModel);
 }