Example #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (CanLoginCount > 0)
            {
                var client = new ServiceReference.DataWebServiceSoapClient();
                client.InnerChannel.OperationTimeout = new TimeSpan(0, 0, 0, 3);

                var userName = this.txtName.Text;
                var psw      = this.psw.Password;
                try
                {
                    var isLoginSuccess = client.CompareToolLogin(userName, psw);
                    if (isLoginSuccess)
                    {
                        CommonUtils.UserName = userName;

                        if (ckbSavePsw.IsChecked == true)
                        {
                            CommonUtils.SetConfig("user", Cryptor.MD5Encrypt(userName));
                            CommonUtils.SetConfig("password", Cryptor.MD5Encrypt(psw));
                        }
                        else
                        {
                            CommonUtils.SetConfig("user", string.Empty);
                            CommonUtils.SetConfig("password", string.Empty);
                        }

                        IsLogon = true;
                        this.Close();
                    }
                    else
                    {
                        CommonUtils.SetConfig("info", Cryptor.MD5Encrypt(DateTime.Today.ToString() + "|" + (CanLoginCount - 1)));
                        MessageBox.Show("用户名或密码不正确!当前可用登录次数为:" + CanLoginCount);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("登录异常,Message " + ex.Message);
                }
            }
            else
            {
                if (CanLogon)
                {
                    MessageBox.Show("可用登录次数已耗尽,请联系管理员!");
                }
            }
        }
Example #2
0
        public MainWindow()
        {
            //var logon = new Logon();
            //logon.ShowDialog();

            //if (!Logon.IsLogon)
            //{
            //    this.Close();
            //    return;
            //}

            InitializeComponent();
            this.Loaded += (s, e) =>
            {
                var client         = new ServiceReference.DataWebServiceSoapClient();
                var isLoginSuccess = client.CompareToolLogin("W7txy", "W5waD6Kk");
                if (isLoginSuccess)
                {
                    CommonUtils.UserName = "******";
                }
                else
                {
                    MessageBox.Show("连接失败,未能自动登录!");
                }

                tiEncrypt.Visibility     = System.Windows.Visibility.Visible;
                tiGroupManage.Visibility = System.Windows.Visibility.Visible;
                tiInterface.Visibility   = System.Windows.Visibility.Visible;

                this.Title += CommonUtils.Version;

                importTool.OnDBChangeComplete += new Action(RefreshComparePage);

                groupTool.OnGroupChanged += new Action(() => { exportTool.Init(); });
            };
            TdxApi.OpenTdx();
        }