private void AddActionTowers(List <TowerPredefinedMessageDTO> towersAction)
 {
     Application.Current.Dispatcher.Invoke(() =>
     {
         towersAction.ForEach(x => ActionsList.Add(x));
     });
 }
Exemple #2
0
    /// <summary>
    /// Adds action.
    /// </summary>
    /// <param name="action">Action</param>
    public override void AddAction(HeaderAction action)
    {
        if (action == null)
        {
            return;
        }

        // Make sure the Save action is set only once
        string key     = string.Format("HeaderActionsSaveSet_{0}_{1}", action.CommandArgument, ClientID);
        bool   saveSet = ValidationHelper.GetBoolean(RequestStockHelper.GetItem(key), false);

        if (!(action is SaveAction) || !saveSet)
        {
            bool added = false;

            // Ensure correct index
            if (action.Index == -1)
            {
                action.Index = ActionsList.Count;
            }
            else
            {
                // Post processing of action attribute
                for (int i = 0; i < ActionsList.Count; i++)
                {
                    if (ActionsList[i].Index == action.Index)
                    {
                        // Replace action with the same index
                        ActionsList[i] = action;

                        // Button added
                        added = true;
                        break;
                    }
                }
            }

            // If action with the same index was not found, add it to the list
            if (!added)
            {
                ActionsList.Add(action);
            }

            // Keep flag
            if (action is SaveAction)
            {
                RequestStockHelper.Add(key, (action.BaseButton == null) || action.BaseButton.Visible);
            }
        }

        // Store base buttons
        if ((action.BaseButton != null) && !ProcessedBaseButtons.Contains(action.BaseButton))
        {
            ProcessedBaseButtons.Add(action.BaseButton);
        }
    }
        /// <summary>
        ///     Adds list of actions for Redo and Undo operations. Do not reverse before passing.
        /// </summary>
        public void AddActionsList(List <Action> redoActions, List <Action> undoActions)
        {
            void RedoActions()
            {
                foreach (var action in redoActions)
                {
                    action();
                }
            }

            undoActions.Reverse();

            void UndoActions()
            {
                foreach (var action in undoActions)
                {
                    action();
                }
            }

            ActionsList.Add(new ActionsPair(UndoActions, RedoActions));
            ActionsListIndex = ActionsList.Count - 1;
        }
Exemple #4
0
 public TestModule() : base("Test Module")
 {
     ActionsList.Add(new TestAction1());
     ActionCount = ActionsList.Count;
 }
 public void AddAction(Action action, Action reversed)
 {
     ActionsList.Add(new ActionsPair(action, reversed));
     ActionsListIndex = ActionsList.Count - 1;
 }