Exemple #1
0
 public ViewModel()
 {
     this.Condition1 = new Condition(this.ToObservable(x => x.IsDoorClosed), () => this.IsDoorClosed)
     {
         Name = "Door open"
     };
     this.Condition2 = new Condition(this.ToObservable(x => x.IsMotorRunning), () => this.IsMotorRunning)
     {
         Name = "Motor running"
     };
     DependingCondition = new AndCondition(Condition1, Condition2)
     {
         Name = "Can start"
     };
     NegatedCondition1 = Condition1.Negate();
     _conditions       = new List <ICondition> {
         Condition1, Condition2, DependingCondition, NegatedCondition1
     };
     StartCommand = new ConditionRelayCommand(o => MessageBox.Show("Clicked " + o), DependingCondition);
     OtherCommand = new ConditionRelayCommand(o => MessageBox.Show("Clicked " + o), Condition1);
 }