Beispiel #1
0
        private void DevDefAddEditBtn_Click(object sender, EventArgs e)
        {
            Devdef devdef = new Devdef
            {
                ID         = devIdTB.Text,
                Name       = devNameTB.Text,
                ConnetType = devNetCB.SelectedIndex + ""
            };

            if (devDefAddEditBtn.Text.Equals("添加"))
            {
                XMLMaster.AddDevdef(devdef);
            }
            else
            {
                XMLMaster.EditeDevdef(devdef);
            }

            ListViewRefresh();
        }
Beispiel #2
0
        /// <summary>
        /// 属性字典值添加/修改按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AttDicAddEditBtn_Click(object sender, EventArgs e)
        {
            AttDic attDic = new AttDic
            {
                Key   = AttDicKeyTB.Text,
                Value = AttDicVaueTB.Text
            };

            if (AttDicAddEditBtn.Text.Equals("添加"))
            {
                XMLMaster.AddAttDic(devdef.ID, devAtt.ID, attDic);
            }
            else
            {
                XMLMaster.EditeAttDic(devdef.ID, devAtt.ID, attDic);
            }
            devdef = XMLMaster.Devdefs.FindDevdef(devDefCB.SelectedItem + "");
            devAtt = devdef.GetDevAttById(DevAttListView.FocusedItem.Text);
            AttDicListViewRefresh();
        }
Beispiel #3
0
 private void DevListView_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (devListView.FocusedItem != null)
     {
         Devdef devdef = XMLMaster.Devdefs.FindDevdef(devListView.FocusedItem.Text);
         if (devdef != null)
         {
             devIdTB.Enabled        = false;
             devIdTB.Text           = devdef.ID;
             devNameTB.Text         = devdef.Name;
             devNetCB.SelectedIndex = int.Parse(devdef.ConnetType);
             devDefAddEditBtn.Text  = "修改";
         }
         if (lastFocuse != null)
         {
             lastFocuse.BackColor = System.Drawing.Color.White;
         }
         devListView.FocusedItem.BackColor = System.Drawing.Color.Gray;
         lastFocuse = devListView.FocusedItem;
     }
 }