예제 #1
0
        /// <summary>
        /// 
        /// Constructs a new instance
        /// 
        /// </summary>
        internal ConsoleHost(RunspaceConfiguration configuration)
        {
            ClrFacade.SetCurrentThreadUiCulture(this.CurrentUICulture);
            ClrFacade.SetCurrentThreadCulture(this.CurrentCulture);
            // BUG: 610329. Tell PowerShell engine to apply console
            // related properties while launching Pipeline Execution
            // Thread.
            base.ShouldSetThreadUILanguageToZero = true;

            InDebugMode = false;
            _displayDebuggerBanner = true;

            _configuration = configuration;
            this.ui = new ConsoleHostUserInterface(this);
            _consoleWriter = new ConsoleTextWriter(ui);

#if !CORECLR // CurrentDomain.UnhandledException not supported on CoreCLR
            UnhandledExceptionEventHandler handler = new UnhandledExceptionEventHandler(UnhandledExceptionHandler);
            AppDomain.CurrentDomain.UnhandledException += handler;
#endif
        }
예제 #2
0
		internal ConsoleHost(RunspaceConfiguration configuration)
		{
			this.savedWindowTitle = "";
			this.id = Guid.NewGuid();
			this.ver = PSVersionInfo.PSVersion;
			this.noExit = true;
			this.hostGlobalLock = new object();
			this.transcriptFileName = string.Empty;
			this.transcriptionStateLock = new object();
			Thread.CurrentThread.CurrentUICulture = this.CurrentUICulture;
			Thread.CurrentThread.CurrentCulture = this.CurrentCulture;
			base.ShouldSetThreadUILanguageToZero = true;
			this.debuggerCommandProcessor = new HostUtilities.DebuggerCommandProcessor();
			this.inDebugMode = false;
			this.displayDebuggerBanner = true;
			this.configuration = configuration;
			this.ui = new ConsoleHostUserInterface(this);
			this.consoleWriter = new ConsoleTextWriter(this.ui);
			ConsoleHost.exitOnCtrlBreakMessage = ConsoleHostStrings.ExitOnCtrlBreakMessage;
			UnhandledExceptionEventHandler unhandledExceptionEventHandler = new UnhandledExceptionEventHandler(this.UnhandledExceptionHandler);
			AppDomain.CurrentDomain.UnhandledException += unhandledExceptionEventHandler;
		}