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 FrmWaitTime : Form { private static FrmWaitTime _formInstance; public static FrmWaitTime FormInstance { get { if (_formInstance == null) { _formInstance = new FrmWaitTime(); } return _formInstance; } set { _formInstance = value; } } public FrmWaitTime() { 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; } CStaticClass.WcfControl.BeginSetForkCombinWaitTime(a, new AsyncCallback(CallbackSetForkCombinWaitTime), null); } catch (Exception ex) { throw ex; } } void CallbackSetForkCombinWaitTime(IAsyncResult ar) { string errtext = string.Empty; if (CStaticClass.WcfControl.EndSetForkCombinWaitTime(out errtext, ar) == false) { MessageBox.Show(errtext, "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { CStaticClass.DoubleForkWaitTime = 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.GetForkCombinWaitTime(out errtext).ToString(); } private void FrmWaitTime_FormClosing(object sender, FormClosingEventArgs e) { _formInstance = null; } } }