wfrm_Logging.cs
上传用户:horngjaan
上传日期:2009-12-12
资源大小:2882k
文件大小:13k
源码类别:

Email服务器

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Drawing;
  4. using System.Collections;
  5. using System.ComponentModel;
  6. using System.Windows.Forms;
  7. namespace LumiSoft.MailServer
  8. {
  9. /// <summary>
  10. /// Summary description for Logging.
  11. /// </summary>
  12. public class wfrm_Logging : System.Windows.Forms.Form
  13. {
  14. private LumiSoft.UI.Controls.WCheckBox.WCheckBox m_pLogSMTPCmds;
  15. private LumiSoft.UI.Controls.WCheckBox.WCheckBox m_pLogPOP3Cmds;
  16. private LumiSoft.UI.Controls.WLabel mt_logSMTP;
  17. private LumiSoft.UI.Controls.WLabel mt_logPOP3;
  18. private LumiSoft.UI.Controls.WButton m_pSave;
  19. private LumiSoft.UI.Controls.WLabel mt_path1;
  20. private LumiSoft.UI.Controls.WLabel mt_path2;
  21. private LumiSoft.UI.Controls.WEditBox m_pSMTPpath;
  22. private LumiSoft.UI.Controls.WEditBox m_pPOP3path;
  23. private LumiSoft.UI.Controls.WEditBox m_pServerLogPath;
  24. private LumiSoft.UI.Controls.WLabel wLabel1;
  25. private LumiSoft.UI.Controls.WLabel wLabel2;
  26. private LumiSoft.UI.Controls.WCheckBox.WCheckBox m_pLogServerEvents;
  27. /// <summary>
  28. /// Required designer variable.
  29. /// </summary>
  30. private System.ComponentModel.Container components = null;
  31. private DataSet ds = null;
  32. /// <summary>
  33. /// Default constructor.
  34. /// </summary>
  35. /// <param name="dsSettings"></param>
  36. public wfrm_Logging(DataSet dsSettings)
  37. {
  38. //
  39. // Required for Windows Form Designer support
  40. //
  41. InitializeComponent();
  42. //
  43. // TODO: Add any constructor code after InitializeComponent call
  44. //
  45. try
  46. {
  47. ds = dsSettings;
  48.                 RefreshFrom();
  49. }
  50. catch(Exception x)
  51. {
  52. wfrm_Error frm = new wfrm_Error(x,new System.Diagnostics.StackTrace());
  53. frm.ShowDialog(this);
  54. }
  55. }
  56. #region function Dispose
  57. /// <summary>
  58. /// Clean up any resources being used.
  59. /// </summary>
  60. protected override void Dispose( bool disposing )
  61. {
  62. if( disposing )
  63. {
  64. if(components != null)
  65. {
  66. components.Dispose();
  67. }
  68. }
  69. base.Dispose( disposing );
  70. }
  71. #endregion
  72. #region Windows Form Designer generated code
  73. /// <summary>
  74. /// Required method for Designer support - do not modify
  75. /// the contents of this method with the code editor.
  76. /// </summary>
  77. private void InitializeComponent()
  78. {
  79. this.m_pLogSMTPCmds = new LumiSoft.UI.Controls.WCheckBox.WCheckBox();
  80. this.m_pLogPOP3Cmds = new LumiSoft.UI.Controls.WCheckBox.WCheckBox();
  81. this.mt_logSMTP = new LumiSoft.UI.Controls.WLabel();
  82. this.mt_logPOP3 = new LumiSoft.UI.Controls.WLabel();
  83. this.m_pSave = new LumiSoft.UI.Controls.WButton();
  84. this.mt_path1 = new LumiSoft.UI.Controls.WLabel();
  85. this.mt_path2 = new LumiSoft.UI.Controls.WLabel();
  86. this.m_pSMTPpath = new LumiSoft.UI.Controls.WEditBox();
  87. this.m_pPOP3path = new LumiSoft.UI.Controls.WEditBox();
  88. this.m_pServerLogPath = new LumiSoft.UI.Controls.WEditBox();
  89. this.wLabel1 = new LumiSoft.UI.Controls.WLabel();
  90. this.wLabel2 = new LumiSoft.UI.Controls.WLabel();
  91. this.m_pLogServerEvents = new LumiSoft.UI.Controls.WCheckBox.WCheckBox();
  92. ((System.ComponentModel.ISupportInitialize)(this.m_pLogSMTPCmds)).BeginInit();
  93. ((System.ComponentModel.ISupportInitialize)(this.m_pLogPOP3Cmds)).BeginInit();
  94. ((System.ComponentModel.ISupportInitialize)(this.m_pSave)).BeginInit();
  95. ((System.ComponentModel.ISupportInitialize)(this.m_pSMTPpath)).BeginInit();
  96. ((System.ComponentModel.ISupportInitialize)(this.m_pPOP3path)).BeginInit();
  97. ((System.ComponentModel.ISupportInitialize)(this.m_pServerLogPath)).BeginInit();
  98. ((System.ComponentModel.ISupportInitialize)(this.m_pLogServerEvents)).BeginInit();
  99. this.SuspendLayout();
  100. // 
  101. // m_pLogSMTPCmds
  102. // 
  103. this.m_pLogSMTPCmds.Checked = false;
  104. this.m_pLogSMTPCmds.Location = new System.Drawing.Point(24, 24);
  105. this.m_pLogSMTPCmds.Name = "m_pLogSMTPCmds";
  106. this.m_pLogSMTPCmds.ReadOnly = false;
  107. this.m_pLogSMTPCmds.Size = new System.Drawing.Size(16, 22);
  108. this.m_pLogSMTPCmds.TabIndex = 1;
  109. this.m_pLogSMTPCmds.UseStaticViewStyle = true;
  110. this.m_pLogSMTPCmds.CheckedChanged += new System.EventHandler(this.m_pLogSMTPCmds_CheckedChanged);
  111. // 
  112. // m_pLogPOP3Cmds
  113. // 
  114. this.m_pLogPOP3Cmds.Checked = false;
  115. this.m_pLogPOP3Cmds.Location = new System.Drawing.Point(24, 88);
  116. this.m_pLogPOP3Cmds.Name = "m_pLogPOP3Cmds";
  117. this.m_pLogPOP3Cmds.ReadOnly = false;
  118. this.m_pLogPOP3Cmds.Size = new System.Drawing.Size(16, 22);
  119. this.m_pLogPOP3Cmds.TabIndex = 2;
  120. this.m_pLogPOP3Cmds.UseStaticViewStyle = true;
  121. this.m_pLogPOP3Cmds.CheckedChanged += new System.EventHandler(this.m_pLogPOP3Cmds_CheckedChanged);
  122. // 
  123. // mt_logSMTP
  124. // 
  125. this.mt_logSMTP.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  126. this.mt_logSMTP.Location = new System.Drawing.Point(40, 24);
  127. this.mt_logSMTP.Name = "mt_logSMTP";
  128. this.mt_logSMTP.Size = new System.Drawing.Size(150, 24);
  129. this.mt_logSMTP.TabIndex = 6;
  130. this.mt_logSMTP.Text = "Log SMTP commands";
  131. this.mt_logSMTP.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  132. this.mt_logSMTP.UseStaticViewStyle = true;
  133. // 
  134. // mt_logPOP3
  135. // 
  136. this.mt_logPOP3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  137. this.mt_logPOP3.Location = new System.Drawing.Point(40, 88);
  138. this.mt_logPOP3.Name = "mt_logPOP3";
  139. this.mt_logPOP3.Size = new System.Drawing.Size(150, 24);
  140. this.mt_logPOP3.TabIndex = 8;
  141. this.mt_logPOP3.Text = "Log POP3 commands";
  142. this.mt_logPOP3.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  143. this.mt_logPOP3.UseStaticViewStyle = true;
  144. // 
  145. // m_pSave
  146. // 
  147. this.m_pSave.Location = new System.Drawing.Point(536, 16);
  148. this.m_pSave.Name = "m_pSave";
  149. this.m_pSave.Size = new System.Drawing.Size(64, 24);
  150. this.m_pSave.TabIndex = 5;
  151. this.m_pSave.Text = "Save";
  152. this.m_pSave.UseStaticViewStyle = true;
  153. this.m_pSave.ButtonPressed += new LumiSoft.UI.Controls.ButtonPressedEventHandler(this.m_pSave_Click);
  154. // 
  155. // mt_path1
  156. // 
  157. this.mt_path1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  158. this.mt_path1.Location = new System.Drawing.Point(24, 48);
  159. this.mt_path1.Name = "mt_path1";
  160. this.mt_path1.Size = new System.Drawing.Size(62, 24);
  161. this.mt_path1.TabIndex = 7;
  162. this.mt_path1.Text = "Path:";
  163. this.mt_path1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  164. this.mt_path1.UseStaticViewStyle = true;
  165. // 
  166. // mt_path2
  167. // 
  168. this.mt_path2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  169. this.mt_path2.Location = new System.Drawing.Point(24, 112);
  170. this.mt_path2.Name = "mt_path2";
  171. this.mt_path2.Size = new System.Drawing.Size(62, 24);
  172. this.mt_path2.TabIndex = 9;
  173. this.mt_path2.Text = "Path:";
  174. this.mt_path2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  175. this.mt_path2.UseStaticViewStyle = true;
  176. // 
  177. // m_pSMTPpath
  178. // 
  179. this.m_pSMTPpath.DecimalPlaces = 2;
  180. this.m_pSMTPpath.DecMaxValue = 999999999;
  181. this.m_pSMTPpath.DecMinValue = -999999999;
  182. this.m_pSMTPpath.Location = new System.Drawing.Point(88, 48);
  183. this.m_pSMTPpath.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
  184. this.m_pSMTPpath.MaxLength = 32767;
  185. this.m_pSMTPpath.Multiline = false;
  186. this.m_pSMTPpath.Name = "m_pSMTPpath";
  187. this.m_pSMTPpath.PasswordChar = '';
  188. this.m_pSMTPpath.ReadOnly = true;
  189. this.m_pSMTPpath.Size = new System.Drawing.Size(368, 20);
  190. this.m_pSMTPpath.TabIndex = 3;
  191. this.m_pSMTPpath.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  192. this.m_pSMTPpath.UseStaticViewStyle = true;
  193. // 
  194. // m_pPOP3path
  195. // 
  196. this.m_pPOP3path.DecimalPlaces = 2;
  197. this.m_pPOP3path.DecMaxValue = 999999999;
  198. this.m_pPOP3path.DecMinValue = -999999999;
  199. this.m_pPOP3path.Location = new System.Drawing.Point(88, 112);
  200. this.m_pPOP3path.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
  201. this.m_pPOP3path.MaxLength = 32767;
  202. this.m_pPOP3path.Multiline = false;
  203. this.m_pPOP3path.Name = "m_pPOP3path";
  204. this.m_pPOP3path.PasswordChar = '';
  205. this.m_pPOP3path.ReadOnly = true;
  206. this.m_pPOP3path.Size = new System.Drawing.Size(368, 20);
  207. this.m_pPOP3path.TabIndex = 4;
  208. this.m_pPOP3path.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  209. this.m_pPOP3path.UseStaticViewStyle = true;
  210. // 
  211. // m_pServerLogPath
  212. // 
  213. this.m_pServerLogPath.DecimalPlaces = 2;
  214. this.m_pServerLogPath.DecMaxValue = 999999999;
  215. this.m_pServerLogPath.DecMinValue = -999999999;
  216. this.m_pServerLogPath.Location = new System.Drawing.Point(88, 192);
  217. this.m_pServerLogPath.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
  218. this.m_pServerLogPath.MaxLength = 32767;
  219. this.m_pServerLogPath.Multiline = false;
  220. this.m_pServerLogPath.Name = "m_pServerLogPath";
  221. this.m_pServerLogPath.PasswordChar = '';
  222. this.m_pServerLogPath.ReadOnly = true;
  223. this.m_pServerLogPath.Size = new System.Drawing.Size(368, 20);
  224. this.m_pServerLogPath.TabIndex = 11;
  225. this.m_pServerLogPath.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  226. this.m_pServerLogPath.UseStaticViewStyle = true;
  227. // 
  228. // wLabel1
  229. // 
  230. this.wLabel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  231. this.wLabel1.Location = new System.Drawing.Point(24, 192);
  232. this.wLabel1.Name = "wLabel1";
  233. this.wLabel1.Size = new System.Drawing.Size(62, 24);
  234. this.wLabel1.TabIndex = 13;
  235. this.wLabel1.Text = "Path:";
  236. this.wLabel1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  237. this.wLabel1.UseStaticViewStyle = true;
  238. // 
  239. // wLabel2
  240. // 
  241. this.wLabel2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  242. this.wLabel2.Location = new System.Drawing.Point(40, 168);
  243. this.wLabel2.Name = "wLabel2";
  244. this.wLabel2.Size = new System.Drawing.Size(150, 24);
  245. this.wLabel2.TabIndex = 12;
  246. this.wLabel2.Text = "Log server events";
  247. this.wLabel2.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  248. this.wLabel2.UseStaticViewStyle = true;
  249. // 
  250. // m_pLogServerEvents
  251. // 
  252. this.m_pLogServerEvents.Checked = true;
  253. this.m_pLogServerEvents.Location = new System.Drawing.Point(24, 168);
  254. this.m_pLogServerEvents.Name = "m_pLogServerEvents";
  255. this.m_pLogServerEvents.ReadOnly = true;
  256. this.m_pLogServerEvents.Size = new System.Drawing.Size(16, 22);
  257. this.m_pLogServerEvents.TabIndex = 10;
  258. this.m_pLogServerEvents.UseStaticViewStyle = true;
  259. // 
  260. // Logging
  261. // 
  262. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  263. this.ClientSize = new System.Drawing.Size(628, 373);
  264. this.Controls.AddRange(new System.Windows.Forms.Control[] {
  265.   this.m_pServerLogPath,
  266.   this.wLabel1,
  267.   this.wLabel2,
  268.   this.m_pLogServerEvents,
  269.   this.m_pPOP3path,
  270.   this.m_pSMTPpath,
  271.   this.mt_path2,
  272.   this.mt_path1,
  273.   this.m_pSave,
  274.   this.mt_logPOP3,
  275.   this.mt_logSMTP,
  276.   this.m_pLogPOP3Cmds,
  277.   this.m_pLogSMTPCmds});
  278. this.Name = "Logging";
  279. this.Text = "Logging";
  280. ((System.ComponentModel.ISupportInitialize)(this.m_pLogSMTPCmds)).EndInit();
  281. ((System.ComponentModel.ISupportInitialize)(this.m_pLogPOP3Cmds)).EndInit();
  282. ((System.ComponentModel.ISupportInitialize)(this.m_pSave)).EndInit();
  283. ((System.ComponentModel.ISupportInitialize)(this.m_pSMTPpath)).EndInit();
  284. ((System.ComponentModel.ISupportInitialize)(this.m_pPOP3path)).EndInit();
  285. ((System.ComponentModel.ISupportInitialize)(this.m_pServerLogPath)).EndInit();
  286. ((System.ComponentModel.ISupportInitialize)(this.m_pLogServerEvents)).EndInit();
  287. this.ResumeLayout(false);
  288. }
  289. #endregion
  290. #region Events handling
  291. private void m_pLogSMTPCmds_CheckedChanged(object sender, System.EventArgs e)
  292. {
  293. ds.Tables["Settings"].Rows[0]["LogSMTPCmds"] = m_pLogSMTPCmds.Checked;
  294. }
  295. private void m_pLogPOP3Cmds_CheckedChanged(object sender, System.EventArgs e)
  296. {
  297. ds.Tables["Settings"].Rows[0]["LogPOP3Cmds"] = m_pLogPOP3Cmds.Checked;
  298. }
  299. private void m_pSave_Click(object sender, System.EventArgs e)
  300. {
  301. ds.WriteXml(Application.StartupPath + "\Settings\Settings.xml",XmlWriteMode.IgnoreSchema);
  302. }
  303. #endregion
  304. #region function RefreshFrom
  305. public void RefreshFrom()
  306. {
  307. try
  308. {
  309. m_pLogSMTPCmds.Checked = Convert.ToBoolean(ds.Tables["Settings"].Rows[0]["LogSMTPCmds"]);
  310. m_pLogPOP3Cmds.Checked = Convert.ToBoolean(ds.Tables["Settings"].Rows[0]["LogPOP3Cmds"]);
  311. m_pSMTPpath.Text      = Application.StartupPath + "\Logs\SMTP";
  312. m_pPOP3path.Text      = Application.StartupPath + "\Logs\POP3";
  313. m_pServerLogPath.Text = Application.StartupPath + "\Logs\Server";
  314. }
  315. catch(Exception x)
  316. {
  317. MessageBox.Show("Error:" + x.Message);
  318. }
  319. }
  320. #endregion
  321. }
  322. }