예제 #1
0
파일: frmMain.cs 프로젝트: hadky/ConciseVPN
        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();
        }
예제 #2
0
파일: frmMain.cs 프로젝트: hadky/ConciseVPN
        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();
        }
예제 #3
0
파일: frmMain.cs 프로젝트: hadky/ConciseVPN
 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();
     }
 }
예제 #4
0
파일: frmMain.cs 프로젝트: hadky/ConciseVPN
        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;
                    }
                }
            }
        }