Beispiel #1
0
        private void addBtn_Click(object sender, RoutedEventArgs e)
        {
            Regex regex = new Regex(@"\D");

            if (addPort.Text != "")
            {
                if (!regex.IsMatch(addPort.Text))
                {
                    int newport = int.Parse(addPort.Text);
                    if (StaticValue.checkPort(newport) > 0)
                    {
                        MessageBox.Show("对不起,该端口号已经存在,请重新输入");
                    }
                    else
                    {
                        StaticValue.AddPort(newport);
                        EditPort_load();
                    }
                }
                else
                {
                    MessageBox.Show("请输入正确的数字");
                }
            }
            else
            {
                MessageBox.Show("请输入正确的端口号,然后再添加");
            }
        }
Beispiel #2
0
 private void delBtn_Click(object sender, RoutedEventArgs e)
 {
     if (relList.SelectedIndex > 0)
     {
         int port = int.Parse(relList.SelectedValue.ToString());
         StaticValue.DelPort(port);
         EditPort_load();
     }
     else
     {
         MessageBox.Show("请选中要删除的内容之后在点击删除");
     }
 }