コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }