/// <summary> /// Show an exception dialog to the user. /// </summary> /// <param name="details"></param> /// <param name="ex"></param> private void ShowExceptionDialog(string details, Exception ex) { ExceptionDetailsDialog exceptionDialog = new ExceptionDetailsDialog(details, ex); exceptionDialog.ShowDialog(); }
/// <summary> /// Toggle the account enabled/disabled state. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void disableButton_Click(object sender, EventArgs e) { try { if (user == null) { NotifyUserIsNull(); return; } if (user.Enabled != null) { user.Enabled = !user.Enabled; } user.ADUser.Save(); UpdateStatusLabel(); } catch (Exception ex) { ExceptionDetailsDialog exceptionDialog = new ExceptionDetailsDialog( $"Failed to change the user's enabled status. Please check your account has permission to perform this task.", ex); exceptionDialog.ShowDialog(); return; } }