You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.2 KiB
C++

#include "StdAfx.h"
#include "WorkCmd.h"
#include "GlobalFunction.h"
#include "TimingProgressMgr.h"
CWorkCmd::CWorkCmd(void)
{
m_FrontDelay = 0;//ָ<><D6B8>ִ<EFBFBD><D6B4>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD>ʱ(<28><>λ: <20><><EFBFBD><EFBFBD>)
m_AfterDelay = 0;//ָ<><D6B8>ִ<EFBFBD><D6B4>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ(<28><>λ: <20><><EFBFBD><EFBFBD>)
m_bCancel = true;
m_bShowLog = true;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
m_bUseSleepDelay = false;//ʹ<><CAB9>sleep <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
m_bExcuted = false;//<2F>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD>ִ<EFBFBD><D6B4>
m_bExcuting = false;//<2F><><EFBFBD>ڱ<EFBFBD>ִ<EFBFBD><D6B4>
}
CWorkCmd::~CWorkCmd(void)
{
}
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ֹ
bool CWorkCmd::Work(bool Cancel)
{
if(Cancel && m_bCancel)//ָ<>ȡ<EEB1BB><C8A1>
{
return true;
}
if(m_bExcuted)
return false;//<2F>Ѿ<EFBFBD><D1BE><EFBFBD>ִ<EFBFBD>й<EFBFBD><D0B9><EFBFBD>
//ִ<><D6B4>ǰ<EFBFBD><C7B0>ʱ
if(m_FrontDelay>0)
{
if(m_bUseSleepDelay)
Sleep(m_FrontDelay);
else
ExactDelay(Ms2Us(m_FrontDelay));
}
//д<><D0B4>־
if(m_bShowLog)
WirteLog();
//ִ<><D6B4>
bool Ret = !Excute();
//ִ<>к<EFBFBD><D0BA><EFBFBD>ʱ
if(m_AfterDelay>0)
{
if(m_bUseSleepDelay)
Sleep(m_AfterDelay);
else
ExactDelay(Ms2Us(m_AfterDelay));
}
if(Cancel)//<2F><><EFBFBD><EFBFBD>Cancel <20><>״̬
return true;
m_bExcuted = true;
return Ret;
}