Esempio n. 1
0
        public IOInfo addItem(string name)
        {
            TreeNode Node = new TreeNode();
            IOInfo   info = new IOInfo(name);

            Node.Tag  = info;
            Node.Text = info.ToString();
            TextView.Nodes.Add(Node);
            return(info);
        }
Esempio n. 2
0
 public ConfigIO()
 {
     InitializeComponent();
     act = (int id, bool flag) =>
     {
         if (flag)
         {
             foreach (TreeNode Node in TextView.Nodes)
             {
                 if (Node.Tag is IOInfo)
                 {
                     if (((IOInfo)Node.Tag).id == id)
                     {
                         MessageBox.Show("该端口已被使用!");
                         return;
                     }
                 }
             }
             if (SelectNode != null)
             {
                 IOInfo info = ((IOInfo)SelectNode.Tag);
                 if (info.id != -1)
                 {
                     ib.setSelectStats(info.id, false);
                     ib.setSelectStats(id, true);
                     info.id = id;
                 }
                 else
                 {
                     info.id = id;
                 }
                 SelectNode.Text = info.ToString(ib[info.id]);
             }
         }
         else
         {
             if (SelectNode != null)
             {
                 ((IOInfo)SelectNode.Tag).id = -1;
                 SelectNode.Text             = ((IOInfo)SelectNode.Tag).ToString();
             }
         }
     };
 }