Esempio n. 1
0
 public BasicReturnInfo ChangeAutoStartState()
 {
     return(AutoStartup.Set(ConfigInfo.AutoStart));
 }
Esempio n. 2
0
        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();
            }
        }