コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FieldVisibilityRule"/> class.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="actionRule">The action rule.</param>
        /// <param name="fieldName">Name of the field.</param>
        /// <param name="sourceFields">The source fields.</param>
        public FieldVisibilityRule(IEditableRoot item, IActionRule actionRule, string fieldName, IEnumerable<string> sourceFields)
        {
            Item = item;
            Rule = actionRule;
            FieldName = fieldName;

            if (sourceFields != null)
            {
                _sourceFields = new HashSet<string>(sourceFields);
            }

            if (_sourceFields != null && _sourceFields.Count > 0)
            {
                if (Item != null)
                {
                    Item.PropertyChanged += OnItemPropertyChanged;
                }

                var notifyChildChanged = Item as INotifyChildChanged;

                if (notifyChildChanged != null)
                {
                    notifyChildChanged.ChildChanged += OnItemChildChanged;
                }
            }
        }
コード例 #2
0
 internal static void ReverseInnerRun(this IActionRule actionRule, ActionResult results, IEnumerable <IActionRule_Action> actions)
 {
     foreach (IActionRule_Action reverseActionMap in actions.OrderByDescending(a => a.Order))
     {
         var action = Action.All[reverseActionMap.ActionId];
         action.ReverseRun(results.GetLastReverseData());
     }
 }
コード例 #3
0
        internal static void InnerRun(this IActionRule actionRule, ActionResult results, IEnumerable <IActionRule_Action> actions)
        {
            foreach (IActionRule_Action actionMap in actions.OrderBy(a => a.Order))
            {
                // namapovaní InputVars
                var          remapedParams = actionMap.getInputVariables(results.OutputData);
                ActionResult result;

                if (actionMap.ActionId == -1 && actionMap.VirtualAction == "foreach")  // foreach
                {
                    result = Action.RunForeach(remapedParams, actionMap);
                }
                else   // Action
                {
                    result = Action.RunAction(actionMap.ActionId, remapedParams, actionMap);
                }

                // errory
                if (result.Type == MessageType.Error)
                {
                    //foreach (
                    //    IActionRule_Action reverseActionMap in
                    //        actions.Where(a => a.Order < actionMap.Order).OrderByDescending(a => a.Order))
                    //{
                    //    var action = Action.All[reverseActionMap.ActionId];
                    //    action.ReverseRun(results.ReverseInputData.Last());
                    //    results.ReverseInputData.Remove(results.ReverseInputData.Last());
                    //}

                    // do not continue
                    results.Join(result);
                    return;
                }

                // namapování OutputVars
                //!! pozor na přepisování promněných !!
                actionMap.RemapOutputVariables(result.OutputData);
                // zpracování výstupů
                results.Join(result);
            }
        }