/// <summary>
 /// Initializes a new instance of the <see cref="WindowTraceListener" /> class.
 /// </summary>
 /// <param name="window">The window.</param>
 public WindowTraceListener(LogForm window)
 {
     _window = window;
     _window.Show();
     Name = "MBLogWindow";
 }
        /// <summary>
        /// Loads the log window.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="EventArgs" /> instance containing the event data.</param>
        void LoadLogWindow(object sender, EventArgs args)
        {
            CloseLogWindow();

            Action action = () =>
            {
                // Add our log window if specified
                if (_configurationManager.Configuration.ShowLogWindow)
                {
                    _logForm = new LogForm(_logManager);

                    Trace.Listeners.Add(new WindowTraceListener(_logForm));
                }
                else
                {
                    Trace.Listeners.Remove("MBLogWindow");
                }

                // Set menu option indicator
                cmdLogWindow.Checked = _configurationManager.Configuration.ShowLogWindow;
            };

            contextMenuStrip1.Invoke(action);
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WindowTraceListener" /> class.
 /// </summary>
 /// <param name="window">The window.</param>
 public WindowTraceListener(LogForm window)
 {
     _window = window;
     _window.Show();
     Name = "MBLogWindow";
 }