示例#1
0
        public static Srun4KManager Create()
        {
            if (SManager == null)
            {
                lock (SManagerLock)
                {
                    if (SManager == null)
                    {
                        SManager = new Srun4KManager();
                    }
                }
            }

            return(SManager);
        }
示例#2
0
 static Srun4KManager()
 {
     SManager     = null;
     SManagerLock = new object();
 }
示例#3
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();
            }
        }