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.

144 lines
3.9 KiB
C++

#include "stdafx.h"
#include "LaiPuLaser.h"
#include "DlgTimingProgress.h"
#include "afxdialogex.h"
#include "TimingProgressMgr.h"
#include "LaiPuLaserView.h"
#include "AllThreadMgr.h"
#include "GlobalFunction.h"
#include "WorkCmdInvoker.h"
#include "ProgramLaserTuiHuo.h"
#include "CommonFlowMgr.h"
#define UPDATE_INFO_TIMER 1
#define UPDATE_INFO_TIMER_DELAY 100
IMPLEMENT_DYNAMIC(CDlgTimingProgress, CDialogEx)
BEGIN_MESSAGE_MAP(CDlgTimingProgress, CDialogEx)
ON_WM_TIMER()
ON_BN_CLICKED(NEW_STOP_BTN, &CDlgTimingProgress::OnBnClickedStopBtn)
END_MESSAGE_MAP()
CDlgTimingProgress::CDlgTimingProgress(CWnd* pParent /*=NULL*/)
: CDialogEx(CDlgTimingProgress::IDD, pParent)
{
}
CDlgTimingProgress::~CDlgTimingProgress()
{
}
void CDlgTimingProgress::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_WORK_PROGRESS, m_WorkProgress);
DDX_Control(pDX, NEW_STOP_BTN, m_StopBtn);
}
//<2F><><EFBFBD>μ<EFBFBD><CEBC>̲<EFBFBD><CCB2><EFBFBD>
BOOL CDlgTimingProgress::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
char c = pMsg->wParam;
if(c==VK_RETURN || c==VK_ESCAPE)
{
return TRUE;
}
}
return CDialogEx::PreTranslateMessage(pMsg);
}
BOOL CDlgTimingProgress::OnInitDialog()
{
CDialogEx::OnInitDialog();
if(gTimingProgressMgr.IsbCloseApp())
{
Sleep(1000);
gAllThreadMgr.StopAllThread();
}
gTimingProgressMgr.SetbExecuting(true);
SetTimer(UPDATE_INFO_TIMER,UPDATE_INFO_TIMER_DELAY,NULL);
if(gProgramLaserTuiHuo->IsbAutoWorking()
|| gCommonFlowMgr->IsbXyMoveTesting()
|| gTimingProgressMgr.IsbStopBtn()
)
{
GetDlgItem(NEW_STOP_BTN)->ShowWindow(SW_SHOW);
}
gTimingProgressMgr.SetbStopBtn(false);
//<2F>öԻ<C3B6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>ʾ
CRect rect;
GetClientRect(&rect);
::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, rect.Width(), rect.Height(), SWP_NOMOVE);
UpdateData(FALSE);
return TRUE;
}
//<2F><>ֹEsc <20>رնԻ<D5B6><D4BB><EFBFBD>
void CDlgTimingProgress::OnCancel()
{
return;
}
void CDlgTimingProgress::OnTimer(UINT nIDEvent)
{
if(nIDEvent == UPDATE_INFO_TIMER)
{
KillTimer(UPDATE_INFO_TIMER);
if(!gExitApp)
{
UpdateInfo();
SetTimer(UPDATE_INFO_TIMER,UPDATE_INFO_TIMER_DELAY,NULL);
}
}
CDialog::OnTimer(nIDEvent);
}
void CDlgTimingProgress::UpdateInfo()
{
//ִ<><D6B4>ʱ<EFBFBD><CAB1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ms
gTimingProgressMgr.AddCurExecuteTime(UPDATE_INFO_TIMER_DELAY);
//ʱ<><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>ֹͣ(<28>ǹر<C7B9><D8B1><EFBFBD><EFBFBD><EFBFBD>ʱ)
//if(!gTimingProgressMgr.IsbCloseApp() && (gTimingProgressMgr.CheckCurExecuteTime(-1)||gTimingProgressMgr.IsbStopExecute()))
//ʱ<><EFBFBD>˲<EFBFBD>Ҫ<EFBFBD>Զ<EFBFBD><D4B6>ر<EFBFBD>
if(!gTimingProgressMgr.IsbCloseApp() && (gTimingProgressMgr.IsbStopExecute()))
{
gTimingProgressMgr.SetShowInfo("");
gTimingProgressMgr.SetbExecuting(false);
OnOK();
}
//<2F>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>ʱ(5<><35><EFBFBD><EFBFBD>)<29>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̹߳رղŽ<D5B2><C5BD><EFBFBD>
if(gTimingProgressMgr.IsbCloseApp() && gTimingProgressMgr.CheckCurExecuteTime(5000))
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>ʾ<EFBFBD>̵߳<DFB3><CCB5><EFBFBD><EFBFBD><EFBFBD>
if(gAllThreadMgr.HasThreadRunning())
{
gAllThreadMgr.ShowRunningThreadName();
}
else
{
OnOK();
}
}
//<2F><>ʾû<CABE>йر<D0B9><D8B1>̵߳<DFB3><CCB5><EFBFBD><EFBFBD><EFBFBD>
if(gTimingProgressMgr.IsbCloseApp() && (!gAllThreadMgr.HasThreadRunning()) && gTimingProgressMgr.CheckCurExecuteTime(5000))
{
OnOK();
}
CString NewShowInfo = gTimingProgressMgr.GetShowInfo();
if(NewShowInfo != m_ShowInfo)//<2F>仯ʱˢ<CAB1><CBA2>
{
m_ShowInfo = NewShowInfo;
GetDlgItem(IDC_STATIC_EXECUTE_INFO)->SetWindowText(m_ShowInfo);
}
double progress = gTimingProgressMgr.GetProgressVal();
m_WorkProgress.SetPos((int)progress);
}
//ֹͣ
void CDlgTimingProgress::OnBnClickedStopBtn()
{
gLogMgr->WriteDebugLog("Func---->OnBnClickedTimingProgressStopBtn");
gStopAllWrokCmd = true;
GetDlgItem(NEW_STOP_BTN)->EnableWindow(false);
}