using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using C4IT.Security;

namespace C4IT.Security
{
    public partial class frmPassword : Form
    {
        public frmPassword()
        {
            InitializeComponent();
        }

        private void chkShow_CheckStateChanged(object sender, EventArgs e)
        {
            if (chkShow.Checked)
                txtPassword.UseSystemPasswordChar = false;
            else
                txtPassword.UseSystemPasswordChar = true;
        }

        private void butCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void butCopy_Click(object sender, EventArgs e)
        {
            string PW = cSecurePassword.Instance.Encode(txtPassword.Text);
            Clipboard.SetText(PW);
        }

        private void butClean_Click(object sender, EventArgs e)
        {
            Clipboard.Clear();
        }

        private void frmPassword_FormClosed(object sender, FormClosedEventArgs e)
        {
            Clipboard.Clear();
        }
    }
}
