public void InitDetial(bool bNotAutoLogin = false) { this.WindowStartupLocation = WindowStartupLocation.CenterScreen; m_CUser.ItemsSource = Para.Config.Accounts; m_CUser.SelectedIndex = 0; m_CAuto.IsChecked = Para.Config.AutoLogin; m_CRemember.IsChecked = Para.Config.Remember; IsShowWaitPage(false); if (bNotAutoLogin) { return; } //auto login if ((bool)m_CAuto.IsChecked && Para.Config.Accounts.Count > 0) { AIGS.Common.Property aProperty = Para.Config.Accounts[0]; if (aProperty.Key != null && aProperty.Value != null && !string.IsNullOrWhiteSpace(aProperty.Key.ToString()) && !string.IsNullOrWhiteSpace(aProperty.Value.ToString())) { m_CAccountLabel.Content = aProperty.Key.ToString(); //show wait page IsShowWaitPage(true); OpenThread(aProperty); } } }
/// <summary> /// Login thread /// </summary> /// <param name="data">username and password</param> private void ThreadFunc_LogIn(object[] data) { Account aAccount = new Account(); AIGS.Common.Property aProperty = (AIGS.Common.Property)data[0]; bool bCheck = aAccount.LogIn(aProperty.Key.ToString(), aProperty.Value.ToString()); ThreadResultNotify mothed = new ThreadResultNotify(LogInResult); this.Dispatcher.Invoke(mothed, aAccount); return; }
/// <summary> /// open /// </summary> /// <param name="aProperty"></param> private void OpenThread(AIGS.Common.Property aProperty) { ThreadHandle = ThreadHelper.Start(ThreadFunc_LogIn, aProperty); }