コード例 #1
0
        /// <summary>
        /// OVPN requests a SmardCard id <br />
        /// generates and shows a form, answers via e
        /// </summary>
        /// <param name="sender">OVPN which requests the id</param>
        /// <param name="e">Information, what was found</param>
        private void m_vpn_needCardID(object sender, NeedCardIdEventArgs e)
        {
            // if there is no id
            if (e.CardDetails.Count == 0)
            {
                if (RTLMessageBox.Show(m_parent,
                                       Program.res.GetString("BOX_NoKey"),
                                       MessageBoxButtons.RetryCancel,
                                       MessageBoxDefaultButton.Button1,
                                       MessageBoxIcon.Warning) == DialogResult.Retry)
                {
                    e.SelectedId = NeedCardIdEventArgs.Retry;
                }
                else
                {
                    e.SelectedId = NeedCardIdEventArgs.None;
                    m_disconnectTimer.Start();
                }
            }

            // if there is only one id, use it
            else if (e.CardDetails.Count == 1)
            {
                e.SelectedId = e.CardDetails[0].Number;
            }
            else
            {
                // request key
                m_frmkey = new FrmSelectPKCS11Key();
                int res = m_frmkey.SelectKey(e.CardDetails, this.Name);
                if (res == -1)
                {
                    e.SelectedId = NeedCardIdEventArgs.None;
                    if (VPNConnection.State.CreateSnapshot().ConnectionState
                        == VPNConnectionState.Initializing)
                    {
                        m_disconnectTimer.Start();
                    }
                }
                else if (res == -2)
                {
                    e.SelectedId = NeedCardIdEventArgs.Retry;
                }
                else
                {
                    e.SelectedId = res;
                }
                m_frmkey = null;
            }
        }
コード例 #2
0
        private void Dispose(bool disposing)
        {
            if (!disposed)
            {
                File.Delete(m_tempLog);

                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;
            }
        }
コード例 #3
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;
            }
        }
コード例 #4
0
        /// <summary>
        /// OVPN requests a SmardCard id <br />
        /// generates and shows a form, answers via e
        /// </summary>
        /// <param name="sender">OVPN which requests the id</param>
        /// <param name="e">Information, what was found</param>
        private void m_vpn_needCardID(object sender, NeedCardIdEventArgs e)
        {
            // if there is no id
            if (e.CardDetails.Count == 0)
            {
                if (RTLMessageBox.Show(m_parent,
                    Program.res.GetString("BOX_NoKey"),
                    MessageBoxButtons.RetryCancel,
                    MessageBoxDefaultButton.Button1,
                    MessageBoxIcon.Warning) == DialogResult.Retry)

                    e.SelectedId = NeedCardIdEventArgs.Retry;
                else
                {
                    e.SelectedId = NeedCardIdEventArgs.None;
                    m_disconnectTimer.Start();

                }
            }

            // if there is only one id, use it
            else if (e.CardDetails.Count == 1)
                e.SelectedId = e.CardDetails[0].Number;
            else
            {
                // request key
                m_frmkey = new FrmSelectPKCS11Key();
                int res = m_frmkey.SelectKey(e.CardDetails, this.Name);
                if (res == -1)
                {
                    e.SelectedId = NeedCardIdEventArgs.None;
                    if (VPNConnection.State.CreateSnapshot().ConnectionState
                        == VPNConnectionState.Initializing)
                    {
                        m_disconnectTimer.Start();
                    }
                }
                else if (res == -2)
                    e.SelectedId = NeedCardIdEventArgs.Retry;
                else
                    e.SelectedId = res;
                m_frmkey = null;
            }
        }