context: /*
   * This file is part of logview4net (logview4net.sourceforge.net)
   * Copyright 2008 Johan Idstam
   * 
   * 
   * This source code is released under the Artistic License 2.0.
   */
  
  using System;
  using System.ComponentModel;
  using System.Diagnostics;
  using System.IO;
  using System.Windows.Forms;
  using System.Xml;
  using System.Xml.Serialization;
  
  namespace logview4net.Listeners
  {
      /// <summary>
      /// Summary description for UdpListenerConfigurator.
      /// </summary>
      public class EventLogListenerConfigurator : UserControl, IListenerConfigurator
      {
  
          private EventLogListener _listener = new EventLogListener();
          private Panel panel1;
          private TextBox txtPrefix;
          private Label label4;
          private CheckBox chkFieldNames;
          private ComboBox cboLogName;
          private TextBox txtIntervall;
          private Label label3;
          private Label label2;
          private TextBox txtHost;
          private Label label1;
          private ILog _log = Logger.GetLogger("logview4net.Listeners.EventLogListenerConfigurator");
          private CheckBox chkTimestamp;
          private TextBox txtFormat;
          private Label label5;
  
          /// <summary> 
          /// Required designer variable.
          /// </summary>
          private Container components = null;
  
          /// <summary>
          /// Creates a new <see cref="EventLogListenerConfigurator"/> instance.
          /// </summary>
          public EventLogListenerConfigurator()
          {
              if (_log.Enabled) _log.Debug(GetHashCode(), "Create EventLogListenerConfigurator");
  
              // This call is required by the Windows.Forms Form Designer.
              InitializeComponent();
  
              // TODO: Add any initialization after the InitializeComponent call
              _listener = new EventLogListener();
              _listener.Host = ".";
              _listener.LogName = "Application";
              _listener.PollInterval = 3000;
          }
  
          /// <summary>
          /// Creates a new <see cref="EventLogListenerConfigurator"/> instance.
          /// </summary>
          public EventLogListenerConfigurator(EventLogListener listener)
          {
              _listener = listener;
              if (_log.Enabled) _log.Debug(GetHashCode(), "Create EventLogListenerConfigurator(IListener)");
  
              // This call is required by the Windows.Forms Form Designer.
              InitializeComponent();
  
              UpdateControls();
  
              cboLogName.Enabled = false;
              txtHost.Enabled = false;
          }
  
          /// <summary> 
          /// Clean up any resources being used.
          /// </summary>
          protected override void Dispose(bool disposing)
          {
              if (_log.Enabled) _log.Debug(GetHashCode(), "Dispose");
              if (disposing)
              {
                  if (components != null)
                  {
                      components.Dispose();
                  }
              }
              base.Dispose(disposing);
          }
  
          #region Component Designer generated code
  
          /// <summary> 
          /// Required method for Designer support - do not modify 
          /// the contents of this method with the code editor.
          /// </summary>
          private void InitializeComponent()
          {
              this.panel1 = new System.Windows.Forms.Panel();
              this.txtPrefix = new System.Windows.Forms.TextBox();
              this.label4 = new System.Windows.Forms.Label();
              this.chkFieldNames = new System.Windows.Forms.CheckBox();
              this.cboLogName = new System.Windows.Forms.ComboBox();
              this.txtIntervall = new System.Windows.Forms.TextBox();
              this.label3 = new System.Windows.Forms.Label();
              this.label2 = new System.Windows.Forms.Label();
              this.txtHost = new System.Windows.Forms.TextBox();
              this.label1 = new System.Windows.Forms.Label();
              this.chkTimestamp = new System.Windows.Forms.CheckBox();
              this.txtFormat = new System.Windows.Forms.TextBox();
              this.label5 = new System.Windows.Forms.Label();
              this.panel1.SuspendLayout();
              this.SuspendLayout();
              // 
              // panel1
              // 
              this.panel1.Controls.Add(this.chkTimestamp);
              this.panel1.Controls.Add(this.txtFormat);
              this.panel1.Controls.Add(this.label5);
              this.panel1.Controls.Add(this.txtPrefix);
              this.panel1.Controls.Add(this.label4);
              this.panel1.Controls.Add(this.chkFieldNames);
              this.panel1.Controls.Add(this.cboLogName);
              this.panel1.Controls.Add(this.txtIntervall);
              this.panel1.Controls.Add(this.label3);
              this.panel1.Controls.Add(this.label2);
              this.panel1.Controls.Add(this.txtHost);
              this.panel1.Controls.Add(this.label1);
              this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
              this.panel1.Location = new System.Drawing.Point(0, 0);
              this.panel1.Name = "panel1";
              this.panel1.Size = new System.Drawing.Size(456, 79);
              this.panel1.TabIndex = 0;
              // 
              // txtPrefix
              // 
              this.txtPrefix.Location = new System.Drawing.Point(37, 3);
              this.txtPrefix.Name = "txtPrefix";
              this.txtPrefix.Size = new System.Drawing.Size(102, 20);
              this.txtPrefix.TabIndex = 23;
              this.txtPrefix.TextChanged += new System.EventHandler(this.txtPrefix_TextChanged);
              // 
              // label4
              // 
              this.label4.Location = new System.Drawing.Point(3, 6);
              this.label4.Name = "label4";
              this.label4.Size = new System.Drawing.Size(57, 18);
              this.label4.TabIndex = 22;
              this.label4.Text = "Prefix";
              // 
              // chkFieldNames
              // 
              this.chkFieldNames.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
              this.chkFieldNames.Checked = true;
              this.chkFieldNames.CheckState = System.Windows.Forms.CheckState.Checked;
              this.chkFieldNames.Location = new System.Drawing.Point(6, 30);
              this.chkFieldNames.Name = "chkFieldNames";
              this.chkFieldNames.Size = new System.Drawing.Size(130, 24);
              this.chkFieldNames.TabIndex = 21;
              this.chkFieldNames.Text = "Append field names";
              this.chkFieldNames.CheckedChanged += new System.EventHandler(this.chkFieldNames_CheckedChanged);
              // 
              // cboLogName
              // 
              this.cboLogName.Location = new System.Drawing.Point(332, 3);
              this.cboLogName.Name = "cboLogName";
              this.cboLogName.Size = new System.Drawing.Size(121, 21);
              this.cboLogName.TabIndex = 20;
              this.cboLogName.Text = "Application";
              this.cboLogName.DropDown += new System.EventHandler(this.cboLogName_DropDown_1);
              this.cboLogName.SelectedIndexChanged += new System.EventHandler(this.cboLogName_SelectedIndexChanged);
              // 
              // txtIntervall
              // 
              this.txtIntervall.Location = new System.Drawing.Point(223, 32);
              this.txtIntervall.Name = "txtIntervall";
              this.txtIntervall.Size = new System.Drawing.Size(43, 20);
              this.txtIntervall.TabIndex = 19;
              this.txtIntervall.Text = "3000";
              this.txtIntervall.TextChanged += new System.EventHandler(this.txtIntervall_TextChanged);
              // 
              // label3
              // 
              this.label3.Location = new System.Drawing.Point(134, 35);
              this.label3.Name = "label3";
              this.label3.Size = new System.Drawing.Size(96, 18);
              this.label3.TabIndex = 18;
              this.label3.Text = "Poll intervall (ms)";
              // 
              // label2
              // 
              this.label2.Location = new System.Drawing.Point(274, 6);
              this.label2.Name = "label2";
              this.label2.Size = new System.Drawing.Size(57, 18);
              this.label2.TabIndex = 17;
              this.label2.Text = "Log name";
              // 
              // txtHost
              // 
  
gt:             this.txtHost.Location = new System.Drawing.Point(189, 4);