Exemplo n.º 1
0
        private void VPNRestartCmd_Click(object sender, EventArgs e)
        {
            lock (_changeStateLock)
            {
                if (RASutils.GetConnectionStatus() != RASutils.ConnectionStatus.Connected)
                {
                    return;
                }
                DialogResult q = MessageBox.Show("Are you sure you want to restart the VPN service?", "Restart VPN", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (q == DialogResult.No)
                {
                    return;
                }

                RASutils.DisconnectVPN();
                GetVPNStatus();

                if (RASutils.GetConnectionStatus() != RASutils.ConnectionStatus.Disconnected)
                {
                    return;
                }
                RASutils.ConnectVPN();
                GetVPNStatus();
            }
        }
Exemplo n.º 2
0
 private void VPNStartCmd_Click(object sender, EventArgs e)
 {
     lock (_changeStateLock)
     {
         if (RASutils.GetConnectionStatus() == RASutils.ConnectionStatus.Connected)
         {
             return;
         }
         RASutils.ConnectVPN();
         GetVPNStatus();
     }
 }
Exemplo n.º 3
0
        private void GetVPNStatus()
        {
            switch (RASutils.GetConnectionStatus())
            {
            case RASutils.ConnectionStatus.Connected:
                vpnTray.Icon = Properties.Resources.on;
                break;

            default:
                vpnTray.Icon = Properties.Resources.off;
                break;
            }
        }