Esempio n. 1
0
 private void Pass_txt_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         Login_but.PerformClick();
     }
 }
Esempio n. 2
0
        private void LoginForm_Load(object sender, EventArgs e)
        {
            Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Begeba\FocusLock");

            if (!MainForm.KeyExists("Creds"))
            {
                Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Begeba\FocusLock").SetValue("Creds", "");
            }
            if (!MainForm.KeyExists("SaveCreds"))
            {
                Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Begeba\FocusLock").SetValue("SaveCreds", "");
            }

            if (MainForm.KeyExists("SaveCreds"))
            {
                if (Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Begeba\FocusLock").GetValue("SaveCreds").ToString() == "TRUE")
                {
                    Save_cred.Checked = true;
                }
                else if (Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Begeba\FocusLock").GetValue("SaveCreds").ToString() == "FALSE")
                {
                    Save_cred.Checked = false;
                }
            }
            if (MainForm.KeyExists("Creds"))
            {
                if (!String.IsNullOrEmpty(Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Begeba\FocusLock").GetValue("Creds").ToString()))
                {
                    string[] creds = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Begeba\FocusLock").GetValue("Creds").ToString().Split(';');
                    User_txt.Text = creds[0];
                    Pass_txt.Text = creds[1];

                    Login_but.PerformClick();
                }
            }
        }