Наследование: ICustomAction, IHasCheckerAction
Пример #1
0
 public IfView(IfAction ifAction)
 {
     if (ifAction == null)
         return;
     var context = new IfViewContext(ifAction);
     this.DataContext = context;
     InitializeComponent();
     var ifControl = new ComplexActionView(context.If) { RootControlsVisibility = Visibility.Collapsed };
     ifControl.Changed += (o, e) => RaiseChanged();
     this.gridIfHolder.Children.Add(ifControl);
     var elseControl = new ComplexActionView(context.Else) { RootControlsVisibility = Visibility.Collapsed };
     elseControl.Changed += (o, e) => RaiseChanged();
     this.gridElseHolder.Children.Add(elseControl);
     var checkerControl = new ComplexCheckerView(new OperatorCheckerPair() { Checker = context.Checker }) { RootControlsVisibility = Visibility.Collapsed };
     checkerControl.Changed += (o, e) => RaiseChanged();
     this.gridCheckerHolder.Children.Add(checkerControl);
     this.btRemove.Click += (o, e) =>
     {
         if (Utils.IsUserSureToDeleteCurrentOperator())
             if (Remove != null)
             {
                 Remove(this, new EventArgs());
                 RaiseChanged();
             }
     };
 }
Пример #2
0
 public void ProcessIfAction()
 {
     if (_ifAction == null)
         _ifAction = new IfAction();
     if (_ifAction.ActionIf == null)
         _ifAction.ActionIf = new ComplexAction();
     if (_ifAction.ActionElse == null)
         _ifAction.ActionElse = new ComplexAction();
     if (_ifAction.Checker == null)
         _ifAction.Checker = new ComplexChecker();
 }
Пример #3
0
 public IfViewContext(IfAction ifAction)
 {
     _ifAction = ifAction;
     ProcessIfAction();
 }
Пример #4
0
 private void AddIfControl(IfAction action)
 {
     var view = new IfView(action);
     view.Remove += (o, e) =>
     {
         ((ComplexActionViewContext)this.DataContext).RemoveAction(action);
         this.spActions.Children.Remove(view);
     };
     view.Changed += (o, e) => RaiseChanged();
     spActions.Children.Add(view);
     RaiseChanged();
 }