Source

KPDataSave / KPDataSave / Forms / States / SignOut.cs

/*
    KPDataSave - KeePass plugin which saves database in Dropbox service
    Copyright (C) 2011-2012 HexRx

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace KPDataSave.Forms.States
{
    public class SignOut : AbstractForm
    {
        private readonly StateControl _stateControl;

        public SignOut(StateControl stateControl)
        {
            _stateControl = stateControl;
            Text = "Sign Out";
            Button btnSignOunt = new Button();
            btnSignOunt.Dock = DockStyle.Fill;
            btnSignOunt.Text = "SignOut";
            btnSignOunt.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            btnSignOunt.Click += new System.EventHandler(BtnSignOutClick);
            tableLayout.Controls.Add(btnSignOunt, 1, 1);
        }

        private void BtnSignOutClick(object sender, EventArgs e)
        {
            // Удаляем инфу об аутентификации
            AccountState.Remove(_stateControl.PluginHost);
            MessageBox.Show("You sign out!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Close();
        }
    }
}