protected override void InitializeShell() { base.InitializeShell(); AppEx.Init(Container); Application.Current.MainWindow = (Window)Shell; Application.Current.MainWindow.ShowDialog(); Application.Current.Shutdown(); }
private void OnLogon() { if (_hasLoggedIn) { AppEx.Logout(); ClearContentRegion(); } ShowLoginDailog(); }
private void Logon() { string name = logonName.Text; string pwd = logonPwd.Password; if (string.IsNullOrEmpty(name)) { errorMessage.Text = "用户名不能为空"; return; } if (string.IsNullOrEmpty(pwd)) { errorMessage.Text = "密码不能为空"; return; } bool suceeded = false; Mouse.OverrideCursor = Cursors.Wait; try { Task <bool> task = Task.Run <bool>(() => AppEx.Login(name, pwd)); suceeded = task.Result; } catch (Exception ex) { errorMessage.Text = string.Format("发生未知错误:{0}", ex.Message); } Task.WaitAll(); Mouse.OverrideCursor = null; if (!suceeded) { errorMessage.Text = "用户名或者密码错误"; return; } CloseDialog(); }
private void OnLogon(object parameter) { var passwordBox = parameter as PasswordBox; var password = passwordBox.Password; if (string.IsNullOrEmpty(UserName)) { ErrorMessage = "用户名不能为空"; return; } if (string.IsNullOrEmpty(password)) { ErrorMessage = "密码不能为空"; return; } bool suceeded = false; Mouse.OverrideCursor = Cursors.Wait; try { Task <bool> task = Task.Run <bool>(() => AppEx.Login(UserName, password)); suceeded = task.Result; } catch (Exception ex) { ErrorMessage = string.Format("发生未知错误:{0}", ex.Message); } Task.WaitAll(); Mouse.OverrideCursor = null; if (!suceeded) { ErrorMessage = "用户名或者密码错误"; return; } }