⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exerciseevent.cpp

📁 symbian手机开发程序
💻 CPP
字号:
#include "ExerciseEvent.h"
//pbserver's pattern
CExerciseEvent::CExerciseEvent(MEventObserver& aObserver)
:CActive(CActive::EPriorityStandard),iObserver(aObserver)
	{
	iStop=EFalse;
	}
CExerciseEvent::~CExerciseEvent()
	{
	Cancel();
	iTimer.Close();
	}
void CExerciseEvent::DoCancel()
	{
	iTimer.Cancel();
	iStop = ETrue;
	}
void CExerciseEvent::ConstructL()
	{
	iTimer.CreateLocal();//create colock
	CActiveScheduler::Add(this);//and add it to CActiveScheduler
	Start();
	}
CExerciseEvent* CExerciseEvent::NewL(MEventObserver& aObserver)
	{
	CExerciseEvent* self=CExerciseEvent::NewLC(aObserver);
	CleanupStack::Pop( self );
	return self;
	}
CExerciseEvent* CExerciseEvent::NewLC(MEventObserver& aObserver)
	{
	CExerciseEvent* self = new(ELeave) CExerciseEvent(aObserver);
	CleanupStack::PushL( self );
	self->ConstructL();
	return self;
	}
void CExerciseEvent::Start()
	{
	if(IsActive())
		return;
	iTimer.After(iStatus,1000);//set 1000ms
	SetActive();
	}
void CExerciseEvent::RunL()//implenment RunL
	{
	if(!iStop)
		{
		iTime.HomeTime();//get time
		TDateTime dt;
		dt=iTime.DateTime();//store time in dt
		_LIT(KTIME,"Time: %d:%d:%d\n");
		TBuf<100> buf;
		buf.Format(KTIME,dt.Hour(),dt.Minute(),dt.Second());
		iObserver.UpdateEvent(buf);//update label's text
		Start();
		}
	else
		CActiveScheduler::Stop();
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -