/// <summary> /// Removes an event handler that listens for ouput events. /// </summary> /// <param name="outputEventHandler">The event handler to be removed.</param> public static void RemoveOutputEventHandler(OutputEventHandler outputEventHandler) { lock (_lock) { _outputEventHandler -= outputEventHandler; } }
private void Send(string line, OutputLevel level, bool isNested) { if (IsQuiet) { return; } List <string> lines = new List <string>(); lines.Add(line); OutputEventHandler handler = OnOutput; if (handler != null) { OutputEventArgs e = new OutputEventArgs() { Lines = lines, Level = level, Indent = CurrentIndent, IsNested = isNested }; handler(this, e); } }
/// <summary> /// Adds an event handler to listen for ouput events. /// </summary> /// <param name="outputEventHandler">The event handler to be added.</param> public static void AddOutputEventHandler(OutputEventHandler outputEventHandler) { lock (_lock) { _outputEventHandler += outputEventHandler; } }
public void WriteLine(string text) { // We call the OutputRecieved event here, this will be used by LogMuffin // to get informed of new console outputs. OutputEventHandler handler = this.OutputRecieved; if (handler != null) { handler(this, text); } // Write the recieved text to the console. Console.WriteLine(text); }
public ConsoleRedirect(OutputEventHandler output) { this.Output = output; }