private void txtPWD_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         BTN_Login.Focus();
     }
 }
예제 #2
0
파일: Form1.cs 프로젝트: MrPady/c-Srun4K
        private void Form1_Load(object sender, EventArgs e)
        {
            IsInInitialize = true;

            Manager = Srun4KManager.Create();

            TB_UserName.DataBindings.Add("Text", Manager.ConfigInfo, "UserName");
            TB_Password.DataBindings.Add("Text", Manager.ConfigInfo, "Password");
            TB_LoginUrl.DataBindings.Add("Text", Manager.ConfigInfo, "LoginUrl");
            TB_LogoutUrl.DataBindings.Add("Text", Manager.ConfigInfo, "LogoutUrl");
            TB_CheckOnlineUrl.DataBindings.Add("Text", Manager.ConfigInfo, "CheckOnlineUrl");

            TB_UserName.TextChanged       += Controls_Changed;
            TB_Password.TextChanged       += Controls_Changed;
            TB_LoginUrl.TextChanged       += Controls_Changed;
            TB_LogoutUrl.TextChanged      += Controls_Changed;
            TB_CheckOnlineUrl.TextChanged += Controls_Changed;

            TB_Password.PasswordChar = '*';

            if (Manager.ConfigInfo.AutoLogin)
            {
                CB_AutoLogin.CheckState = CheckState.Checked;
            }
            else
            {
                CB_AutoLogin.CheckState = CheckState.Unchecked;
            }

            if (Manager.ConfigInfo.AutoStart)
            {
                if (AutoStartup.Check())
                {
                    CB_AutoStart.CheckState = CheckState.Checked;
                }
                else
                {
                    Manager.ConfigInfo.AutoStart = false;
                    Manager.ConfigIsChange       = true;
                    SaveChanges();
                }
            }
            else
            {
                CB_AutoStart.CheckState = CheckState.Unchecked;
            }

            BTN_Login.Focus();

            Manager.ConfigIsChange = false;

            IsInInitialize = false;

            if (Manager.ConfigInfo.AutoLogin)
            {
                if (System.Environment.CurrentDirectory == System.Environment.SystemDirectory)
                {
                    WindowState = FormWindowState.Minimized;
                }
                Thread autoLogin = new Thread(OnAutoLogin);
                autoLogin.Start();
            }
        }