Пример #1
0
        private void btnMainUpdateDll_Click(object sender, EventArgs e)
        {
            UDllUpdate uDll = new UDllUpdate();

            uDll.Dock = DockStyle.Fill;
            Main.Instance.MetroContainer.Controls.Clear();
            Main.Instance.MetroContainer.Controls.Add(uDll);
        }
Пример #2
0
        private async void onLogin_Click(object sender, EventArgs e)
        {
            waitForm.Show(main_parent);
            if (string.IsNullOrEmpty(txtPassword.Text.Trim()))
            {
                MetroFramework.MetroMessageBox.Show(this, "Please input password", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (string.IsNullOrEmpty(txtUsername.Text.Trim()))
            {
                MetroFramework.MetroMessageBox.Show(this, "Please input Username", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            WebRequest          request = new WebRequest();
            HttpResponseMessage acc     = request.getaccount().Result;
            string account = await acc.Content.ReadAsStringAsync();

            var accounts = JsonConvert.DeserializeObject <List <CM_Account> >(account);

            var passmd5    = Helpers.ToMD5(txtPassword.Text.Trim());
            var user_valid = accounts.Exists(a => a.GEN.Trim() == txtUsername.Text.Trim() && a.password.Trim() == passmd5);

            if (user_valid)
            {
                if (chkmemo.Checked)
                {
                    if (Helpers.isExistsSetting("remembercheck"))
                    {
                        Helpers.SetSetting("remembercheck", "1");
                        Helpers.SetSetting("username", txtUsername.Text.Trim());
                    }
                    else
                    {
                        Helpers.AddSetting("remembercheck", "1");
                        Helpers.AddSetting("username", txtUsername.Text.Trim());
                    }
                }
                else
                {
                    if (Helpers.isExistsSetting("remembercheck"))
                    {
                        Helpers.SetSetting("remembercheck", "0");
                        Helpers.SetSetting("username", txtUsername.Text.Trim());
                    }
                    else
                    {
                        Helpers.AddSetting("remembercheck", "0");
                        Helpers.AddSetting("username", txtUsername.Text.Trim());
                    }
                }
                UDllUpdate dashboard = new UDllUpdate();
                dashboard.Dock = DockStyle.Fill;
                Main.Instance.MetroContainer.Controls.Clear();
                Main.Instance.MetroContainer.Controls.Add(dashboard);
            }
            else
            {
                MetroFramework.MetroMessageBox.Show(this, "Please check user or password", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Clear_Input();
            }
            waitForm.Close();
        }