public LogicViewModel(GKBase gkBase, GKLogic logic, bool hasOffClause = false, bool hasOnNowClause = false, bool hasOffNowClause = false, bool hasStopClause = false, bool hasOnClause = true, bool hasOn2Clause = false, bool isIC = false) { if (gkBase != null) Title = "Настройка логики " + gkBase.PresentationName; else Title = "Настройка логики"; if (logic.OnClausesGroup.Clauses.Count == 0 && logic.OnClausesGroup.ClauseGroups.Count == 0 && hasOnClause) { logic.OnClausesGroup.Clauses.Add(new GKClause()); } OnClausesGroup = new ClauseGroupViewModel(gkBase, logic.OnClausesGroup); On2ClausesGroup = new ClauseGroupViewModel(gkBase, logic.On2ClausesGroup); OffClausesGroup = new ClauseGroupViewModel(gkBase, logic.OffClausesGroup); OnNowClausesGroup = new ClauseGroupViewModel(gkBase, logic.OnNowClausesGroup); OffNowClausesGroup = new ClauseGroupViewModel(gkBase, logic.OffNowClausesGroup); StopClausesGroup = new ClauseGroupViewModel(gkBase, logic.StopClausesGroup); RedIndicatorLogic = new ICIndicatorLogicViewModel(gkBase, logic.RedIndicatorLogic); GreenIndicatorLogic = new ICIndicatorLogicViewModel(gkBase, logic.GreenIndicatorLogic); YellowIndicatorLogic = new ICIndicatorLogicViewModel(gkBase, logic.YellowIndicatorLogic); UseOffCounterLogic = logic.UseOffCounterLogic; HasOnClause = hasOnClause; HasOffClause = hasOffClause; HasOnNowClause = hasOnNowClause; HasOffNowClause = hasOffNowClause; HasStopClause = hasStopClause; HasOn2Clause = hasOn2Clause; IsIC = isIC; }
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; }
public ICIndicatorLogicViewModel(GKBase gkBase, ICIndicatorLogic icIndicatorLogic) { Blink1ClausesGroup = new ClauseGroupViewModel(gkBase, icIndicatorLogic.Blink1ClausesGroup); Blink3ClausesGroup = new ClauseGroupViewModel(gkBase, icIndicatorLogic.Blink3ClausesGroup); OffClausesGroup = new ClauseGroupViewModel(gkBase, icIndicatorLogic.OffClausesGroup); UseOffCounterLogic = icIndicatorLogic.UseOffCounterLogic; }
void OnRemoveGroup(ClauseGroupViewModel clauseGroupViewModel) { ClauseGroups.Remove(clauseGroupViewModel); }
void OnAddGroup() { var clauseGroupViewModel = new ClauseGroupViewModel(GKBase, new GKClauseGroup()); clauseGroupViewModel.Parent = this; ClauseGroups.Add(clauseGroupViewModel); }