📄 clstimeout.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace qdog
{
class clsTimeOut
{
Timer m_objTimer;
int m_nTimes;
Boolean m_bIsWork;
const int MAX_TIMES = 60;
public clsTimeOut()
{
m_objTimer = new Timer();
m_objTimer.Tick += new EventHandler(m_objTimer_Tick);
}
void m_objTimer_Tick(object sender, EventArgs e)
{
m_nTimes++;
//throw new Exception("The method or operation is not implemented.");
}
public void Wait(int nSec)
{
StartTime();
Application.DoEvents();
while (m_nTimes<nSec)
{
System.Threading.Thread.Sleep(1);
Application.DoEvents();
if (m_objTimer.Enabled == false)
break;
}
StopTime();
}
public void CancelWait()
{
StopTime();
}
private void StartTime()
{
m_bIsWork = true;
m_nTimes = 0;
m_objTimer.Interval = 1000;
m_objTimer.Enabled = true;
m_objTimer.Start();
}
private void StopTime()
{
m_bIsWork = false;
m_objTimer.Stop();
//m_objTimer.Interval = 0;
m_objTimer.Enabled = false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -