using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Microsoft.VisualBasic; namespace ControlSystem { /// /// Creator:Richard.liu /// 黑匣子维护 /// public partial class FrmTransportTimeout : Form { private static FrmTransportTimeout _formInstance; public static FrmTransportTimeout FormInstance { get { if (_formInstance == null) { _formInstance = new FrmTransportTimeout(); } return _formInstance; } set { _formInstance = value; } } public FrmTransportTimeout() { InitializeComponent(); _formInstance = this; } private void button1_Click(object sender, EventArgs e) { try { if (Information.IsNumeric(this.tbWaitTime.Text.Trim()) == false) { MessageBox.Show("输送超时最大允许时间必须为数字!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Error); this.tbWaitTime.Focus(); return; } int ts = 0; int.TryParse(tbWaitTime.Text.Trim(), out ts); if (ts < 1) { MessageBox.Show("输送超时最大允许时间必须为大于1的整型数字!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Error); this.tbWaitTime.Focus(); return; } CommonClassLib.AppSettings.SetValue("TransportTimeout", this.tbWaitTime.Text); CStaticClass.TransportTimeout = this.tbWaitTime.Text; MessageBox.Show("保存成功!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.Close(); } catch (Exception ex) { throw ex; } } private void FrmDarkCasket_Load(object sender, EventArgs e) { //20100521 this.tbWaitTime.Text = CommonClassLib.AppSettings.GetValue("TransportTimeout"); } } }