/// <summary> /// 集中验证 /// </summary> /// <returns></returns> public bool AuthLogin() { bool flag = false; int authflag = AuthUser(); //authflag = 100; if (authflag == 100) { timer.Stop(); StartUpView startUpView = new StartUpView(); startUpView.Show(); Close(); } else { if (authflag == -10) { lblAuthTips.Text = resourceManager.GetString("Start_Database_Failure", cultureInfo); } if (authflag == -11) { lblAuthTips.Text = resourceManager.GetString("Authentication_Failure", cultureInfo); } btnRetry.Visibility = System.Windows.Visibility.Visible; } return(flag); }
/// <summary> /// 集中验证 /// </summary> /// <returns></returns> public async Task <bool> AuthLogin() { await CheckConfig(); bool flag = false; int authflag = AuthUser(); authflag = 100; if (authflag == 100) { await App.Current.Dispatcher.BeginInvoke(new Action(() => { StartUpView startUpView = new StartUpView(); startUpView.Show(); Close(); })); } else { _triedTimes++; if (_triedTimes > MaxTriedTimes) { _timer.Change(Timeout.Infinite, Timeout.Infinite); await App.Current.Dispatcher.BeginInvoke(new Action(() => { btnRetry.Visibility = System.Windows.Visibility.Visible; })); } else { _timer.Change(2000, Timeout.Infinite); } if (authflag == -10) { await App.Current.Dispatcher.BeginInvoke(new Action(() => { lblAuthTips.Text = SystemLanguageManager.Instance.ResourceManager.GetString("Start_Database_Failure", SystemLanguageManager.Instance.CultureInfo); })); } if (authflag == -11) { await App.Current.Dispatcher.BeginInvoke(new Action(() => { lblAuthTips.Text = SystemLanguageManager.Instance.ResourceManager.GetString("Authentication_Failure", SystemLanguageManager.Instance.CultureInfo); })); } } return(flag); }