示例#1
0
 /// <summary>
 /// 添加指令
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void AddCmd_Click(object sender, RoutedEventArgs e)
 {
     if (actionCmdWindow != null)
     {
         actionCmdWindow.Close();
         actionCmdWindow = null;
     }
     actionCmdWindow = new AddActionCommand();
     if (actionCmdWindow.ShowDialog() == true)
     {
         Mlist.Add(actionCmdWindow.movdata);
         UpdateListbox();
     }
 }
示例#2
0
        /// <summary>
        /// 修改指令
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditCmd_Click(object sender, RoutedEventArgs e)
        {
            if (commandListBox.SelectedIndex < 0 || commandListBox.SelectedIndex >= Mlist.Count)
            {
                return;
            }

            if (actionCmdWindow != null)
            {
                actionCmdWindow.Close();
                actionCmdWindow = null;
            }
            actionCmdWindow = new AddActionCommand(Mlist[commandListBox.SelectedIndex]);
            if (actionCmdWindow.ShowDialog() == true)
            {
                Mlist[commandListBox.SelectedIndex] = actionCmdWindow.movdata;
                UpdateListbox();
            }
        }