public static TaskDialog CreateMessageDialog(string caption, string message, TaskDialogStandardButtons buttons, TaskDialogStandardIcon icon, IntPtr owner) { var td = new TaskDialog { Caption = MainCaption, InstructionText = caption, Text = message, StandardButtons = buttons, OwnerWindowHandle = owner }; td.SetIconAndSound(icon); return(td); }
public static TaskDialog CreateExceptionDialog(Exception exception, string errorTitle, string errorRemedy, IntPtr owner) { var td = new TaskDialog { DetailsExpanded = false, Cancelable = true, Icon = TaskDialogStandardIcon.Error, Caption = MainCaption, InstructionText = errorTitle ?? "An unknown error occurred", Text = errorRemedy, DetailsExpandedLabel = "Hide details", DetailsCollapsedLabel = "Show details", DetailsExpandedText = exception.GetType().Name + ": " + exception.Message + "\n--- Begin stack trace ---\n" + exception.StackTrace, ExpansionMode = TaskDialogExpandedDetailsLocation.ExpandFooter, OwnerWindowHandle = owner }; td.SetIconAndSound(TaskDialogStandardIcon.Error); return(td); }