Ejemplo n.º 1
0
        private void tmrMonitorConnected_Elapsed(object sender, ElapsedEventArgs e)
        {
            this.tmrMonitorConnected.Stop();
            RAS_Variable.clsTXT_VPN fnVpn = RAS_Variable.FN_VPN;
            string sText = "Connected - failed! Retrip.";

            fnVpn.TXT(ref sText);
            this.Connect();
        }
Ejemplo n.º 2
0
        private void tmrMonitorDisconnect_Elapsed(object sender, ElapsedEventArgs e)
        {
            this.tmrMonitorDisconnect.Stop();
            if (this.MonitorDisconnect != RasDialUC.myMonitorDisconnect.StartDisconnect)
            {
                return;
            }
            RAS_Variable.clsTXT_VPN fnVpn = RAS_Variable.FN_VPN;
            string sText = "Disconnect - failed! Retrip.";

            fnVpn.TXT(ref sText);
            this.Close();
        }
Ejemplo n.º 3
0
        public void Connect()
        {
            if (Operators.ConditionalCompareObjectEqual(NewLateBinding.LateGet(this.GlobalOBJ, (Type)null, "InvokeRequired", new object[0], (string[])null, (Type[])null, (bool[])null), (object)true, false))
            {
                NewLateBinding.LateCall(this.GlobalOBJ, (Type)null, "BeginInvoke", new object[2]
                {
                    (object)new RasDialUC.d_Connect(this.Connect),
                    (object)new object[0]
                }, (string[])null, (Type[])null, (bool[])null, true);
            }
            else if (this.GetStatus() == 8192)
            {
                RAS_Variable.clsTXT_VPN fnVpn = RAS_Variable.FN_VPN;
                string sText = "You are already connected.";
                fnVpn.TXT(ref sText);
            }
            else
            {
                if (!Information.IsNothing((object)this.tmrMonitorConnected))
                {
                    this.tmrMonitorConnected.Stop();
                    this.tmrMonitorConnected.Elapsed -= new ElapsedEventHandler(this.tmrMonitorConnected_Elapsed);
                    this.tmrMonitorConnected          = (Timer)null;
                }
                if (MyProject.Forms.frmMain_RasDialex.AutoConnectRasDial)
                {
                    this.tmrMonitorConnected           = new Timer();
                    this.tmrMonitorConnected.AutoReset = false;
                    this.tmrMonitorConnected.Elapsed  += new ElapsedEventHandler(this.tmrMonitorConnected_Elapsed);
                    this.tmrMonitorConnected.Interval  = (double)this.WaitConnected;
                    this.tmrMonitorConnected.Start();
                }
                switch (this.VPN_Reboot_Method)
                {
                case 0:
                    if (!this.OptionsOK)
                    {
                        this.ErrorSend(100040);
                        break;
                    }
                    IntPtr lprasDialExtensions;
                    IntPtr lphRasConn;
                    int    num = RasDialUC.RasDial(lprasDialExtensions, (string)null, ref this.MainOptions, 1U, (Delegate)this.del, ref lphRasConn);
                    if (num != 0)
                    {
                        this.ErrorSend(checked (num + 50000));
                        break;
                    }
                    this.MainHeader = lphRasConn;
                    break;

                case 1:
                    try
                    {
                        MyProject.Forms.frmMain_RasDialex.lblMon.Text = "Hard Connect";
                        string  str1    = Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\rasdial.exe";
                        Process process = new Process();
                        process.StartInfo.FileName = str1;
                        string str2 = Strings.Trim(MyProject.Forms.frmMain_RasDialex.txtEntryName.Text) + " " + Strings.Trim(MyProject.Forms.frmMain_RasDialex.txtUserName.Text) + " " + Strings.Trim(MyProject.Forms.frmMain_RasDialex.txtPassword.Text) + " /PHONE:" + Strings.Trim(MyProject.Forms.frmMain_RasDialex.txtPhoneNumber.Text);
                        process.StartInfo.Arguments   = str2;
                        process.StartInfo.WindowStyle = !MyProject.Forms.frmMain_RasDialex.VisibleCMD ? ProcessWindowStyle.Hidden : ProcessWindowStyle.Normal;
                        process.Start();
                        _FUNCTION.clsTXT fn    = _FUNCTION.FN;
                        string           sText = str1 + " " + str2;
                        fn.TXT(ref sText);
                        break;
                    }
                    catch (Exception ex)
                    {
                        ProjectData.SetProjectError(ex);
                        Exception        exception = ex;
                        _FUNCTION.clsTXT fn        = _FUNCTION.FN;
                        string           sText     = "RasDialEx Error: " + exception.Message;
                        fn.TXT(ref sText);
                        this.ErrorSend(100041);
                        ProjectData.ClearProjectError();
                        break;
                    }

                case 2:
                    try
                    {
                        string externalProgram = MyProject.Forms.frmMain_RasDialex.ExternalProgram;
                        new Process()
                        {
                            StartInfo =
                            {
                                FileName    = externalProgram,
                                Arguments   = MyProject.Forms.frmMain_RasDialex.ExternalProgram_ParamConnect,
                                WindowStyle = (!MyProject.Forms.frmMain_RasDialex.VisibleCMD ? ProcessWindowStyle.Hidden : ProcessWindowStyle.Normal)
                            }
                        }.Start();
                        _FUNCTION.clsTXT fn    = _FUNCTION.FN;
                        string           sText = externalProgram + " " + MyProject.Forms.frmMain_RasDialex.ExternalProgram_ParamConnect;
                        fn.TXT(ref sText);
                        break;
                    }
                    catch (Exception ex)
                    {
                        ProjectData.SetProjectError(ex);
                        Exception        exception = ex;
                        _FUNCTION.clsTXT fn        = _FUNCTION.FN;
                        string           sText     = "RasDialEx Error: " + exception.Message;
                        fn.TXT(ref sText);
                        this.ErrorSend(100041);
                        ProjectData.ClearProjectError();
                        break;
                    }
                }
            }
        }