Esempio n. 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     Model.ConfigNameSpace cns = GetModel();
     if (cns != null)
     {
         if (config_nameSpace.Add(cns))
         {
             MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             ShowList();
         }
         else
         {
             MessageBox.Show("添加失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Esempio n. 2
0
        private Model.ConfigNameSpace GetModel()
        {
            string n1 = this.textBox_n1.Text;
            string n2 = this.textBox_n2.Text;

            if (n1.IsNullOrEmpty())
            {
                MessageBox.Show("命名空间不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(null);
            }

            Model.ConfigNameSpace cns = new Model.ConfigNameSpace();
            cns.Name1 = n1.Trim();
            cns.Name2 = n2.Trim();
            return(cns);
        }
Esempio n. 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            var items = listView1.SelectedItems;

            if (items.Count == 0)
            {
                return;
            }
            var item = items[0];

            Model.ConfigNameSpace cns = GetModel();
            if (cns != null)
            {
                if (config_nameSpace.Save(cns, item.SubItems[0].Text))
                {
                    MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ShowList();
                }
                else
                {
                    MessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
        private Model.ConfigNameSpace GetModel()
        {
            string n1 = this.textBox_n1.Text;
            string n2 = this.textBox_n2.Text;

            if (n1.IsNullOrEmpty())
            {
                MessageBox.Show("命名空间不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return null;
            }

            Model.ConfigNameSpace cns = new Model.ConfigNameSpace();
            cns.Name1 = n1.Trim();
            cns.Name2 = n2.Trim();
            return cns;
        }