Пример #1
0
        public void AddAction(ActionViewList element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element", "Element can not be null");
            }

            GenerateActionSequence(element, element.SideAction);
            this.actions.Add(element);
        }
Пример #2
0
        private void GenerateActionSequence(ActionViewList element, SideAction side)
        {
            if (element.Action != null && element.Action.Sequence == 0)
            {
                int maxSequence = 0;
                actions.ForEach(action =>
                {
                    if (action.SideAction == side)
                    {
                        if (action.Action.Sequence > maxSequence)
                        {
                            maxSequence = action.Action.Sequence;
                        }
                    }
                });

                if (element.Action != null)
                {
                    element.Action.Sequence = maxSequence + 1;
                }
            }
        }