/// <summary> /// Sends a string to the console output. /// </summary> /// <param name="sender">The sending object.</param> /// <param name="e">The <see cref="WPFCommandPrompt.ConsoleWriteLineEventArgs" /> instance containing the event data.</param> public void WriteLine(object sender, ConsoleWriteLineEventArgs e) { if (e.Paragraph != null) { WriteLineToConsole(e.Paragraph); } else { if (e.Foreground != null) { WriteLineToConsole(e.Message, e.Foreground); } else { WriteLineToConsole(e.Message, _styleThemeManager.MessageTextColor); } } }
/// <summary> /// Sends a ConsoleWriteLineEventArgs object to the console output. /// </summary> /// <param name="sender">The sending object.</param> /// <param name="e">The <see cref="WPFCommandPrompt.ConsoleWriteLineEventArgs" /> instance containing the event data.</param> /// <exception cref="NullReferenceException">Thrown when class ConsoleWindow() has not been instantiated.</exception> public void WriteLine(object sender, ConsoleWriteLineEventArgs e) { if (_consoleWindow != null) { ConsoleWriteLine(sender, e); } else { throw new NullReferenceException( "ConsoleWindow() class not instantiated. Call Show() to create console window."); } }
/// <summary> /// Called when writing text to the console. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="WPFCommandPrompt.ConsoleWriteLineEventArgs" /> instance containing the event data.</param> public void OnConsoleWriteEvent(object sender, ConsoleWriteLineEventArgs e) { if (ConsoleWriteLine != null) { ConsoleWriteLine(sender, e); } }
// /// <summary> /// Write text to the console, or could alternatly call: /// commandPrompt.WriteLine(string) /// commandPrompt.WriteLine(string, Brush) /// commandPrompt.WriteLine(Paragraph) /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="WPFCommandPrompt.ConsoleWriteLineEventArgs" /> instance containing the event data.</param> private void WriteToConsole(ConsoleWriteLineEventArgs e) { _commandPrompt.OnConsoleWriteEvent(this, e); }