Exemplo n.º 1
0
        private void pbEdit_Click(object sender, EventArgs e)
        {
            //修改指定连接
            getVpnName();
            ThreadStart starter = delegate { VPNTools.editConnection(currentVPN); };
            Thread      thread  = new Thread(starter);

            thread.IsBackground = true;
            thread.Start();
        }
Exemplo n.º 2
0
        private void pbDisConnect_Click(object sender, EventArgs e)
        {
            //断开连接
            checkConntect();
            getVpnName();
            //使用后台线程执行
            ThreadStart starter = delegate { VPNTools.disConnect(currentVPN); };
            Thread      thread  = new Thread(starter);

            thread.IsBackground = true;
            thread.Start();
            checkConntect();
        }
Exemplo n.º 3
0
 private void pbConnect_Click(object sender, EventArgs e)
 {
     //连接默认VPN
     getVpnName();
     checkConntect();
     if (currentVPN != null)
     {
         //使用后台线程执行
         ThreadStart starter = delegate { VPNTools.connect(currentVPN, user[0], user[1]); };
         Thread      thread  = new Thread(starter);
         thread.IsBackground = true;
         thread.Start();
     }
 }
Exemplo n.º 4
0
        private void checkConntect()
        {
            //检测VPN是否连接
            String result = VPNTools.checkCoonnect();

            if (result.Equals("false"))
            {
                pbLine.Image = Resources.disconnect_line;
            }

            else
            {
                pbLine.Image = Resources.connect_line;
                currentVPN   = result;
                foreach (Control control in gbVPN.Controls)
                {
                    if (((RadioButton)control).Text.Equals(currentVPN))
                    {
                        ((RadioButton)control).Checked = true;
                    }
                }
            }
        }