예제 #1
0
        /// <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();
        }
예제 #2
0
        /// <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;
            }
        }