Provides data for remote access service (RAS) connection events.
Inheritance: EventArgs
Exemple #1
0
        private void rasConnectionWatcher1_Connected(object sender, DotRas.RasConnectionEventArgs e)
        {
            if (e.Connection.EntryName == this.connectionName)
            {
                this.isConnected = true;

                BeginInvoke((MethodInvoker) delegate()
                {
                    notifyIcon1.Icon = Icon.FromHandle(((Bitmap)imageList1.Images["Connected"]).GetHicon());
                    notifyIcon1.ShowBalloonTip(2000, "VPNMyWay", "Connected to " + this.connectionName, ToolTipIcon.Info);
                    mnuItemConnect.Enabled    = btnConnect.Enabled = false;
                    mnuItemDisconnect.Enabled = btnDisconnect.Enabled = true;
                    this.isManualDisconnect   = false;
                    addConnectionLog("Connected");

                    setTitle("disconnect from " + this.connectionName);

                    tmrReconnect.Enabled = false;

                    if (this.connectedCmdName != null)
                    {
                        string description = "Connect command";

                        try
                        {
                            runCmd(this.connectedCmdName, description);
                        }
                        catch (Exception ex)
                        {
                            addConnectionLog("{0} failed: {1}", description, ex.Message);
                        }
                    }
                });
            }
        }
Exemple #2
0
        private void rasConnectionWatcher1_Disconnected(object sender, DotRas.RasConnectionEventArgs e)
        {
            if (e.Connection.EntryName == this.connectionName)
            {
                this.isConnected = false;

                BeginInvoke((MethodInvoker) delegate()
                {
                    mnuItemDisconnect.Enabled = btnDisconnect.Enabled = false;
                    addConnectionLog("Disconnected");

                    if (chkReconnectIfDropped.Checked && !this.isManualDisconnect)
                    {
                        notifyIcon1.Icon = Icon.FromHandle(((Bitmap)imageList1.Images["ConnectionDropped"]).GetHicon());
                        notifyIcon1.ShowBalloonTip(2000, "VPNMyWay", "Your VPN connection to " + this.connectionName + " dropped. Reconnecting in 10 seconds...", ToolTipIcon.Error);
                        addConnectionLog("Disconnection was unexpected. Reconnecting in 10 seconds...");
                        setTitle("reconnect pending (click to cancel)...");
                        tmrReconnect.Enabled = true;
                    }
                    else
                    {
                        notifyIcon1.Icon = Icon.FromHandle(((Bitmap)imageList1.Images["NotConnected"]).GetHicon());
                        notifyIcon1.ShowBalloonTip(2000, "VPNMyWay", "Disconnected from " + this.connectionName, ToolTipIcon.Info);

                        if (this.postdisconnectCmdName != null)
                        {
                            string description = "Post-disconnect command";

                            try
                            {
                                runCmd(this.postdisconnectCmdName, description);
                            }
                            catch (Exception ex)
                            {
                                addConnectionLog("{0} failed: {1}", description, ex.Message);
                            }
                        }

                        btnConnect.Enabled = mnuItemConnect.Enabled = true;
                        setTitle("connect to " + this.connectionName);
                    }
                });
            }
        }
Exemple #3
0
 private void rasConnectionWatcher1_Disconnected(object sender, RasConnectionEventArgs e)
 {
     this.Dial();
 }
 /// <summary>
 /// Raises the <see cref="RasConnectionWatcher.Disconnected"/> event.
 /// </summary>
 /// <param name="e">An <see cref="DotRas.RasConnectionEventArgs"/> containing event data.</param>
 private void OnDisconnected(RasConnectionEventArgs e)
 {
     this.RaiseEvent <RasConnectionEventArgs>(this.Disconnected, e);
 }
Exemple #5
0
 /// <summary>
 /// Raises the <see cref="RasConnectionWatcher.Disconnected"/> event.
 /// </summary>
 /// <param name="e">An <see cref="DotRas.RasConnectionEventArgs"/> containing event data.</param>
 private void OnDisconnected(RasConnectionEventArgs e)
 {
     this.RaiseEvent<RasConnectionEventArgs>(this.Disconnected, e);
 }
Exemple #6
0
 private void _rasConnectionWatcher_Disconnected(object sender, RasConnectionEventArgs e)
 {
     Console.WriteLine("Disconnected");
     this._taskCompletionSource.SetResult(null);
 }
Exemple #7
0
 private void rasConnectionWatcher1_Disconnected(object sender, RasConnectionEventArgs e)
 {
   this.Status = string.Empty;
   ShowStatus("Disconnected!");
   this.IsConnected = false;
   try
   {
     if (!this.Reconnect)
       LaunchVpn();
   }
   catch (ArgumentException ex)
   {
     ShowStatus(ex.Message);
   }
   catch (RankException ex)
   {
     ShowStatus(ex.Message);
   }
 }
Exemple #8
0
 private void rasConnectionWatcher1_Connected(object sender, RasConnectionEventArgs e)
 {
   this.IsConnected = true;
   ShowStatus("Connected!");
   AddRoutes();
 }