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 wcfControlMonitorClient { /// /// 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 { int a = 0; if (int.TryParse(this.tbWaitTime.Text.Trim(),out a) == 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; } string errtext=string.Empty; CStaticClass.WcfControl.BeginSetConveyorTimeOutTime(Convert.ToInt32(this.tbWaitTime.Text), new AsyncCallback(CallbackSetConveyorTimeOutTime),null ); } catch (Exception ex) { throw ex; } } void CallbackSetConveyorTimeOutTime(IAsyncResult ar) { string errtext=string.Empty; if (CStaticClass.WcfControl.EndSetConveyorTimeOutTime(out errtext, ar) == false) { MessageBox.Show(errtext, "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { CStaticClass.TransportTimeout = this.tbWaitTime.Text; MessageBox.Show("保存成功!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.Close(); } } private void FrmDarkCasket_Load(object sender, EventArgs e) { string errtext=string.Empty; this.tbWaitTime.Text = CStaticClass.WcfControl.GetConveyorTimeOutTime(out errtext).ToString(); } private void FrmTransportTimeout_FormClosing(object sender, FormClosingEventArgs e) { _formInstance = null; } } }