public void Refresh(ActionHolder actionHolder, IAlgorithmContext algoContext)
 {
     ActionHolder     = actionHolder;
     AlgorithmContext = algoContext;
     _pair            = (CheckerOperatorPair)ActionHolder.Action;
     operatorView.Refresh(actionHolder, algoContext);
     actionView.Refresh(new ActionHolder((IAction)_pair.Checker), algoContext);
 }
 public void Refresh(ActionHolder actionHolder, IAlgorithmContext algoContext)
 {
     ActionHolder     = actionHolder;
     AlgorithmContext = algoContext;
     _operatorPair    = (CheckerOperatorPair)actionHolder.Action;
     tbOperator1.Text
         = _operatorPair.Operator == LogicalOperator.And || _operatorPair.Operator == LogicalOperator.AndNot ? "И" : "ИЛИ";
     tbOperator2.Text
         = _operatorPair.Operator == LogicalOperator.AndNot || _operatorPair.Operator == LogicalOperator.OrNot ? "НЕ" : string.Empty;
 }
 public void AddFirst()
 {
     SelectCheckerTypeView.Show((isGroup) => {
         CheckerOperatorPair operatorPair = new CheckerOperatorPair();
         if (isGroup)
         {
             operatorPair.Checker = new ComplexCheckerAction();
         }
         _action.CheckerOperations.Insert(0, operatorPair);
         Insert(operatorPair, 0);
         Modified?.Invoke(this);
     });
 }
        private void Insert(CheckerOperatorPair operatorPair, int position = -1)
        {
            if (position == -1)
            {
                position = Children.Count;
            }
            FrameworkElement control = null;

            if (operatorPair.Checker is CheckerAction)
            {
                control = new CheckerOperatorPairView();
            }
            else if (operatorPair.Checker is ComplexCheckerAction)
            {
                control = new ComplexCheckerOperatorPairView();
            }
            var constructorElement = ((IConstructorElement)control);

            control.Margin = new Thickness(0, 1, 0, 0);
            constructorElement.Refresh(new ActionHolder(operatorPair), AlgorithmContext);
            constructorElement.Modified   += (element) => Modified?.Invoke(element);
            constructorElement.NeedRemove += (element) => {
                _action.CheckerOperations.Remove(operatorPair);
                Children.Remove(control);
                Modified?.Invoke(this);
                MakeFirstRowOperatorInvisible();
            };
            constructorElement.NeedAddNext += (element) => {
                SelectCheckerTypeView.Show((isGroup) => {
                    var index = Children.IndexOf(control) + 1;
                    CheckerOperatorPair newOperatorPair = new CheckerOperatorPair();
                    if (isGroup)
                    {
                        newOperatorPair.Checker = new ComplexCheckerAction();
                    }
                    _action.CheckerOperations.Insert(index, newOperatorPair);
                    Insert(newOperatorPair, index);
                    Modified?.Invoke(this);
                });
            };
            Children.Insert(position, control);
            MakeFirstRowOperatorInvisible();
        }