Esempio n. 1
0
            private void EvaluateSuggestions(ConsoleHostUserInterface ui)
            {
                // Output any training suggestions
                try
                {
                    ArrayList suggestions = HostUtilities.GetSuggestion(_parent.Runspace);

                    if (suggestions.Count > 0)
                    {
                        ui.WriteLine();
                    }

                    bool first = true;
                    foreach (string suggestion in suggestions)
                    {
                        if (!first)
                            ui.WriteLine();

                        ui.WriteLine(suggestion);

                        first = false;
                    }
                }
                catch (TerminateException)
                {
                    // A variable breakpoint may be hit by HostUtilities.GetSuggestion. The debugger throws TerminateExceptions to stop the execution
                    // of the current statement; we do not want to treat these exceptions as errors.
                }
                catch (Exception e)
                {
                    // Catch-all OK. This is a third-party call-out.
                    CommandProcessorBase.CheckForSevereException(e);

                    ui.WriteErrorLine(e.Message);

                    LocalRunspace localRunspace = (LocalRunspace)_parent.Runspace;
                    localRunspace.GetExecutionContext.AppendDollarError(e);
                }
            }
Esempio n. 2
0
			private void EvaluateSuggestions(ConsoleHostUserInterface ui)
			{
				try
				{
					ArrayList suggestion = HostUtilities.GetSuggestion(this.parent.Runspace);
					if (suggestion.Count > 0)
					{
						ui.WriteLine();
					}
					bool flag = true;
					foreach (string str in suggestion)
					{
						if (!flag)
						{
							ui.WriteLine();
						}
						ui.WriteLine(str);
						flag = false;
					}
				}
				catch (TerminateException terminateException)
				{
				}
				catch (Exception exception1)
				{
					Exception exception = exception1;
					CommandProcessorBase.CheckForSevereException(exception);
					ui.WriteErrorLine(exception.Message);
					LocalRunspace runspace = (LocalRunspace)this.parent.Runspace;
					runspace.GetExecutionContext.AppendDollarError(exception);
				}
			}