예제 #1
0
        private AdminCmd GetCmd()
        {
            // 执行
            TreeNode node = adminTreeView.SelectedNode;

            if (node == null)
            {
                return(null);
            }
            AdminCmd cmd = (AdminCmd)node.Tag;

            if (cmd == null)
            {
                WriteLog("请先选中一条指令");
                return(null);
            }

            // 回填数据
            for (int i = 0; i < argsPanel.Controls.Count; ++i)
            {
                ArgBox box = (ArgBox)argsPanel.Controls[i];
                if (!box.Visible)
                {
                    break;
                }
                AdminArg arg = (AdminArg)box.Tag;
                arg.Data = box.ArgData;
                if (arg.AddItem(arg.Data))
                {
                    m_mgr.MarkDirty();
                }
            }

            return(cmd);
        }
예제 #2
0
        private void adminTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode node = adminTreeView.SelectedNode;

            statusLabel.Text = "Group:" + node.Text;
            argsPanel.SuspendLayout();
            foreach (Control control in argsPanel.Controls)
            {
                control.Visible = false;
            }

            if (node.Tag != null)
            {
                AdminCmd cmd = (AdminCmd)node.Tag;
                statusLabel.Text = cmd.Desc;
                // 先创建足够多
                if (argsPanel.Controls.Count < cmd.Args.Count)
                {
                    int count = cmd.Args.Count - argsPanel.Controls.Count;
                    for (int i = 0; i < count; ++i)
                    {
                        ArgBox box = new ArgBox();
                        box.Visible = false;
                        argsPanel.Controls.Add(box);
                    }
                }
                // 初始化arg
                int box_index = 0;
                for (int i = 0; i < cmd.Args.Count; ++i)
                {
                    AdminArg arg = cmd.Args[i];
                    if (!arg.CanEdit)
                    {
                        continue;
                    }
                    ArgBox box = argsPanel.Controls[box_index++] as ArgBox;
                    box.Visible = true;
                    box.Init(arg);
                }
            }
            argsPanel.ResumeLayout();
            //argsPanel.Controls.Clear();
        }
예제 #3
0
        private void adminTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode node = adminTreeView.SelectedNode;
            statusLabel.Text = "Group:"+ node.Text;
            argsPanel.SuspendLayout();
            foreach(Control control in argsPanel.Controls)
            {
                control.Visible = false;
            }

            if(node.Tag != null)
            {
                AdminCmd cmd = (AdminCmd)node.Tag;
                statusLabel.Text = cmd.Desc;
                // 先创建足够多
                if(argsPanel.Controls.Count < cmd.Args.Count)
                {
                    int count = cmd.Args.Count - argsPanel.Controls.Count;
                    for(int i = 0; i < count; ++i)
                    {
                        ArgBox box = new ArgBox();
                        box.Visible = false;
                        argsPanel.Controls.Add(box);
                    }
                }
                // 初始化arg
                int box_index = 0;
                for (int i = 0; i < cmd.Args.Count; ++i)
                {
                    AdminArg arg = cmd.Args[i];
                    if (!arg.CanEdit)
                        continue;
                    ArgBox box = argsPanel.Controls[box_index++] as ArgBox;
                    box.Visible = true;
                    box.Init(arg);
                }
            }
            argsPanel.ResumeLayout();
            //argsPanel.Controls.Clear();
        }