Beispiel #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string username    = this.username.Text;
            string password    = this.password.Text;
            bool   saveId      = this.saveId.Checked;
            bool   autoLogin   = this.autoLogin.Checked;
            string loginResult = "";
            var    task        = Task.Run(() =>
            {
                LoginService login = new LoginService();
                loginResult        = login.login(username, password);
            });
            var form = new frmWaitingBox(task); //等待界面

            form.ShowDialog();

            //login.cashTest();
            if (loginResult.Equals("1"))
            {
                string   rs   = string.Empty;
                UserInfo user = (UserInfo)AffectCacheObject.Instance[Constants.USERKEY];
                rs = user.userName + "----" + user.userPwd;

                if (autoLogin || saveId)
                {
                    hand.WriterConfig("userName", user.userName);
                    hand.WriterConfig("userPwd", user.userPwd);
                    hand.WriterConfig("autoLogin", autoLogin ? "T" : "F");
                    hand.WriterConfig("saveId", saveId ? "T" : "F");

                    SysConfigInfo config = SysConfigs.Instance().GetConfig();
                    config.UserName = user.userName;
                    config.UserPwd  = user.userPwd;
                    config.Token    = autoLogin ? "T" : "F";
                    config.SaveId   = saveId ? "T" : "F";
                }

                // MessageBox.Show(rs);
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show(loginResult);
            }
        }
Beispiel #2
0
        //保存event
        private void button1_Click(object sender, EventArgs e)
        {
            string url = this.urlTxt.Text.Trim();
            string dpi = string.Empty;

            if (this.dpiCmb.SelectedItem != null)
            {
                dpi = this.dpiCmb.SelectedItem.ToString();
            }

            string dpiIndex = this.dpiCmb.SelectedIndex.ToString();
            string twIndex  = this.scanCmb.SelectedIndex.ToString();
            string twName   = this.scanCmb.SelectedValue.ToString();

            if (string.IsNullOrEmpty(url))
            {
                MessageBox.Show("管理网站URL为空,保存失败");
                return;
            }
            if (string.IsNullOrEmpty(twName))
            {
                MessageBox.Show("扫描仪设置为空,保存失败");
                return;
            }
            if (string.IsNullOrEmpty(dpi))
            {
                MessageBox.Show("扫描仪预设DPI值为空,保存失败");
                return;
            }
            hand.WriterConfig("url", url);
            //hand.WriterConfig("isShowConfig", this.Yradio.Checked ? "T" : "F");
            hand.WriterConfig("autoLogin", this.IsAutoCbx.Checked ? "T" : "F");
            hand.WriterConfig("dpi", dpi);
            hand.WriterConfig("dpiIndex", dpiIndex);
            hand.WriterConfig("twIndex", twIndex);
            hand.WriterConfig("twName", twName);

            if (!string.IsNullOrEmpty(saveDayTxt.Text.Trim()))
            {
                hand.WriterConfig("saveDay", saveDayTxt.Text.Trim());
            }
            MessageBox.Show("保存成功");

            this.Close();
        }