Пример #1
0
        void BtnCreatePairClick(object sender, EventArgs e)
        {
            if (!CheckDll())
            {
                return;
            }

            string com1 = textBox1.Text;
            string com2 = textBox2.Text;

            if (com1.StartsWith("COM"))
            {
                if (VSPD.CreatePair(com1, com2))
                {
                    UpdatePortList();
                }
                else
                {
                    MessageBox.Show("创建失败");
                }
            }
            else
            {
                MessageBox.Show("端口必须命名为 COM# 的格式");
            }
        }
Пример #2
0
        void BtnDeletePairClick(object sender, EventArgs e)
        {
            if (!CheckDll())
            {
                return;
            }

            var comx = treeView1.SelectedNode;

            if (comx != null)
            {
                string comxt = comx.Text;
                if (comxt.StartsWith("COM"))
                {
                    if (VSPD.DeletePair(comxt))
                    {
                        UpdatePortList();
                    }
                    else
                    {
                        MessageBox.Show("删除失败");
                    }
                }
            }
        }
Пример #3
0
        void ButtonDeleteAllClick(object sender, EventArgs e)
        {
            if (!CheckDll())
            {
                return;
            }

            if (VSPD.DeleteAll())
            {
                UpdatePortList();
            }
            else
            {
                MessageBox.Show("删除失败");
            }
        }