91 lines
3.0 KiB
C#
91 lines
3.0 KiB
C#
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
|
||
{
|
||
/// <summary>
|
||
/// Creator:Richard.liu
|
||
/// 黑匣子维护
|
||
/// </summary>
|
||
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
|
||
{
|
||
string regex = "^[1-9]\\d*$";
|
||
|
||
string begin = "1", end = "600";
|
||
if(false==System.Text.RegularExpressions.Regex.IsMatch(tbWaitTime.Text.Trim(),regex))
|
||
{
|
||
begin = string.Format("双叉任务等待时间输入范围:{0}~{1}之间的整数!", begin, end); this.tbWaitTime.Focus();
|
||
MessageBox.Show(begin, "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||
this.tbWaitTime.Text= CStaticClass.DoubleForkWaitTime;
|
||
this.tbWaitTime.Focus();
|
||
return;
|
||
|
||
}
|
||
else
|
||
{
|
||
|
||
if (!(Convert.ToInt32(tbWaitTime.Text.Trim()) > 0 && Convert.ToInt32(tbWaitTime.Text.Trim()) <= 300))
|
||
{
|
||
//string begin = "0", end = "300";
|
||
begin = string.Format("双叉任务等待时间输入范围:{0}~{1}之间的整数!", begin, end);
|
||
MessageBox.Show(begin, "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||
this.tbWaitTime.Text = CStaticClass.DoubleForkWaitTime;
|
||
this.tbWaitTime.Focus();
|
||
return;
|
||
}
|
||
}
|
||
|
||
|
||
CommonClassLib.AppSettings.SetValue("DoubleForkWaitTime", this.tbWaitTime.Text);
|
||
CStaticClass.DoubleForkWaitTime = this.tbWaitTime.Text;
|
||
MessageBox.Show("保存成功!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
this.Close();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
throw ex;
|
||
}
|
||
}
|
||
|
||
private void FrmDarkCasket_Load(object sender, EventArgs e)
|
||
{
|
||
//20100521
|
||
this.tbWaitTime.Text = CommonClassLib.AppSettings.GetValue("DoubleForkWaitTime");
|
||
}
|
||
|
||
private void btClose_Click(object sender, EventArgs e)
|
||
{
|
||
this.Close();
|
||
}
|
||
}
|
||
} |