コード例 #1
0
        public void Logout()
        {
            try
            {
                if (rdoGraphAPI.Checked)
                {
                    // clear the token cache
                    authContext.TokenCache.Clear();

                    // check for cache type
                    if (Properties.Settings.Default.TokenCache == "File")
                    {
                        fc.Clear();
                    }
                    else
                    {
                        // clear cookies from browser control
                        ClearCookies();
                    }

                    // clear the user info
                    user.Clear();
                }
                else
                {
                    // reset basic auth controls
                    passwordEntered     = null;
                    userNameEntered     = null;
                    tbUsername.Enabled  = true;
                    mskPassword.Enabled = true;
                    ToggleButtons();
                    ToggleRdoButtons();
                }
            }
            catch (Exception ex)
            {
                applogger.Log(ex.Message);
            }
            finally
            {
                // reset UI text
                ToggleRdoButtons();
                ToggleButtons();
                lblUsername.Text    = "No User Logged In";
                btnLoginLogout.Text = "Login";
            }
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: drvespa/restfuloutlook
        public void Logout()
        {
            try
            {
                // clear the token cache
                if (rdoGraphAPI.Checked)
                {
                    authContext.TokenCache.Clear();
                    // clear cookies from the browser control
                    ClearCookies();
                }
                else if (rdoBasic.Checked)
                {
                    passwordEntered     = null;
                    userNameEntered     = null;
                    tbUsername.Enabled  = true;
                    mskPassword.Enabled = true;
                }
                else
                {
                    btnMailAPI.Enabled           = false;
                    btnCalendarAPI.Enabled       = false;
                    btnContactsAPI.Enabled       = false;
                    btnDiscoveryServices.Enabled = false;
                    authContext.TokenCache.Clear();
                    authContext = null;
                }

                // reset UI
                lblUsername.Text    = "No User Logged In";
                btnLoginLogout.Text = "Login";

                // clear user info
                user.Clear();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }