예제 #1
0
        private ActionPreference InquireForActionPreference(
            string message,
            ExecutionContext context)
        {
            InternalHostUserInterface      ui      = (InternalHostUserInterface)context.EngineHostInterface.UI;
            Collection <ChoiceDescription> choices = new Collection <ChoiceDescription>();
            string resourceString1 = ResourceManagerCache.GetResourceString("Parser", "ContinueLabel");
            string resourceString2 = ResourceManagerCache.GetResourceString("Parser", "ContinueHelpMessage");
            string resourceString3 = ResourceManagerCache.GetResourceString("Parser", "SilentlyContinueLabel");
            string resourceString4 = ResourceManagerCache.GetResourceString("Parser", "SilentlyContinueHelpMessage");
            string resourceString5 = ResourceManagerCache.GetResourceString("Parser", "BreakLabel");
            string resourceString6 = ResourceManagerCache.GetResourceString("Parser", "BreakHelpMessage");
            string resourceString7 = ResourceManagerCache.GetResourceString("Parser", "SuspendLabel");
            string helpMessage     = ResourceManagerCache.FormatResourceString("Parser", "SuspendHelpMessage");

            choices.Add(new ChoiceDescription(resourceString1, resourceString2));
            choices.Add(new ChoiceDescription(resourceString3, resourceString4));
            choices.Add(new ChoiceDescription(resourceString5, resourceString6));
            choices.Add(new ChoiceDescription(resourceString7, helpMessage));
            string resourceString8 = ResourceManagerCache.GetResourceString("Parser", "ExceptionActionPromptCaption");
            int    num;

            while ((num = ui.PromptForChoice(resourceString8, message, choices, 0)) == 3)
            {
                context.EngineHostInterface.EnterNestedPrompt();
            }
            if (num == 0)
            {
                return(ActionPreference.Continue);
            }
            return(num == 1 ? ActionPreference.SilentlyContinue : ActionPreference.Stop);
        }
예제 #2
0
        internal static ActionPreference InquireForActionPreference(string message, ExecutionContext context)
        {
            int num;
            InternalHostUserInterface      uI      = (InternalHostUserInterface)context.EngineHostInterface.UI;
            Collection <ChoiceDescription> choices = new Collection <ChoiceDescription>();
            string continueLabel               = ParserStrings.ContinueLabel;
            string continueHelpMessage         = ParserStrings.ContinueHelpMessage;
            string silentlyContinueLabel       = ParserStrings.SilentlyContinueLabel;
            string silentlyContinueHelpMessage = ParserStrings.SilentlyContinueHelpMessage;
            string breakLabel       = ParserStrings.BreakLabel;
            string breakHelpMessage = ParserStrings.BreakHelpMessage;
            string suspendLabel     = ParserStrings.SuspendLabel;
            string helpMessage      = StringUtil.Format(ParserStrings.SuspendHelpMessage, new object[0]);

            choices.Add(new ChoiceDescription(continueLabel, continueHelpMessage));
            choices.Add(new ChoiceDescription(silentlyContinueLabel, silentlyContinueHelpMessage));
            choices.Add(new ChoiceDescription(breakLabel, breakHelpMessage));
            choices.Add(new ChoiceDescription(suspendLabel, helpMessage));
            string exceptionActionPromptCaption = ParserStrings.ExceptionActionPromptCaption;

            while ((num = uI.PromptForChoice(exceptionActionPromptCaption, message, choices, 0)) == 3)
            {
                context.EngineHostInterface.EnterNestedPrompt();
            }
            switch (num)
            {
            case 0:
                return(ActionPreference.Continue);

            case 1:
                return(ActionPreference.SilentlyContinue);
            }
            return(ActionPreference.Stop);
        }