private void Dialer_DialCompleted(object sender, DialCompletedEventArgs e) { this.VpnConnectionEvent += new VpnConnectionEventHandler(VpnLogin_Dialog.ConnectionEventChecking);//Vpn_Login에 보낼 것 델리게이트 if (e.Connected) { VpnConnectionChecking = true; VpnConnectionEvent(true);//(보내면 Vpn_Login 폼꺼짐) return; } /*else if (e.Cancelled) //연결실패하면 자동적으로 캔슬함 * { * //MessageBox.Show("Connection Attempt Cancel"); * } */ else if (e.TimedOut) { MessageBox.Show("Connection Attempt Time out"); } else if (e.Error != null) { MessageBox.Show("Vpn Connection Error"); MessageBox.Show(e.Error.ToString()); } VpnConnectionEvent(true); }
public bool VPN_Start() { VpnLogin_Dialog = new Vpn_Login(); VpnLogin_Dialog.VpnIDPWSendEvent += new VpnUserDataEventHandler(this.VpnLogin_Data); VpnLogin_Dialog.VpnClientExitEvent += new VpnClientExitEventHandler(this.VpnLogin_ClientExitCheck); this.VpnConnectionEvent += new VpnConnectionEventHandler(VpnLogin_Dialog.ConnectionEventChecking); bool result = false; #if PROGRAMMING return(VPN_First_Check()); #endif if (VPN_First_Check()) { if (Network_Position == true && VPN_Connection_IP == "127.0.0.1") //내부일때 { result = true; } else { if (VPN_RegCheck()) //l2tp 연결에 필요한 레지가 있는지 확인 { if (VPN_Create() == true) { if (VPN_Connection() == true) { result = true; } } } else { result = false; } } } return(result); }