コード例 #1
0
ファイル: StateLogicViewModel.cs プロジェクト: hjlfmy/Rubezh
        public StateLogicViewModel(DeviceLogicViewModel deviceDetailsViewModel, StateLogic stateLogic)
        {
            AddCommand = new RelayCommand(OnAdd);
            RemoveCommand = new RelayCommand<ClauseViewModel>(OnRemove);
            ChangeJoinOperatorCommand = new RelayCommand(OnChangeJoinOperator);

            StateTypes = new List<XStateType>();
            StateTypes.Add(XStateType.TurnOn);
            StateTypes.Add(XStateType.CancelDelay);
            StateTypes.Add(XStateType.TurnOff);
            StateTypes.Add(XStateType.Stop);
            StateTypes.Add(XStateType.ForbidStart);
            StateTypes.Add(XStateType.TurnOnNow);
            StateTypes.Add(XStateType.TurnOffNow);

            SelectedStateType = stateLogic.StateType;

            _deviceDetailsViewModel = deviceDetailsViewModel;
            Clauses = new ObservableCollection<ClauseViewModel>();
            foreach (var clause in stateLogic.Clauses)
            {
                var clauseViewModel = new ClauseViewModel(this, clause);
                Clauses.Add(clauseViewModel);
            }
        }
コード例 #2
0
ファイル: LogicViewModel.cs プロジェクト: saeednazari/Rubezh
		void OnAdd()
		{
			var clause = new XClause();
			var clauseViewModel = new ClauseViewModel(clause, Device);
			Clauses.Add(clauseViewModel);
			UpdateJoinOperatorVisibility();
		}
コード例 #3
0
		public ClauseGroupViewModel(GKBase gkBase, GKClauseGroup clauseGroup)
		{
			AddCommand = new RelayCommand(OnAdd);
			AddGroupCommand = new RelayCommand(OnAddGroup);
			RemoveCommand = new RelayCommand<ClauseViewModel>(OnRemove);
			RemoveGroupCommand2 = new RelayCommand(OnRemoveGroup2, CanRemoveGroup2);
			RemoveGroupCommand = new RelayCommand<ClauseGroupViewModel>(OnRemoveGroup);
			ChangeJoinOperatorCommand = new RelayCommand(OnChangeJoinOperator);

			GKBase = gkBase;
			Clauses = new ObservableCollection<ClauseViewModel>();
			foreach (var clause in clauseGroup.Clauses)
			{
				var clauseViewModel = new ClauseViewModel(gkBase, clause);
				Clauses.Add(clauseViewModel);
			}

			ClauseGroups = new ObservableCollection<ClauseGroupViewModel>();
			foreach (var clause in clauseGroup.ClauseGroups)
			{
				var clauseGroupViewModel = new ClauseGroupViewModel(gkBase, clause);
				clauseGroupViewModel.Parent = this;
				ClauseGroups.Add(clauseGroupViewModel);
			}

			JoinOperator = clauseGroup.ClauseJounOperationType;
		}
コード例 #4
0
ファイル: LogicViewModel.cs プロジェクト: saeednazari/Rubezh
		public LogicViewModel(XDevice device, List<XClause> clauses)
		{
			Device = device;
			AddCommand = new RelayCommand(OnAdd);
			RemoveCommand = new RelayCommand<ClauseViewModel>(OnRemove);
			ChangeJoinOperatorCommand = new RelayCommand(OnChangeJoinOperator);

			Clauses = new ObservableCollection<ClauseViewModel>();
			if (clauses != null)
			{
				foreach (var clause in clauses)
				{
					var clauseViewModel = new ClauseViewModel(clause, device);
					Clauses.Add(clauseViewModel);
					JoinOperator = clause.ClauseJounOperationType;
				}
			}
			UpdateJoinOperatorVisibility();
		}
コード例 #5
0
ファイル: LogicViewModel.cs プロジェクト: saeednazari/Rubezh
		void OnRemove(ClauseViewModel clauseViewModel)
		{
			Clauses.Remove(clauseViewModel);
			UpdateJoinOperatorVisibility();
		}
コード例 #6
0
		void OnRemove(ClauseViewModel clauseViewModel)
		{
			Clauses.Remove(clauseViewModel);
		}
コード例 #7
0
		void OnAdd()
		{
			var clauseViewModel = new ClauseViewModel(GKBase, new GKClause());
			Clauses.Add(clauseViewModel);
		}