wfrm_Logging.cs
上传用户:horngjaan
上传日期:2009-12-12
资源大小:2882k
文件大小:13k
- using System;
- using System.Data;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- namespace LumiSoft.MailServer
- {
- /// <summary>
- /// Summary description for Logging.
- /// </summary>
- public class wfrm_Logging : System.Windows.Forms.Form
- {
- private LumiSoft.UI.Controls.WCheckBox.WCheckBox m_pLogSMTPCmds;
- private LumiSoft.UI.Controls.WCheckBox.WCheckBox m_pLogPOP3Cmds;
- private LumiSoft.UI.Controls.WLabel mt_logSMTP;
- private LumiSoft.UI.Controls.WLabel mt_logPOP3;
- private LumiSoft.UI.Controls.WButton m_pSave;
- private LumiSoft.UI.Controls.WLabel mt_path1;
- private LumiSoft.UI.Controls.WLabel mt_path2;
- private LumiSoft.UI.Controls.WEditBox m_pSMTPpath;
- private LumiSoft.UI.Controls.WEditBox m_pPOP3path;
- private LumiSoft.UI.Controls.WEditBox m_pServerLogPath;
- private LumiSoft.UI.Controls.WLabel wLabel1;
- private LumiSoft.UI.Controls.WLabel wLabel2;
- private LumiSoft.UI.Controls.WCheckBox.WCheckBox m_pLogServerEvents;
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
- private DataSet ds = null;
- /// <summary>
- /// Default constructor.
- /// </summary>
- /// <param name="dsSettings"></param>
- public wfrm_Logging(DataSet dsSettings)
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
- try
- {
- ds = dsSettings;
- RefreshFrom();
- }
- catch(Exception x)
- {
- wfrm_Error frm = new wfrm_Error(x,new System.Diagnostics.StackTrace());
- frm.ShowDialog(this);
- }
- }
- #region function Dispose
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- #endregion
- #region Windows Form 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.m_pLogSMTPCmds = new LumiSoft.UI.Controls.WCheckBox.WCheckBox();
- this.m_pLogPOP3Cmds = new LumiSoft.UI.Controls.WCheckBox.WCheckBox();
- this.mt_logSMTP = new LumiSoft.UI.Controls.WLabel();
- this.mt_logPOP3 = new LumiSoft.UI.Controls.WLabel();
- this.m_pSave = new LumiSoft.UI.Controls.WButton();
- this.mt_path1 = new LumiSoft.UI.Controls.WLabel();
- this.mt_path2 = new LumiSoft.UI.Controls.WLabel();
- this.m_pSMTPpath = new LumiSoft.UI.Controls.WEditBox();
- this.m_pPOP3path = new LumiSoft.UI.Controls.WEditBox();
- this.m_pServerLogPath = new LumiSoft.UI.Controls.WEditBox();
- this.wLabel1 = new LumiSoft.UI.Controls.WLabel();
- this.wLabel2 = new LumiSoft.UI.Controls.WLabel();
- this.m_pLogServerEvents = new LumiSoft.UI.Controls.WCheckBox.WCheckBox();
- ((System.ComponentModel.ISupportInitialize)(this.m_pLogSMTPCmds)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pLogPOP3Cmds)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pSave)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pSMTPpath)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pPOP3path)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pServerLogPath)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pLogServerEvents)).BeginInit();
- this.SuspendLayout();
- //
- // m_pLogSMTPCmds
- //
- this.m_pLogSMTPCmds.Checked = false;
- this.m_pLogSMTPCmds.Location = new System.Drawing.Point(24, 24);
- this.m_pLogSMTPCmds.Name = "m_pLogSMTPCmds";
- this.m_pLogSMTPCmds.ReadOnly = false;
- this.m_pLogSMTPCmds.Size = new System.Drawing.Size(16, 22);
- this.m_pLogSMTPCmds.TabIndex = 1;
- this.m_pLogSMTPCmds.UseStaticViewStyle = true;
- this.m_pLogSMTPCmds.CheckedChanged += new System.EventHandler(this.m_pLogSMTPCmds_CheckedChanged);
- //
- // m_pLogPOP3Cmds
- //
- this.m_pLogPOP3Cmds.Checked = false;
- this.m_pLogPOP3Cmds.Location = new System.Drawing.Point(24, 88);
- this.m_pLogPOP3Cmds.Name = "m_pLogPOP3Cmds";
- this.m_pLogPOP3Cmds.ReadOnly = false;
- this.m_pLogPOP3Cmds.Size = new System.Drawing.Size(16, 22);
- this.m_pLogPOP3Cmds.TabIndex = 2;
- this.m_pLogPOP3Cmds.UseStaticViewStyle = true;
- this.m_pLogPOP3Cmds.CheckedChanged += new System.EventHandler(this.m_pLogPOP3Cmds_CheckedChanged);
- //
- // mt_logSMTP
- //
- this.mt_logSMTP.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.mt_logSMTP.Location = new System.Drawing.Point(40, 24);
- this.mt_logSMTP.Name = "mt_logSMTP";
- this.mt_logSMTP.Size = new System.Drawing.Size(150, 24);
- this.mt_logSMTP.TabIndex = 6;
- this.mt_logSMTP.Text = "Log SMTP commands";
- this.mt_logSMTP.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.mt_logSMTP.UseStaticViewStyle = true;
- //
- // mt_logPOP3
- //
- this.mt_logPOP3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.mt_logPOP3.Location = new System.Drawing.Point(40, 88);
- this.mt_logPOP3.Name = "mt_logPOP3";
- this.mt_logPOP3.Size = new System.Drawing.Size(150, 24);
- this.mt_logPOP3.TabIndex = 8;
- this.mt_logPOP3.Text = "Log POP3 commands";
- this.mt_logPOP3.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.mt_logPOP3.UseStaticViewStyle = true;
- //
- // m_pSave
- //
- this.m_pSave.Location = new System.Drawing.Point(536, 16);
- this.m_pSave.Name = "m_pSave";
- this.m_pSave.Size = new System.Drawing.Size(64, 24);
- this.m_pSave.TabIndex = 5;
- this.m_pSave.Text = "Save";
- this.m_pSave.UseStaticViewStyle = true;
- this.m_pSave.ButtonPressed += new LumiSoft.UI.Controls.ButtonPressedEventHandler(this.m_pSave_Click);
- //
- // mt_path1
- //
- this.mt_path1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.mt_path1.Location = new System.Drawing.Point(24, 48);
- this.mt_path1.Name = "mt_path1";
- this.mt_path1.Size = new System.Drawing.Size(62, 24);
- this.mt_path1.TabIndex = 7;
- this.mt_path1.Text = "Path:";
- this.mt_path1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this.mt_path1.UseStaticViewStyle = true;
- //
- // mt_path2
- //
- this.mt_path2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.mt_path2.Location = new System.Drawing.Point(24, 112);
- this.mt_path2.Name = "mt_path2";
- this.mt_path2.Size = new System.Drawing.Size(62, 24);
- this.mt_path2.TabIndex = 9;
- this.mt_path2.Text = "Path:";
- this.mt_path2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this.mt_path2.UseStaticViewStyle = true;
- //
- // m_pSMTPpath
- //
- this.m_pSMTPpath.DecimalPlaces = 2;
- this.m_pSMTPpath.DecMaxValue = 999999999;
- this.m_pSMTPpath.DecMinValue = -999999999;
- this.m_pSMTPpath.Location = new System.Drawing.Point(88, 48);
- this.m_pSMTPpath.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
- this.m_pSMTPpath.MaxLength = 32767;
- this.m_pSMTPpath.Multiline = false;
- this.m_pSMTPpath.Name = "m_pSMTPpath";
- this.m_pSMTPpath.PasswordChar = ' ';
- this.m_pSMTPpath.ReadOnly = true;
- this.m_pSMTPpath.Size = new System.Drawing.Size(368, 20);
- this.m_pSMTPpath.TabIndex = 3;
- this.m_pSMTPpath.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.m_pSMTPpath.UseStaticViewStyle = true;
- //
- // m_pPOP3path
- //
- this.m_pPOP3path.DecimalPlaces = 2;
- this.m_pPOP3path.DecMaxValue = 999999999;
- this.m_pPOP3path.DecMinValue = -999999999;
- this.m_pPOP3path.Location = new System.Drawing.Point(88, 112);
- this.m_pPOP3path.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
- this.m_pPOP3path.MaxLength = 32767;
- this.m_pPOP3path.Multiline = false;
- this.m_pPOP3path.Name = "m_pPOP3path";
- this.m_pPOP3path.PasswordChar = ' ';
- this.m_pPOP3path.ReadOnly = true;
- this.m_pPOP3path.Size = new System.Drawing.Size(368, 20);
- this.m_pPOP3path.TabIndex = 4;
- this.m_pPOP3path.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.m_pPOP3path.UseStaticViewStyle = true;
- //
- // m_pServerLogPath
- //
- this.m_pServerLogPath.DecimalPlaces = 2;
- this.m_pServerLogPath.DecMaxValue = 999999999;
- this.m_pServerLogPath.DecMinValue = -999999999;
- this.m_pServerLogPath.Location = new System.Drawing.Point(88, 192);
- this.m_pServerLogPath.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
- this.m_pServerLogPath.MaxLength = 32767;
- this.m_pServerLogPath.Multiline = false;
- this.m_pServerLogPath.Name = "m_pServerLogPath";
- this.m_pServerLogPath.PasswordChar = ' ';
- this.m_pServerLogPath.ReadOnly = true;
- this.m_pServerLogPath.Size = new System.Drawing.Size(368, 20);
- this.m_pServerLogPath.TabIndex = 11;
- this.m_pServerLogPath.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.m_pServerLogPath.UseStaticViewStyle = true;
- //
- // wLabel1
- //
- this.wLabel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.wLabel1.Location = new System.Drawing.Point(24, 192);
- this.wLabel1.Name = "wLabel1";
- this.wLabel1.Size = new System.Drawing.Size(62, 24);
- this.wLabel1.TabIndex = 13;
- this.wLabel1.Text = "Path:";
- this.wLabel1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this.wLabel1.UseStaticViewStyle = true;
- //
- // wLabel2
- //
- this.wLabel2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.wLabel2.Location = new System.Drawing.Point(40, 168);
- this.wLabel2.Name = "wLabel2";
- this.wLabel2.Size = new System.Drawing.Size(150, 24);
- this.wLabel2.TabIndex = 12;
- this.wLabel2.Text = "Log server events";
- this.wLabel2.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- this.wLabel2.UseStaticViewStyle = true;
- //
- // m_pLogServerEvents
- //
- this.m_pLogServerEvents.Checked = true;
- this.m_pLogServerEvents.Location = new System.Drawing.Point(24, 168);
- this.m_pLogServerEvents.Name = "m_pLogServerEvents";
- this.m_pLogServerEvents.ReadOnly = true;
- this.m_pLogServerEvents.Size = new System.Drawing.Size(16, 22);
- this.m_pLogServerEvents.TabIndex = 10;
- this.m_pLogServerEvents.UseStaticViewStyle = true;
- //
- // Logging
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(628, 373);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.m_pServerLogPath,
- this.wLabel1,
- this.wLabel2,
- this.m_pLogServerEvents,
- this.m_pPOP3path,
- this.m_pSMTPpath,
- this.mt_path2,
- this.mt_path1,
- this.m_pSave,
- this.mt_logPOP3,
- this.mt_logSMTP,
- this.m_pLogPOP3Cmds,
- this.m_pLogSMTPCmds});
- this.Name = "Logging";
- this.Text = "Logging";
- ((System.ComponentModel.ISupportInitialize)(this.m_pLogSMTPCmds)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pLogPOP3Cmds)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pSave)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pSMTPpath)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pPOP3path)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pServerLogPath)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.m_pLogServerEvents)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- #region Events handling
- private void m_pLogSMTPCmds_CheckedChanged(object sender, System.EventArgs e)
- {
- ds.Tables["Settings"].Rows[0]["LogSMTPCmds"] = m_pLogSMTPCmds.Checked;
- }
- private void m_pLogPOP3Cmds_CheckedChanged(object sender, System.EventArgs e)
- {
- ds.Tables["Settings"].Rows[0]["LogPOP3Cmds"] = m_pLogPOP3Cmds.Checked;
- }
- private void m_pSave_Click(object sender, System.EventArgs e)
- {
- ds.WriteXml(Application.StartupPath + "\Settings\Settings.xml",XmlWriteMode.IgnoreSchema);
- }
- #endregion
- #region function RefreshFrom
- public void RefreshFrom()
- {
- try
- {
- m_pLogSMTPCmds.Checked = Convert.ToBoolean(ds.Tables["Settings"].Rows[0]["LogSMTPCmds"]);
- m_pLogPOP3Cmds.Checked = Convert.ToBoolean(ds.Tables["Settings"].Rows[0]["LogPOP3Cmds"]);
- m_pSMTPpath.Text = Application.StartupPath + "\Logs\SMTP";
- m_pPOP3path.Text = Application.StartupPath + "\Logs\POP3";
- m_pServerLogPath.Text = Application.StartupPath + "\Logs\Server";
- }
- catch(Exception x)
- {
- MessageBox.Show("Error:" + x.Message);
- }
- }
- #endregion
-
- }
- }