Пример #1
0
        /// <summary>
        /// OVPN requests a username and password <br />
        /// generates and shows a form, answers via e
        /// </summary>
        /// <param name="sender">OVPN which requests the username and password</param>
        /// <param name="e">Information, what is needed</param>
        private void m_vpn_needLoginAndPassword(object sender, NeedLoginAndPasswordEventArgs e)
        {
            m_frmlpw = new ViewVPNAuthentication();
            string[] loginfo = null;
            loginfo = m_frmlpw.AskLoginAndPass(e.PasswordType, Name);
            if (loginfo != null)
            {
                e.UserName = loginfo[0];
                e.Password = loginfo[1];
            }

            // if no password was entered, disconnect
            if ((e.Password == null || e.UserName == null) &&
                VPNConnection.State.CreateSnapshot().ConnectionState ==
                VPNConnectionState.Initializing)
            {
                m_disconnectTimer.Start();
            }

            m_frmlpw = null;
        }
Пример #2
0
        private void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    m_disconnectTimer.Dispose();
                    m_frmkey.Dispose();
                    m_frmlpw.Dispose();
                    m_frmpw.Dispose();
                    m_infobox.Dispose();
                    m_menu.Dispose();
                    m_menu_connect.Dispose();
                    m_menu_disconnect.Dispose();
                    m_menu_edit.Dispose();
                    m_menu_error.Dispose();
                    m_menu_show.Dispose();
                    m_parent.Dispose();
                    m_status.Dispose();
                    m_vpn.Dispose();
                }

                m_vpn             = null;
                m_status          = null;
                m_parent          = null;
                m_menu_show       = null;
                m_menu_error      = null;
                m_menu_edit       = null;
                m_menu_disconnect = null;
                m_menu_connect    = null;
                m_menu            = null;
                m_infobox         = null;
                m_frmpw           = null;
                m_frmlpw          = null;
                m_frmkey          = null;
                m_disconnectTimer = null;

                disposed = true;
            }
        }