Пример #1
0
        private void CmdViewN_AddBefore_Click(object sender, RoutedEventArgs e)
        {
            if (CmdList.SelectedIndex <= 0)
                return;

            AskNewCmdInfo NewCmdWindow = new AskNewCmdInfo();
            NewCmdWindow.ShowDialog();
            EnumCmd NewCommand = Command.GetCmdFromString(NewCmdWindow.NewCmd);
            int NewCommandID = NewCmdWindow.NewCmdID;

            if (_CurrentStrategy != null)
            {
                int CurrentIndex = CmdList.SelectedIndex;
                _CurrentStrategy.InsertNewCmd_Before(CurrentIndex, NewCommand, NewCommandID);
                String CmdListInfo = _CurrentStrategy.GetActionID(CurrentIndex) + " : " + _CurrentStrategy.GetCommand(CurrentIndex).Cmd.ToString();
                CmdList.Items.Insert(CurrentIndex, CmdListInfo);
                CmdList.SelectedIndex = CurrentIndex;
            }
        }
Пример #2
0
        private void CmdViewN_AddAfter_Click(object sender, RoutedEventArgs e)
        {
            if (CmdList.SelectedIndex < 0)
                return;

            AskNewCmdInfo NewCmdWindow = new AskNewCmdInfo();
            NewCmdWindow.ShowDialog();
            EnumCmd NewCommand = Command.GetCmdFromString(NewCmdWindow.NewCmd);
            int NewCommandID = NewCmdWindow.NewCmdID;

            if (_CurrentStrategy != null)
            {
                _CurrentStrategy.InsertNewCmd_After(CmdList.SelectedIndex, NewCommand, NewCommandID);
                String CmdListInfo = _CurrentStrategy.GetActionID(CmdList.SelectedIndex + 1) + " : " + _CurrentStrategy.GetCommand(CmdList.SelectedIndex + 1).Cmd.ToString();
                CmdList.Items.Insert(CmdList.SelectedIndex + 1, CmdListInfo);
            }

            // Update the previous NextActionID item
            _CurrentStrategy.UpdateNextActionID(CmdList.SelectedIndex, _CurrentStrategy.GetActionID(CmdList.SelectedIndex + 1).ToString());

            CmdViewN_ButtonNext.RaiseEvent(e);
        }