示例#1
0
void CLogDlg::OnBnClickedRefresh()
{
	if(isPaused == false)
	{
		RefreshLog();
	}
	else
	{
		isPaused = false;
		RefreshLog();
		isPaused = true;
	}
}
示例#2
0
void CLogDlg::OnCbnSelchangeWarningLevel()
{
	if(isPaused == false)
	{
		RefreshLog();
	}
	else
	{
		isPaused = false;
		RefreshLog();
		isPaused = true;
	}
}
示例#3
0
void CLogDlg::OnCbnSelchangeObject()
{
	if(isPaused == false)
	{
		RefreshLog();
	}
	else
	{
		isPaused = false;
		RefreshLog();
		isPaused = true;
	}
}
示例#4
0
void MainWindow::createInfoDock()//创建文件Dock
{
    m_infodock=new SAMInfoDock(this);
//    m_infodock->refresh(core);
    m_infodock->setCore(core);
    this->addDockWidget(Qt::LeftDockWidgetArea,m_infodock);
    connect(m_filedock,SIGNAL(InfoRefresh(QString)),m_infodock,SLOT(RefreshInfo(QString)));

    connect(core,SIGNAL(writeLog()),m_infodock,SLOT(RefreshLog()));
}
// Start the specified threads
// [in] AllThreads : If you start all threads, true is to be passed.  Otherwize false is passed.
// [out] Result Code
int StkThreadGuiManager::StartThreads(bool AllThreads)
{
	if (DlgWndHndl != NULL) {
		SetFocus(DlgWndHndl); // TABフォーカスが失われるのを防止する施策

		//Disable Start and Stop button.
		EnableWindow(GetDlgItem(DlgWndHndl, IDC_START), false);
		EnableWindow(GetDlgItem(DlgWndHndl, IDC_STOP), false);
	}

	// Change the status on GUI.
	for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) {
		if (AllThreads == true || ListView_GetCheckState(ListWndHndl, RowLoop) == TRUE) {
			if (GetStkThreadStatusByIndex(RowLoop) != STKTHREAD_STATUS_RUNNING) {
				ReplaceStatus(RowLoop, STKTHREAD_STATUS_STARTING);
			}
		}
	}

	// Does selected thread IDs are stored into Ids[] variable.
	int Ids[MAX_NUM_OF_THREADS];
	int IdsIndex = 0;
	for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) {
		if ((AllThreads == true || ListView_GetCheckState(ListWndHndl, RowLoop) == TRUE) &&
			GetStkThreadStatusByIndex(RowLoop) == STKTHREAD_STATUS_READY) {
			Ids[IdsIndex] = GetStkThreadIdByIndex(RowLoop);
			IdsIndex++;
		}
	}

	// Start selected threads.
	StartSpecifiedStkThreads(Ids, IdsIndex);

	// When AllThreads is true, check whether all threads are running or not.
	// If some threads are not running, wait for the status change.
	while (AllThreads) {
		bool AllRunning = true;
		for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) {
			if (GetStkThreadStatusByIndex(RowLoop) != STKTHREAD_STATUS_RUNNING) {
				AllRunning = false;
				break;
			}
		}
		if (AllRunning == true) {
			break;
		} else {
			Sleep(100);
		}
	}

	RefreshLog(false);

	return 0;
}
示例#6
0
void CLogDlg::WriteToLog(int warningLevel, int object, LPCTSTR strToWrite)
{
	CTime currentTime = CTime::GetCurrentTime();
	logEntry.push_back(LogEntry(currentTime.Format("%m/%d %H:%M:%S").GetString(),warningLevel,object, string(strToWrite)));
	if(logEntry.size() > MAX_LOG_SIZE)
	{
		logEntry.erase(&logEntry.front()); //pop the front if the log gets too big
		if(m_richLog.GetTextLength() > 1024*1024) // if text box gets too big
		{
			RefreshLog();
			return;
		}
	}
	WriteEntry((int)logEntry.size() - 1);
}
示例#7
0
void CLogDlg::OnBnClickedPause()
{

	if(isPaused == false)
	{
		isPaused = true;
		m_pause.SetWindowText("Resume");
	}
	else
	{
		isPaused = false;
		RefreshLog();
		m_pause.SetWindowText("Pause");
	}
}
示例#8
0
void CLogListView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
    m_nType = (UINT)lHint;

    switch (m_nType)
    {
    case LOG:
        InitHeadForLog();
        RefreshLog((CAdapterInfo *)pHint);
        break;

    default:
        break;
    }

    ((CMainFrame *)AfxGetMainWnd())->SendMessage(WM_SIZE);
}
// Stop the specified threads
// [in] AllThreads : If you stop all threads, true is to be passed.  Otherwize false is passed.
// [out] Result Code
int StkThreadGuiManager::StopThreads(bool AllThreads)
{
	if (DlgWndHndl != NULL) {
		SetFocus(DlgWndHndl); // TABフォーカスが失われるのを防止する施策

		//Disable Start and Stop button.
		EnableWindow(GetDlgItem(DlgWndHndl, IDC_START), false);
		EnableWindow(GetDlgItem(DlgWndHndl, IDC_STOP), false);
	}

	// Change the status on GUI.
	for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) {
		if (AllThreads == true || ListView_GetCheckState(ListWndHndl, RowLoop) == TRUE) {
			if (GetStkThreadStatusByIndex(RowLoop) != STKTHREAD_STATUS_READY) {
				ReplaceStatus(RowLoop, STKTHREAD_STATUS_STOPPING);
			}
		}
	}

	// Does selected thread IDs are stored into Ids[] variable.
	int Ids[MAX_NUM_OF_THREADS];
	int IdsIndex = 0;
	for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) {
		if ((AllThreads == true || ListView_GetCheckState(ListWndHndl, RowLoop) == TRUE) &&
			GetStkThreadStatusByIndex(RowLoop) == STKTHREAD_STATUS_RUNNING) {
			Ids[IdsIndex] = GetStkThreadIdByIndex(RowLoop);
			IdsIndex++;
		}
	}

	// Stop selected threads.
	StopSpecifiedStkThreads(Ids, IdsIndex);

	RefreshLog(false);

	return 0;
}