Example #1
0
 internal PrinterLineOutput(string printerName)
 {
     this.printerName = printerName;
     WriteLineHelper.WriteCallback wlc = new WriteLineHelper.WriteCallback(this.OnWriteLine);
     WriteLineHelper.WriteCallback wc  = new WriteLineHelper.WriteCallback(this.OnWrite);
     this.writeLineHelper = new WriteLineHelper(true, wlc, wc, this.DisplayCells);
 }
Example #2
0
 internal ConsoleLineOutput(PSHostUserInterface hostConsole, bool paging, bool lineWrap, TerminatingErrorContext errorContext)
 {
     if (hostConsole == null)
     {
         throw PSTraceSource.NewArgumentNullException("hostConsole");
     }
     if (errorContext == null)
     {
         throw PSTraceSource.NewArgumentNullException("errorContext");
     }
     this.console = hostConsole;
     this.errorContext = errorContext;
     if (paging)
     {
         tracer.WriteLine("paging is needed", new object[0]);
         string s = StringUtil.Format(FormatAndOut_out_xxx.ConsoleLineOutput_PagingPrompt, new object[0]);
         this.prompt = new PromptHandler(s, this);
     }
     PSHostRawUserInterface rawUI = this.console.RawUI;
     if (rawUI != null)
     {
         tracer.WriteLine("there is a valid raw interface", new object[0]);
         this._displayCellsPSHost = new DisplayCellsPSHost(rawUI);
     }
     WriteLineHelper.WriteCallback wlc = new WriteLineHelper.WriteCallback(this.OnWriteLine);
     WriteLineHelper.WriteCallback wc = new WriteLineHelper.WriteCallback(this.OnWrite);
     if (this.forceNewLine)
     {
         this.writeLineHelper = new WriteLineHelper(lineWrap, wlc, null, this.DisplayCells);
     }
     else
     {
         this.writeLineHelper = new WriteLineHelper(lineWrap, wlc, wc, this.DisplayCells);
     }
 }
Example #3
0
 internal PrinterLineOutput(string printerName)
 {
     this.printerName = printerName;
     WriteLineHelper.WriteCallback wlc = new WriteLineHelper.WriteCallback(this.OnWriteLine);
     WriteLineHelper.WriteCallback wc = new WriteLineHelper.WriteCallback(this.OnWrite);
     this.writeLineHelper = new WriteLineHelper(true, wlc, wc, this.DisplayCells);
 }
Example #4
0
        /// <summary>
        /// Constructor for the class.
        /// </summary>
        /// <param name="printerName">name of printer, if null use default printer.</param>
        internal PrinterLineOutput(string printerName)
        {
            _printerName = printerName;

            // instantiate the helper to do the line processing when LineOutput.WriteXXX() is called
            WriteLineHelper.WriteCallback wl = new WriteLineHelper.WriteCallback(this.OnWriteLine);
            WriteLineHelper.WriteCallback w  = new WriteLineHelper.WriteCallback(this.OnWrite);

            _writeLineHelper = new WriteLineHelper(true, wl, w, this.DisplayCells);
        }
Example #5
0
        /// <summary>
        /// constructor for the ConsoleLineOutput
        /// </summary>
        /// <param name="hostConsole">PSHostUserInterface to wrap</param>
        /// <param name="paging">true if we require prompting for page breaks</param>
        /// <param name="errorContext">error context to throw exceptions</param>
        internal ConsoleLineOutput(PSHostUserInterface hostConsole, bool paging, TerminatingErrorContext errorContext)
        {
            if (hostConsole == null)
            {
                throw PSTraceSource.NewArgumentNullException("hostConsole");
            }
            if (errorContext == null)
            {
                throw PSTraceSource.NewArgumentNullException("errorContext");
            }

            _console      = hostConsole;
            _errorContext = errorContext;

            if (paging)
            {
                tracer.WriteLine("paging is needed");
                // if we need to do paging, instantiate a prompt handler
                // that will take care of the screen interaction
                string promptString = StringUtil.Format(FormatAndOut_out_xxx.ConsoleLineOutput_PagingPrompt);
                _prompt = new PromptHandler(promptString, this);
            }


            PSHostRawUserInterface raw = _console.RawUI;

            if (raw != null)
            {
                tracer.WriteLine("there is a valid raw interface");
#if TEST_MULTICELL_ON_SINGLE_CELL_LOCALE
                // create a test instance with fake behavior
                this._displayCellsPSHost = new DisplayCellsTest();
#else
                // set only if we have a valid raw interface
                _displayCellsPSHost = new DisplayCellsPSHost(raw);
#endif
            }

            // instantiate the helper to do the line processing when ILineOutput.WriteXXX() is called
            WriteLineHelper.WriteCallback wl = new WriteLineHelper.WriteCallback(this.OnWriteLine);
            WriteLineHelper.WriteCallback w  = new WriteLineHelper.WriteCallback(this.OnWrite);

            if (_forceNewLine)
            {
                _writeLineHelper = new WriteLineHelper(/*lineWrap*/ false, wl, null, this.DisplayCells);
            }
            else
            {
                _writeLineHelper = new WriteLineHelper(/*lineWrap*/ false, wl, w, this.DisplayCells);
            }
        }
