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

Email服务器

开发平台:

C#

  1. using System;
  2. using System.IO;
  3. using System.Drawing;
  4. using System.Collections;
  5. using System.ComponentModel;
  6. using System.Windows.Forms;
  7. using System.Data;
  8. using System.Net;
  9. namespace LumiSoft.MailServer
  10. {
  11. /// <summary>
  12. /// Summary description for Delivery.
  13. /// </summary>
  14. public class wfrm_Delivery : System.Windows.Forms.Form
  15. {
  16. private LumiSoft.UI.Controls.WEditBox m_pSecDNS;
  17. private LumiSoft.UI.Controls.WEditBox m_pPriDNS;
  18. private LumiSoft.UI.Controls.WEditBox m_pSmartHost;
  19. private LumiSoft.UI.Controls.WLabel mt_secdns;
  20. private LumiSoft.UI.Controls.WLabel mt_pridns;
  21. private LumiSoft.UI.Controls.WLabel mt_smarthost;
  22. private System.Windows.Forms.RadioButton m_pDNS;
  23. private System.Windows.Forms.RadioButton m_pUseSmartHost;
  24. private LumiSoft.UI.Controls.WButton m_pSave;
  25. private LumiSoft.UI.Controls.WLabel mt_maxthreads;
  26. private LumiSoft.UI.Controls.WSpinEdit m_pMaxThreads;
  27. private LumiSoft.UI.Controls.WSpinEdit m_pRelayInterval;
  28. private LumiSoft.UI.Controls.WLabel mt_RelayInterval;
  29. private LumiSoft.UI.Controls.WSpinEdit m_pRelayRetryInterval;
  30. private LumiSoft.UI.Controls.WLabel mt_RelayRetryInterval;
  31. private LumiSoft.UI.Controls.WLabel wLabel1;
  32. private LumiSoft.UI.Controls.WLabel wLabel2;
  33. private LumiSoft.UI.Controls.WLabel wLabel3;
  34. private LumiSoft.UI.Controls.WLabel wLabel4;
  35. private LumiSoft.UI.Controls.WLabel wLabel5;
  36. private LumiSoft.UI.Controls.WLabel wLabel6;
  37. private LumiSoft.UI.Controls.WSpinEdit m_pUndelivered;
  38. private LumiSoft.UI.Controls.WSpinEdit m_pUndeliveredWarning;
  39. private LumiSoft.UI.Controls.WButton m_UndelWarningText;
  40. private LumiSoft.UI.Controls.WButton m_pUndeliveredText;
  41. /// <summary>
  42. /// Required designer variable.
  43. /// </summary>
  44. private System.ComponentModel.Container components = null;
  45. private DataSet dsSettings = null;
  46. /// <summary>
  47. /// Default constructor.
  48. /// </summary>
  49. /// <param name="ds"></param>
  50. public wfrm_Delivery(DataSet ds)
  51. {
  52. //
  53. // Required for Windows Form Designer support
  54. //
  55. InitializeComponent();
  56. //
  57. // TODO: Add any constructor code after InitializeComponent call
  58. //
  59. try
  60. {
  61. dsSettings = ds;
  62. RefreshForm();
  63. RefreshRadioBtns();
  64. }
  65. catch(Exception x)
  66. {
  67. wfrm_Error frm = new wfrm_Error(x,new System.Diagnostics.StackTrace());
  68. frm.ShowDialog(this);
  69. }
  70. }
  71. #region function Dispose
  72. /// <summary>
  73. /// Clean up any resources being used.
  74. /// </summary>
  75. protected override void Dispose( bool disposing )
  76. {
  77. if( disposing )
  78. {
  79. if(components != null)
  80. {
  81. components.Dispose();
  82. }
  83. }
  84. base.Dispose( disposing );
  85. }
  86. #endregion
  87. #region Windows Form Designer generated code
  88. /// <summary>
  89. /// Required method for Designer support - do not modify
  90. /// the contents of this method with the code editor.
  91. /// </summary>
  92. private void InitializeComponent()
  93. {
  94. this.m_pSecDNS = new LumiSoft.UI.Controls.WEditBox();
  95. this.m_pPriDNS = new LumiSoft.UI.Controls.WEditBox();
  96. this.m_pSmartHost = new LumiSoft.UI.Controls.WEditBox();
  97. this.mt_secdns = new LumiSoft.UI.Controls.WLabel();
  98. this.mt_pridns = new LumiSoft.UI.Controls.WLabel();
  99. this.mt_smarthost = new LumiSoft.UI.Controls.WLabel();
  100. this.m_pDNS = new System.Windows.Forms.RadioButton();
  101. this.m_pUseSmartHost = new System.Windows.Forms.RadioButton();
  102. this.mt_maxthreads = new LumiSoft.UI.Controls.WLabel();
  103. this.m_pMaxThreads = new LumiSoft.UI.Controls.WSpinEdit();
  104. this.m_pSave = new LumiSoft.UI.Controls.WButton();
  105. this.m_pRelayInterval = new LumiSoft.UI.Controls.WSpinEdit();
  106. this.mt_RelayInterval = new LumiSoft.UI.Controls.WLabel();
  107. this.m_pRelayRetryInterval = new LumiSoft.UI.Controls.WSpinEdit();
  108. this.mt_RelayRetryInterval = new LumiSoft.UI.Controls.WLabel();
  109. this.m_pUndeliveredWarning = new LumiSoft.UI.Controls.WSpinEdit();
  110. this.wLabel1 = new LumiSoft.UI.Controls.WLabel();
  111. this.m_pUndelivered = new LumiSoft.UI.Controls.WSpinEdit();
  112. this.wLabel2 = new LumiSoft.UI.Controls.WLabel();
  113. this.wLabel3 = new LumiSoft.UI.Controls.WLabel();
  114. this.wLabel4 = new LumiSoft.UI.Controls.WLabel();
  115. this.wLabel5 = new LumiSoft.UI.Controls.WLabel();
  116. this.wLabel6 = new LumiSoft.UI.Controls.WLabel();
  117. this.m_UndelWarningText = new LumiSoft.UI.Controls.WButton();
  118. this.m_pUndeliveredText = new LumiSoft.UI.Controls.WButton();
  119. ((System.ComponentModel.ISupportInitialize)(this.m_pSecDNS)).BeginInit();
  120. ((System.ComponentModel.ISupportInitialize)(this.m_pPriDNS)).BeginInit();
  121. ((System.ComponentModel.ISupportInitialize)(this.m_pSmartHost)).BeginInit();
  122. ((System.ComponentModel.ISupportInitialize)(this.m_pMaxThreads)).BeginInit();
  123. ((System.ComponentModel.ISupportInitialize)(this.m_pSave)).BeginInit();
  124. ((System.ComponentModel.ISupportInitialize)(this.m_pRelayInterval)).BeginInit();
  125. ((System.ComponentModel.ISupportInitialize)(this.m_pRelayRetryInterval)).BeginInit();
  126. ((System.ComponentModel.ISupportInitialize)(this.m_pUndeliveredWarning)).BeginInit();
  127. ((System.ComponentModel.ISupportInitialize)(this.m_pUndelivered)).BeginInit();
  128. ((System.ComponentModel.ISupportInitialize)(this.m_UndelWarningText)).BeginInit();
  129. ((System.ComponentModel.ISupportInitialize)(this.m_pUndeliveredText)).BeginInit();
  130. this.SuspendLayout();
  131. // 
  132. // m_pSecDNS
  133. // 
  134. this.m_pSecDNS.DecimalPlaces = 2;
  135. this.m_pSecDNS.DecMaxValue = new System.Decimal(new int[] {
  136.   999999999,
  137.   0,
  138.   0,
  139.   0});
  140. this.m_pSecDNS.DecMinValue = new System.Decimal(new int[] {
  141.   999999999,
  142.   0,
  143.   0,
  144.   -2147483648});
  145. this.m_pSecDNS.Lines = new string[0];
  146. this.m_pSecDNS.Location = new System.Drawing.Point(504, 64);
  147. this.m_pSecDNS.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
  148. this.m_pSecDNS.MaxLength = 32767;
  149. this.m_pSecDNS.Multiline = false;
  150. this.m_pSecDNS.Name = "m_pSecDNS";
  151. this.m_pSecDNS.PasswordChar = '';
  152. this.m_pSecDNS.ReadOnly = false;
  153. this.m_pSecDNS.ScrollBars = System.Windows.Forms.ScrollBars.None;
  154. this.m_pSecDNS.Size = new System.Drawing.Size(100, 20);
  155. this.m_pSecDNS.TabIndex = 11;
  156. this.m_pSecDNS.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  157. this.m_pSecDNS.UseStaticViewStyle = true;
  158. // 
  159. // m_pPriDNS
  160. // 
  161. this.m_pPriDNS.DecimalPlaces = 2;
  162. this.m_pPriDNS.DecMaxValue = new System.Decimal(new int[] {
  163.   999999999,
  164.   0,
  165.   0,
  166.   0});
  167. this.m_pPriDNS.DecMinValue = new System.Decimal(new int[] {
  168.   999999999,
  169.   0,
  170.   0,
  171.   -2147483648});
  172. this.m_pPriDNS.Lines = new string[0];
  173. this.m_pPriDNS.Location = new System.Drawing.Point(304, 64);
  174. this.m_pPriDNS.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
  175. this.m_pPriDNS.MaxLength = 32767;
  176. this.m_pPriDNS.Multiline = false;
  177. this.m_pPriDNS.Name = "m_pPriDNS";
  178. this.m_pPriDNS.PasswordChar = '';
  179. this.m_pPriDNS.ReadOnly = false;
  180. this.m_pPriDNS.ScrollBars = System.Windows.Forms.ScrollBars.None;
  181. this.m_pPriDNS.Size = new System.Drawing.Size(100, 20);
  182. this.m_pPriDNS.TabIndex = 10;
  183. this.m_pPriDNS.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  184. this.m_pPriDNS.UseStaticViewStyle = true;
  185. // 
  186. // m_pSmartHost
  187. // 
  188. this.m_pSmartHost.DecimalPlaces = 2;
  189. this.m_pSmartHost.DecMaxValue = new System.Decimal(new int[] {
  190.  999999999,
  191.  0,
  192.  0,
  193.  0});
  194. this.m_pSmartHost.DecMinValue = new System.Decimal(new int[] {
  195.  999999999,
  196.  0,
  197.  0,
  198.  -2147483648});
  199. this.m_pSmartHost.Lines = new string[0];
  200. this.m_pSmartHost.Location = new System.Drawing.Point(304, 40);
  201. this.m_pSmartHost.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Text;
  202. this.m_pSmartHost.MaxLength = 32767;
  203. this.m_pSmartHost.Multiline = false;
  204. this.m_pSmartHost.Name = "m_pSmartHost";
  205. this.m_pSmartHost.PasswordChar = '';
  206. this.m_pSmartHost.ReadOnly = false;
  207. this.m_pSmartHost.ScrollBars = System.Windows.Forms.ScrollBars.None;
  208. this.m_pSmartHost.Size = new System.Drawing.Size(100, 20);
  209. this.m_pSmartHost.TabIndex = 9;
  210. this.m_pSmartHost.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  211. this.m_pSmartHost.UseStaticViewStyle = true;
  212. // 
  213. // mt_secdns
  214. // 
  215. this.mt_secdns.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  216. this.mt_secdns.Location = new System.Drawing.Point(408, 64);
  217. this.mt_secdns.Name = "mt_secdns";
  218. this.mt_secdns.Size = new System.Drawing.Size(94, 24);
  219. this.mt_secdns.TabIndex = 8;
  220. this.mt_secdns.Text = "Secondary DNS";
  221. this.mt_secdns.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  222. this.mt_secdns.UseStaticViewStyle = true;
  223. // 
  224. // mt_pridns
  225. // 
  226. this.mt_pridns.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  227. this.mt_pridns.Location = new System.Drawing.Point(216, 64);
  228. this.mt_pridns.Name = "mt_pridns";
  229. this.mt_pridns.Size = new System.Drawing.Size(86, 24);
  230. this.mt_pridns.TabIndex = 7;
  231. this.mt_pridns.Text = "Primary DNS";
  232. this.mt_pridns.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  233. this.mt_pridns.UseStaticViewStyle = true;
  234. // 
  235. // mt_smarthost
  236. // 
  237. this.mt_smarthost.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  238. this.mt_smarthost.Location = new System.Drawing.Point(216, 40);
  239. this.mt_smarthost.Name = "mt_smarthost";
  240. this.mt_smarthost.Size = new System.Drawing.Size(86, 24);
  241. this.mt_smarthost.TabIndex = 6;
  242. this.mt_smarthost.Text = "SmartHost";
  243. this.mt_smarthost.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  244. this.mt_smarthost.UseStaticViewStyle = true;
  245. // 
  246. // m_pDNS
  247. // 
  248. this.m_pDNS.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
  249. this.m_pDNS.Location = new System.Drawing.Point(32, 64);
  250. this.m_pDNS.Name = "m_pDNS";
  251. this.m_pDNS.Size = new System.Drawing.Size(176, 24);
  252. this.m_pDNS.TabIndex = 1;
  253. this.m_pDNS.Text = "Send mails directly using DNS";
  254. this.m_pDNS.CheckedChanged += new System.EventHandler(this.m_pDNS_CheckedChanged);
  255. // 
  256. // m_pUseSmartHost
  257. // 
  258. this.m_pUseSmartHost.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
  259. this.m_pUseSmartHost.Location = new System.Drawing.Point(32, 40);
  260. this.m_pUseSmartHost.Name = "m_pUseSmartHost";
  261. this.m_pUseSmartHost.Size = new System.Drawing.Size(176, 24);
  262. this.m_pUseSmartHost.TabIndex = 0;
  263. this.m_pUseSmartHost.Text = "Send mails through SmartHost";
  264. this.m_pUseSmartHost.CheckedChanged += new System.EventHandler(this.m_pDNS_CheckedChanged);
  265. // 
  266. // mt_maxthreads
  267. // 
  268. this.mt_maxthreads.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  269. this.mt_maxthreads.Location = new System.Drawing.Point(24, 120);
  270. this.mt_maxthreads.Name = "mt_maxthreads";
  271. this.mt_maxthreads.Size = new System.Drawing.Size(150, 24);
  272. this.mt_maxthreads.TabIndex = 12;
  273. this.mt_maxthreads.Text = "Max. Delivery Threads";
  274. this.mt_maxthreads.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  275. this.mt_maxthreads.UseStaticViewStyle = true;
  276. // 
  277. // m_pMaxThreads
  278. // 
  279. this.m_pMaxThreads.BackColor = System.Drawing.Color.White;
  280. this.m_pMaxThreads.ButtonsAlign = LumiSoft.UI.Controls.LeftRight.Right;
  281. this.m_pMaxThreads.DecimalPlaces = 0;
  282. this.m_pMaxThreads.DecMaxValue = new System.Decimal(new int[] {
  283.   999999999,
  284.   0,
  285.   0,
  286.   0});
  287. this.m_pMaxThreads.DecMinValue = new System.Decimal(new int[] {
  288.   999999999,
  289.   0,
  290.   0,
  291.   -2147483648});
  292. this.m_pMaxThreads.DecValue = new System.Decimal(new int[] {
  293.    0,
  294.    0,
  295.    0,
  296.    0});
  297. this.m_pMaxThreads.Location = new System.Drawing.Point(176, 120);
  298. this.m_pMaxThreads.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Numeric;
  299. this.m_pMaxThreads.MaxLength = 32767;
  300. this.m_pMaxThreads.Name = "m_pMaxThreads";
  301. this.m_pMaxThreads.ReadOnly = false;
  302. this.m_pMaxThreads.Size = new System.Drawing.Size(64, 20);
  303. this.m_pMaxThreads.TabIndex = 15;
  304. this.m_pMaxThreads.Text = "0";
  305. this.m_pMaxThreads.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  306. this.m_pMaxThreads.UseStaticViewStyle = false;
  307. this.m_pMaxThreads.ViewStyle.EditReadOnlyColor = System.Drawing.Color.White;
  308. // 
  309. // m_pSave
  310. // 
  311. this.m_pSave.Location = new System.Drawing.Point(536, 16);
  312. this.m_pSave.Name = "m_pSave";
  313. this.m_pSave.Size = new System.Drawing.Size(64, 24);
  314. this.m_pSave.TabIndex = 18;
  315. this.m_pSave.Text = "Save";
  316. this.m_pSave.UseStaticViewStyle = false;
  317. this.m_pSave.Click += new System.EventHandler(this.m_pSave_Load);
  318. // 
  319. // m_pRelayInterval
  320. // 
  321. this.m_pRelayInterval.BackColor = System.Drawing.Color.White;
  322. this.m_pRelayInterval.ButtonsAlign = LumiSoft.UI.Controls.LeftRight.Right;
  323. this.m_pRelayInterval.DecimalPlaces = 0;
  324. this.m_pRelayInterval.DecMaxValue = new System.Decimal(new int[] {
  325.  999999999,
  326.  0,
  327.  0,
  328.  0});
  329. this.m_pRelayInterval.DecMinValue = new System.Decimal(new int[] {
  330.  999999999,
  331.  0,
  332.  0,
  333.  -2147483648});
  334. this.m_pRelayInterval.DecValue = new System.Decimal(new int[] {
  335.   0,
  336.   0,
  337.   0,
  338.   0});
  339. this.m_pRelayInterval.Location = new System.Drawing.Point(176, 168);
  340. this.m_pRelayInterval.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Numeric;
  341. this.m_pRelayInterval.MaxLength = 32767;
  342. this.m_pRelayInterval.Name = "m_pRelayInterval";
  343. this.m_pRelayInterval.ReadOnly = false;
  344. this.m_pRelayInterval.Size = new System.Drawing.Size(64, 20);
  345. this.m_pRelayInterval.TabIndex = 20;
  346. this.m_pRelayInterval.Text = "0";
  347. this.m_pRelayInterval.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  348. this.m_pRelayInterval.UseStaticViewStyle = false;
  349. this.m_pRelayInterval.ViewStyle.EditReadOnlyColor = System.Drawing.Color.White;
  350. // 
  351. // mt_RelayInterval
  352. // 
  353. this.mt_RelayInterval.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  354. this.mt_RelayInterval.Location = new System.Drawing.Point(24, 168);
  355. this.mt_RelayInterval.Name = "mt_RelayInterval";
  356. this.mt_RelayInterval.Size = new System.Drawing.Size(150, 24);
  357. this.mt_RelayInterval.TabIndex = 19;
  358. this.mt_RelayInterval.Text = "Relay interval";
  359. this.mt_RelayInterval.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  360. this.mt_RelayInterval.UseStaticViewStyle = true;
  361. // 
  362. // m_pRelayRetryInterval
  363. // 
  364. this.m_pRelayRetryInterval.BackColor = System.Drawing.Color.White;
  365. this.m_pRelayRetryInterval.ButtonsAlign = LumiSoft.UI.Controls.LeftRight.Right;
  366. this.m_pRelayRetryInterval.DecimalPlaces = 0;
  367. this.m_pRelayRetryInterval.DecMaxValue = new System.Decimal(new int[] {
  368.   999999999,
  369.   0,
  370.   0,
  371.   0});
  372. this.m_pRelayRetryInterval.DecMinValue = new System.Decimal(new int[] {
  373.   999999999,
  374.   0,
  375.   0,
  376.   -2147483648});
  377. this.m_pRelayRetryInterval.DecValue = new System.Decimal(new int[] {
  378.    0,
  379.    0,
  380.    0,
  381.    0});
  382. this.m_pRelayRetryInterval.Location = new System.Drawing.Point(176, 192);
  383. this.m_pRelayRetryInterval.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Numeric;
  384. this.m_pRelayRetryInterval.MaxLength = 32767;
  385. this.m_pRelayRetryInterval.Name = "m_pRelayRetryInterval";
  386. this.m_pRelayRetryInterval.ReadOnly = false;
  387. this.m_pRelayRetryInterval.Size = new System.Drawing.Size(64, 20);
  388. this.m_pRelayRetryInterval.TabIndex = 22;
  389. this.m_pRelayRetryInterval.Text = "0";
  390. this.m_pRelayRetryInterval.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  391. this.m_pRelayRetryInterval.UseStaticViewStyle = false;
  392. this.m_pRelayRetryInterval.ViewStyle.EditReadOnlyColor = System.Drawing.Color.White;
  393. // 
  394. // mt_RelayRetryInterval
  395. // 
  396. this.mt_RelayRetryInterval.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  397. this.mt_RelayRetryInterval.Location = new System.Drawing.Point(24, 192);
  398. this.mt_RelayRetryInterval.Name = "mt_RelayRetryInterval";
  399. this.mt_RelayRetryInterval.Size = new System.Drawing.Size(150, 24);
  400. this.mt_RelayRetryInterval.TabIndex = 21;
  401. this.mt_RelayRetryInterval.Text = "Relay retry interval";
  402. this.mt_RelayRetryInterval.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  403. this.mt_RelayRetryInterval.UseStaticViewStyle = true;
  404. // 
  405. // m_pUndeliveredWarning
  406. // 
  407. this.m_pUndeliveredWarning.BackColor = System.Drawing.Color.White;
  408. this.m_pUndeliveredWarning.ButtonsAlign = LumiSoft.UI.Controls.LeftRight.Right;
  409. this.m_pUndeliveredWarning.DecimalPlaces = 0;
  410. this.m_pUndeliveredWarning.DecMaxValue = new System.Decimal(new int[] {
  411.   999999999,
  412.   0,
  413.   0,
  414.   0});
  415. this.m_pUndeliveredWarning.DecMinValue = new System.Decimal(new int[] {
  416.   999999999,
  417.   0,
  418.   0,
  419.   -2147483648});
  420. this.m_pUndeliveredWarning.DecValue = new System.Decimal(new int[] {
  421.    0,
  422.    0,
  423.    0,
  424.    0});
  425. this.m_pUndeliveredWarning.Location = new System.Drawing.Point(176, 248);
  426. this.m_pUndeliveredWarning.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Numeric;
  427. this.m_pUndeliveredWarning.MaxLength = 32767;
  428. this.m_pUndeliveredWarning.Name = "m_pUndeliveredWarning";
  429. this.m_pUndeliveredWarning.ReadOnly = false;
  430. this.m_pUndeliveredWarning.Size = new System.Drawing.Size(64, 20);
  431. this.m_pUndeliveredWarning.TabIndex = 26;
  432. this.m_pUndeliveredWarning.Text = "0";
  433. this.m_pUndeliveredWarning.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  434. this.m_pUndeliveredWarning.UseStaticViewStyle = false;
  435. this.m_pUndeliveredWarning.ViewStyle.EditReadOnlyColor = System.Drawing.Color.White;
  436. // 
  437. // wLabel1
  438. // 
  439. this.wLabel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  440. this.wLabel1.Location = new System.Drawing.Point(16, 272);
  441. this.wLabel1.Name = "wLabel1";
  442. this.wLabel1.Size = new System.Drawing.Size(160, 24);
  443. this.wLabel1.TabIndex = 25;
  444. this.wLabel1.Text = "Send undelivered after";
  445. this.wLabel1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  446. this.wLabel1.UseStaticViewStyle = true;
  447. // 
  448. // m_pUndelivered
  449. // 
  450. this.m_pUndelivered.BackColor = System.Drawing.Color.White;
  451. this.m_pUndelivered.ButtonsAlign = LumiSoft.UI.Controls.LeftRight.Right;
  452. this.m_pUndelivered.DecimalPlaces = 0;
  453. this.m_pUndelivered.DecMaxValue = new System.Decimal(new int[] {
  454.    999999999,
  455.    0,
  456.    0,
  457.    0});
  458. this.m_pUndelivered.DecMinValue = new System.Decimal(new int[] {
  459.    999999999,
  460.    0,
  461.    0,
  462.    -2147483648});
  463. this.m_pUndelivered.DecValue = new System.Decimal(new int[] {
  464. 0,
  465. 0,
  466. 0,
  467. 0});
  468. this.m_pUndelivered.Location = new System.Drawing.Point(176, 272);
  469. this.m_pUndelivered.Mask = LumiSoft.UI.Controls.WEditBox_Mask.Numeric;
  470. this.m_pUndelivered.MaxLength = 32767;
  471. this.m_pUndelivered.Name = "m_pUndelivered";
  472. this.m_pUndelivered.ReadOnly = false;
  473. this.m_pUndelivered.Size = new System.Drawing.Size(64, 20);
  474. this.m_pUndelivered.TabIndex = 24;
  475. this.m_pUndelivered.Text = "0";
  476. this.m_pUndelivered.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  477. this.m_pUndelivered.UseStaticViewStyle = false;
  478. this.m_pUndelivered.ViewStyle.EditReadOnlyColor = System.Drawing.Color.White;
  479. // 
  480. // wLabel2
  481. // 
  482. this.wLabel2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  483. this.wLabel2.Location = new System.Drawing.Point(16, 248);
  484. this.wLabel2.Name = "wLabel2";
  485. this.wLabel2.Size = new System.Drawing.Size(160, 24);
  486. this.wLabel2.TabIndex = 23;
  487. this.wLabel2.Text = "Send undelivered warning after";
  488. this.wLabel2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
  489. this.wLabel2.UseStaticViewStyle = true;
  490. // 
  491. // wLabel3
  492. // 
  493. this.wLabel3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  494. this.wLabel3.Location = new System.Drawing.Point(240, 248);
  495. this.wLabel3.Name = "wLabel3";
  496. this.wLabel3.Size = new System.Drawing.Size(48, 24);
  497. this.wLabel3.TabIndex = 27;
  498. this.wLabel3.Text = "minutes";
  499. this.wLabel3.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  500. this.wLabel3.UseStaticViewStyle = true;
  501. // 
  502. // wLabel4
  503. // 
  504. this.wLabel4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  505. this.wLabel4.Location = new System.Drawing.Point(240, 272);
  506. this.wLabel4.Name = "wLabel4";
  507. this.wLabel4.Size = new System.Drawing.Size(48, 24);
  508. this.wLabel4.TabIndex = 28;
  509. this.wLabel4.Text = "hours";
  510. this.wLabel4.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  511. this.wLabel4.UseStaticViewStyle = true;
  512. // 
  513. // wLabel5
  514. // 
  515. this.wLabel5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  516. this.wLabel5.Location = new System.Drawing.Point(240, 168);
  517. this.wLabel5.Name = "wLabel5";
  518. this.wLabel5.Size = new System.Drawing.Size(48, 24);
  519. this.wLabel5.TabIndex = 29;
  520. this.wLabel5.Text = "seconds";
  521. this.wLabel5.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  522. this.wLabel5.UseStaticViewStyle = true;
  523. // 
  524. // wLabel6
  525. // 
  526. this.wLabel6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  527. this.wLabel6.Location = new System.Drawing.Point(240, 192);
  528. this.wLabel6.Name = "wLabel6";
  529. this.wLabel6.Size = new System.Drawing.Size(48, 24);
  530. this.wLabel6.TabIndex = 30;
  531. this.wLabel6.Text = "seconds";
  532. this.wLabel6.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
  533. this.wLabel6.UseStaticViewStyle = true;
  534. // 
  535. // m_UndelWarningText
  536. // 
  537. this.m_UndelWarningText.Location = new System.Drawing.Point(312, 243);
  538. this.m_UndelWarningText.Name = "m_UndelWarningText";
  539. this.m_UndelWarningText.Size = new System.Drawing.Size(288, 24);
  540. this.m_UndelWarningText.TabIndex = 31;
  541. this.m_UndelWarningText.Text = "Edit undelivered warning text";
  542. this.m_UndelWarningText.UseStaticViewStyle = false;
  543. this.m_UndelWarningText.ButtonPressed += new LumiSoft.UI.Controls.ButtonPressedEventHandler(this.m_UndelWarningText_ButtonPressed);
  544. // 
  545. // m_pUndeliveredText
  546. // 
  547. this.m_pUndeliveredText.Location = new System.Drawing.Point(312, 272);
  548. this.m_pUndeliveredText.Name = "m_pUndeliveredText";
  549. this.m_pUndeliveredText.Size = new System.Drawing.Size(288, 24);
  550. this.m_pUndeliveredText.TabIndex = 32;
  551. this.m_pUndeliveredText.Text = "Edit undelivered text";
  552. this.m_pUndeliveredText.UseStaticViewStyle = false;
  553. this.m_pUndeliveredText.ButtonPressed += new LumiSoft.UI.Controls.ButtonPressedEventHandler(this.m_pUndeliveredText_ButtonPressed);
  554. // 
  555. // wfrm_Delivery
  556. // 
  557. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  558. this.ClientSize = new System.Drawing.Size(628, 373);
  559. this.Controls.AddRange(new System.Windows.Forms.Control[] {
  560.   this.m_pUndeliveredText,
  561.   this.m_UndelWarningText,
  562.   this.wLabel6,
  563.   this.wLabel5,
  564.   this.wLabel4,
  565.   this.wLabel3,
  566.   this.m_pUndeliveredWarning,
  567.   this.wLabel1,
  568.   this.m_pUndelivered,
  569.   this.wLabel2,
  570.   this.m_pRelayRetryInterval,
  571.   this.mt_RelayRetryInterval,
  572.   this.m_pRelayInterval,
  573.   this.mt_RelayInterval,
  574.   this.m_pSave,
  575.   this.m_pMaxThreads,
  576.   this.mt_maxthreads,
  577.   this.m_pUseSmartHost,
  578.   this.m_pDNS,
  579.   this.mt_smarthost,
  580.   this.mt_pridns,
  581.   this.m_pSmartHost,
  582.   this.m_pSecDNS,
  583.   this.mt_secdns,
  584.   this.m_pPriDNS});
  585. this.Name = "wfrm_Delivery";
  586. this.Text = "Delivery";
  587. ((System.ComponentModel.ISupportInitialize)(this.m_pSecDNS)).EndInit();
  588. ((System.ComponentModel.ISupportInitialize)(this.m_pPriDNS)).EndInit();
  589. ((System.ComponentModel.ISupportInitialize)(this.m_pSmartHost)).EndInit();
  590. ((System.ComponentModel.ISupportInitialize)(this.m_pMaxThreads)).EndInit();
  591. ((System.ComponentModel.ISupportInitialize)(this.m_pSave)).EndInit();
  592. ((System.ComponentModel.ISupportInitialize)(this.m_pRelayInterval)).EndInit();
  593. ((System.ComponentModel.ISupportInitialize)(this.m_pRelayRetryInterval)).EndInit();
  594. ((System.ComponentModel.ISupportInitialize)(this.m_pUndeliveredWarning)).EndInit();
  595. ((System.ComponentModel.ISupportInitialize)(this.m_pUndelivered)).EndInit();
  596. ((System.ComponentModel.ISupportInitialize)(this.m_UndelWarningText)).EndInit();
  597. ((System.ComponentModel.ISupportInitialize)(this.m_pUndeliveredText)).EndInit();
  598. this.ResumeLayout(false);
  599. }
  600. #endregion
  601. #region Events handling
  602. #region function m_pSave_Load
  603. private void m_pSave_Load(object sender, System.EventArgs e)
  604. {
  605. try
  606. {
  607. if(!IsIpValid(m_pPriDNS.Text)){
  608. MessageBox.Show("Primary Dns IP address isn't valid !");
  609. m_pPriDNS.FlashControl();
  610. return;
  611. }
  612. if(!IsIpValid(m_pSecDNS.Text)){
  613. MessageBox.Show("Secondary Dns IP address isn't valid !");
  614. m_pSecDNS.FlashControl();
  615. return;
  616. }
  617. DataRow dr = dsSettings.Tables["Settings"].Rows[0];
  618. dr["SmartHost"]               = m_pSmartHost.Text;
  619. dr["Dns1"]                    = m_pPriDNS.Text;
  620. dr["Dns2"]                    = m_pSecDNS.Text;
  621. dr["UseSmartHost"]            = m_pUseSmartHost.Checked;
  622. dr["MaxRelayThreads"]         = m_pMaxThreads.Text;
  623. dr["RelayInterval"]           = m_pRelayInterval.Text;
  624. dr["RelayRetryInterval"]      = m_pRelayRetryInterval.Text;
  625. dr["RelayUndelivered"]        = m_pUndelivered.Text;
  626. dr["RelayUndeliveredWarning"] = m_pUndeliveredWarning.Text;
  627. dsSettings.WriteXml(Application.StartupPath + "\Settings\Settings.xml",XmlWriteMode.IgnoreSchema);
  628. }
  629. catch(Exception x)
  630. {
  631. wfrm_Error frm = new wfrm_Error(x,new System.Diagnostics.StackTrace());
  632. frm.ShowDialog(this);
  633. }
  634. }
  635. #endregion
  636. #region function m_pDNS_CheckedChanged
  637. private void m_pDNS_CheckedChanged(object sender, System.EventArgs e)
  638. {
  639. RefreshRadioBtns();
  640. }
  641. #endregion
  642. #region function m_UndelWarningText_ButtonPressed
  643. private void m_UndelWarningText_ButtonPressed(object sender, System.EventArgs e)
  644. {
  645. DataRow dr = dsSettings.Tables["Settings"].Rows[0];
  646. wfrm_EditUndeliveredText frm = new wfrm_EditUndeliveredText(dr["UndeliveredWarningTemplate"].ToString());
  647. if(frm.ShowDialog(this) == DialogResult.OK){
  648. dr["UndeliveredWarningTemplate"] = frm.wp_Template;
  649. dsSettings.WriteXml(Application.StartupPath + "\Settings\Settings.xml",XmlWriteMode.IgnoreSchema);
  650. }
  651. }
  652. #endregion
  653. #region function m_pUndeliveredText_ButtonPressed
  654. private void m_pUndeliveredText_ButtonPressed(object sender, System.EventArgs e)
  655. {
  656. DataRow dr = dsSettings.Tables["Settings"].Rows[0];
  657. wfrm_EditUndeliveredText frm = new wfrm_EditUndeliveredText(dr["UndeliveredTemplate"].ToString());
  658. if(frm.ShowDialog(this) == DialogResult.OK){
  659. dr["UndeliveredTemplate"] = frm.wp_Template;
  660. dsSettings.WriteXml(Application.StartupPath + "\Settings\Settings.xml",XmlWriteMode.IgnoreSchema);
  661. }
  662. }
  663. #endregion
  664. #endregion
  665. #region function RefreshRadioBtns
  666. private void RefreshRadioBtns()
  667. {
  668. if(m_pDNS.Checked){
  669. m_pPriDNS.Enabled    = true;
  670. m_pSecDNS.Enabled    = true;
  671. m_pSmartHost.Enabled = false;
  672. }
  673. else{
  674. m_pPriDNS.Enabled    = false;
  675. m_pSecDNS.Enabled    = false;
  676. m_pSmartHost.Enabled = true;
  677. }
  678. }
  679. #endregion
  680. #region function RefreshForm()
  681. public void RefreshForm()
  682. {
  683. try
  684. {
  685. DataRow dr = dsSettings.Tables["Settings"].Rows[0];
  686. m_pSmartHost.Text          = dr["SmartHost"].ToString();
  687. m_pPriDNS.Text             = dr["Dns1"].ToString();
  688. m_pSecDNS.Text             = dr["Dns2"].ToString();
  689. m_pMaxThreads.Text         = dr["MaxRelayThreads"].ToString();
  690. m_pRelayInterval.Text      = dr["RelayInterval"].ToString();
  691. m_pRelayRetryInterval.Text = dr["RelayRetryInterval"].ToString();
  692. m_pUndelivered.Text        = dr["RelayUndelivered"].ToString();
  693. m_pUndeliveredWarning.Text = dr["RelayUndeliveredWarning"].ToString();
  694. bool UseSmartHost = Convert.ToBoolean(dr["UseSmartHost"]);
  695. if(UseSmartHost){
  696. m_pUseSmartHost.Checked = true;
  697. }
  698. else{
  699. m_pDNS.Checked = true;
  700. }
  701. }
  702. catch(Exception x)
  703. {
  704. wfrm_Error frm = new wfrm_Error(x,new System.Diagnostics.StackTrace());
  705. frm.ShowDialog(this);
  706. }
  707. }
  708. #endregion
  709. #region function IsIpValid
  710. private bool IsIpValid(string IP)
  711. {
  712. try
  713. {
  714. string[] ipBlocks = IP.Split(new char[]{'.'});
  715. if(ipBlocks.Length != 4){
  716. return false;
  717. }
  718. System.Net.IPAddress ip = System.Net.IPAddress.Parse(IP);
  719. return true;
  720. }
  721. catch(Exception x)
  722. {
  723. return false;
  724. }
  725. }
  726. #endregion
  727. }
  728. }