Beispiel #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (_moduleList.Count > 0)
     {
         string messAge = "是否确定删除模版:" + _moduleList[checkedNum].Module + "的\""
                          + _moduleList[checkedNum].Function + "\"功能命令列表";
         string            caption = "警告!!!!";
         MessageBoxButtons buttons = MessageBoxButtons.YesNo;
         DialogResult      result  = MessageBox.Show(messAge, caption, buttons);
         if (result == DialogResult.Yes)
         {
             XMLUnit xmlUnit = new XMLUnit();
             xmlUnit.DelModuleList(_moduleList[checkedNum]);
             _moduleList.RemoveAt(checkedNum);
             checkedNum = 0;
             if (_moduleList.Count > 0)
             {
                 AddModuleRB(_moduleList, checkedNum);
             }
             else
             {
                 panel1.Controls.Clear();
                 panel2.Controls.Clear();
             }
         }
         else
         {
             return;
         }
     }
 }
Beispiel #2
0
        public Form3(bool writeorread)
        {
            InitializeComponent();
            this.FormClosed += Form3_FormClosed;
            XMLUnit xmlUnit = new XMLUnit();

            _moduleList = xmlUnit.QueryModuleList();


            if (writeorread)
            {
                button1.Text   = "保存";
                button1.Click += ButtonWrite_Click;
                button3.Click += btnAddMoudle;
                //读取列表
            }
            else
            {
                this.Text       = "读取";
                button1.Text    = "读取";
                button1.Click  += ButtonRead_Click;
                button3.Visible = false;
                button4.Visible = false;
                panel1.Size     = new Size(panel1.Size.Width, 260);
                panel2.Size     = new Size(panel2.Size.Width, 260);
                //读取列表
            }
            AddModuleRB(_moduleList, 0);
        }
Beispiel #3
0
        private void ButtonRead_Click(object sender, EventArgs e)
        {
            ModuleCommand module  = new ModuleCommand(moduleCheckedText, functionCheckedText);
            XMLUnit       xmlUnit = new XMLUnit();

            atCommands = xmlUnit.XMLUnitRead(module);
            this.Close();
        }
Beispiel #4
0
        private void Form3_FormClosed(object sender, FormClosedEventArgs e)
        {
            XMLUnit          xmlunit = new XMLUnit();
            List <ATCommand> acs     = xmlunit.XMLUnitRead();

            if (acs.Count <= 0)
            {
                xmlunit.XMLUnitWrite(new ModuleCommand(), acs);
            }
        }
Beispiel #5
0
        private void Rb_MouseClick(object sender, MouseEventArgs e)
        {
            if (startTime == 0)
            {
                startTime = (long)DateTime.UtcNow.Ticks / 10000;
            }
            else
            {
                long endTime = (long)DateTime.UtcNow.Ticks / 10000;
                if (endTime - startTime < 500)
                {
                    RadioButton rb = sender as RadioButton;
                    //处理双击事件
                    Form2 form  = new Form2((sender as RadioButton).Text);
                    Label label = form.Controls.Find("label1", true)[0] as Label;
                    //label.Text = _moduleList[checkedNum].Module;
                    ModuleCommand oldM = _moduleList[checkedNum];
                    ModuleCommand newM = new ModuleCommand();
                    form.StartPosition = FormStartPosition.CenterParent;
                    TextBox tBoxNote  = form.Controls.Find("textBox1", true)[0] as TextBox;
                    Button  btnSave   = form.Controls.Find("button1", true)[0] as Button;
                    Button  btnCancel = form.Controls.Find("button2", true)[0] as Button;
                    tBoxNote.TextChanged += TBoxNote_TextChanged;

                    btnSave.DialogResult   = DialogResult.Yes;
                    btnCancel.DialogResult = DialogResult.No;
                    DialogResult result = form.ShowDialog();
                    if (result == DialogResult.Yes)
                    {
                        if (rb.Name.StartsWith("rbf"))
                        {
                            newM = new ModuleCommand(oldM.Module, newFunction == null?oldM.Function:newFunction);
                            foreach (ModuleCommand mb in _moduleList)
                            {
                                if (mb.Function.ToUpper() == newM.Function.ToUpper() && mb.Module.ToUpper() == newM.Module.ToUpper())
                                {
                                    DialogResult RESULT = MessageBox.Show("模块" + mb.Module + "下的功能" + mb.Function + "已存在.", "警告!!!", MessageBoxButtons.OK);
                                    return;
                                }
                            }
                            XMLUnit xml = new XMLUnit();
                            xml.ChangeModultList(oldM, newM);
                            _moduleList = xml.QueryModuleList();
                            AddModuleRB(_moduleList, checkedNum);
                        }
                    }
                    else
                    {
                        Console.WriteLine("不保存列表");
                    }
                }
                startTime = 0;
            }
        }
Beispiel #6
0
        private void ButtonWrite_Click(object sender, EventArgs e)
        {
            //string messAge = "是否确定将内容保存到:" + _moduleList[checkedNum].Module + "的\""
            //        + _moduleList[checkedNum].Function + "\"功能命令列表";
            //string caption = "警告!!!!";
            //MessageBoxButtons buttons = MessageBoxButtons.YesNo;
            //DialogResult result = MessageBox.Show(messAge, caption, buttons);
            //if (result == DialogResult.Yes)
            //{
            XMLUnit xmlUnit = new XMLUnit();

            if (_moduleList.Count > 0 && _moduleList[checkedNum].Function != "")
            {
                xmlUnit.XMLUnitWrite(_moduleList[checkedNum], atCommands);
                this.Close();
            }
            savedNum = checkedNum;
            //}
        }
Beispiel #7
0
        public Form3(List <ATCommand> CommandList)
        {
            atCommands = CommandList;
            XMLUnit xmlUnit = new XMLUnit();

            _moduleList = xmlUnit.QueryModuleList();
            for (int i = 0; i < _moduleList.Count; i++)
            {
                if (_moduleList[i].Function == atCommands[0].Function && _moduleList[i].Module == atCommands[0].Module)
                {
                    checkedNum = i;
                    break;
                }
            }
            InitializeComponent();
            this.FormClosed += Form3_FormClosed;
            button1.Text     = "保存";
            button1.Click   += ButtonWrite_Click;
            button3.Click   += btnAddMoudle;
            button4.Click   += btnAddMoudle;
            AddModuleRB(_moduleList, checkedNum);
            this.Text = "保存";
        }