Example #6
0
        internal ConsoleLineOutput(PSHostUserInterface hostConsole, bool paging, bool lineWrap, TerminatingErrorContext errorContext)
        {
            if (hostConsole == null)
            {
                throw PSTraceSource.NewArgumentNullException("hostConsole");
            }
            if (errorContext == null)
            {
                throw PSTraceSource.NewArgumentNullException("errorContext");
            }
            this.console      = hostConsole;
            this.errorContext = errorContext;
            if (paging)
            {
                tracer.WriteLine("paging is needed", new object[0]);
                string s = StringUtil.Format(FormatAndOut_out_xxx.ConsoleLineOutput_PagingPrompt, new object[0]);
                this.prompt = new PromptHandler(s, this);
            }
            PSHostRawUserInterface rawUI = this.console.RawUI;

            if (rawUI != null)
            {
                tracer.WriteLine("there is a valid raw interface", new object[0]);
                this._displayCellsPSHost = new DisplayCellsPSHost(rawUI);
            }
            WriteLineHelper.WriteCallback wlc = new WriteLineHelper.WriteCallback(this.OnWriteLine);
            WriteLineHelper.WriteCallback wc  = new WriteLineHelper.WriteCallback(this.OnWrite);
            if (this.forceNewLine)
            {
                this.writeLineHelper = new WriteLineHelper(lineWrap, wlc, null, this.DisplayCells);
            }
            else
            {
                this.writeLineHelper = new WriteLineHelper(lineWrap, wlc, wc, this.DisplayCells);
            }
        }
Example #7
0
        /// <summary>
        /// constructor for the class
        /// </summary>
        /// <param name="printerName">name of printer, if null use default printer</param>
        internal PrinterLineOutput(string printerName)
        {
            _printerName = printerName;

            // instantiate the helper to do the line processing when LineOutput.WriteXXX() is called
            WriteLineHelper.WriteCallback wl = new WriteLineHelper.WriteCallback(this.OnWriteLine);
            WriteLineHelper.WriteCallback w = new WriteLineHelper.WriteCallback(this.OnWrite);

            _writeLineHelper = new WriteLineHelper(true, wl, w, this.DisplayCells);
        }
Example #8
0
        /// <summary>
        /// constructor for the ConsoleLineOutput
        /// </summary>
        /// <param name="hostConsole">PSHostUserInterface to wrap</param>
        /// <param name="paging">true if we require prompting for page breaks</param>
        /// <param name="errorContext">error context to throw exceptions</param>
        internal ConsoleLineOutput(PSHostUserInterface hostConsole, bool paging, TerminatingErrorContext errorContext)
        {
            if (hostConsole == null)
                throw PSTraceSource.NewArgumentNullException("hostConsole");
            if (errorContext == null)
                throw PSTraceSource.NewArgumentNullException("errorContext");

            _console = hostConsole;
            _errorContext = errorContext;

            if (paging)
            {
                tracer.WriteLine("paging is needed");
                // if we need to do paging, instantiate a prompt handler
                // that will take care of the screen interaction
                string promptString = StringUtil.Format(FormatAndOut_out_xxx.ConsoleLineOutput_PagingPrompt);
                _prompt = new PromptHandler(promptString, this);
            }


            PSHostRawUserInterface raw = _console.RawUI;
            if (raw != null)
            {
                tracer.WriteLine("there is a valid raw interface");
#if TEST_MULTICELL_ON_SINGLE_CELL_LOCALE
                // create a test instance with fake behavior
                this._displayCellsPSHost = new DisplayCellsTest();
#else
                // set only if we have a valid raw interface
                _displayCellsPSHost = new DisplayCellsPSHost(raw);
#endif
            }

            // instantiate the helper to do the line processing when ILineOutput.WriteXXX() is called
            WriteLineHelper.WriteCallback wl = new WriteLineHelper.WriteCallback(this.OnWriteLine);
            WriteLineHelper.WriteCallback w = new WriteLineHelper.WriteCallback(this.OnWrite);

            if (_forceNewLine)
            {
                _writeLineHelper = new WriteLineHelper(/*lineWrap*/false, wl, null, this.DisplayCells);
            }
            else
            {
                _writeLineHelper = new WriteLineHelper(/*lineWrap*/false, wl, w, this.DisplayCells);
            }
        }