5.3将微波炉各部件类与适配器进行初始化连接
public class OvenCore
{
//微波炉元素定义
public Button MyStartResumeButton = new Button();//开始继续按钮
public Button MyStopPauseButton = new Button();//停止暂停按钮
public Button MyTimeSetButton = new Button();//时间设定按钮
public Button MyOpenCloseDoorButton = new Button();//开关门按钮
public Beeper MyBeeper = Beeper.GetInstance();//蜂鸣器
public Display MyDisplay = Display.GetInstance();//显示器
public Door MyDoor = Door.GetInstance();//门
public Light MyLight = Light.GetInstance();//灯管
public PowerTube MyPowerTube = PowerTube.GetInstance();//功率管
public Timer MyTimer = Timer.GetInstance();//定时器
//监听者定义
//
private Beeper_ButtonPressListener bepBtnPrsLis = new Beeper_ButtonPressListener();
private Beeper_TimeExpiredListener bepTimExpLis = new Beeper_TimeExpiredListener();
private Display_PowerTubeOffListener disPwtOffLis = new Display_PowerTubeOffListener();
private Display_PowerTubeOnListener disPwtOnLis = new Display_PowerTubeOnListener();
private Display_TimerCountListener disTimCouLis = new Display_TimerCountListener();
private Door_OpenCloseDoorButtonPressListener dorOpnClsDorBtn = new Door_OpenCloseDoorButtonPressListener();
private Light_DoorCloseListener lgtDorClsLis = new Light_DoorCloseListener();
private Light_DoorOpenListener lgtDorOpnLis = new Light_DoorOpenListener();
private Light_TimerExpiredListener lgtTimExpLis = new Light_TimerExpiredListener();
private Light_TimerOffListener lgtTimOffLis = new Light_TimerOffListener();
private Light_TimerOnListener lgtTimOnLis = new Light_TimerOnListener();
private PowerTube_DoorOpenListener pwtDorOpnLis = new PowerTube_DoorOpenListener();
private PowerTube_TimerExpiredListener pwtTimExpLis = new PowerTube_TimerExpiredListener();
private PowerTube_TimerOffListener pwtTimOffLis = new PowerTube_TimerOffListener();
private PowerTube_TimerOnListener pwtTimOnLis = new PowerTube_TimerOnListener();
private PowerTube_TimerPauseListener pwtTimPauLis = new PowerTube_TimerPauseListener();
private PowerTube_TimerResumeListener pwtTimResLis = new PowerTube_TimerResumeListener();
private Timer_DoorCloseListener timDorClsLis = new Timer_DoorCloseListener();
private Timer_DoorOpenListener timDorOpnLis = new Timer_DoorOpenListener();
private Timer_StartContinueButtonPressListener timStaCntBtnLis = new Timer_StartContinueButtonPressListener();
private Timer_StopPauseButtonPressListener timStpPauBtnLis = new Timer_StopPauseButtonPressListener();
private Timer_TimeSetButtonPressListener timTimSetBtnLis = new Timer_TimeSetButtonPressListener();
public OvenCore()
{
//为监听者预定事件
//蜂鸣器预定开始继续按钮的点击事件
MyStartResumeButton.ButtonPress += new ButtonHandler(bepBtnPrsLis.OnButtonPress);
//定时器预定开始继续按钮的点击事件
MyStartResumeButton.ButtonPress += new ButtonHandler(timStaCntBtnLis.OnButtonPress);
//蜂鸣器预定停止暂停按钮的点击事件
MyStopPauseButton.ButtonPress += new ButtonHandler(bepBtnPrsLis.OnButtonPress);
//定时器预定停止暂停按钮的点击事件
MyStopPauseButton.ButtonPress += new ButtonHandler(timStpPauBtnLis.OnButtonPress);
//蜂鸣器预定时间设定按钮的点击事件
MyTimeSetButton.ButtonPress += new ButtonHandler(bepBtnPrsLis.OnButtonPress);
//定时器预定时间设定按钮的点击事件
MyTimeSetButton.ButtonPress += new ButtonHandler(timTimSetBtnLis.OnButtonPress);
//蜂鸣器预定开门关门按钮的点击事件
MyOpenCloseDoorButton.ButtonPress += new ButtonHandler(bepBtnPrsLis.OnButtonPress);
//定时器预定开门关门按钮的点击事件
MyOpenCloseDoorButton.ButtonPress += new ButtonHandler(dorOpnClsDorBtn.OnButtonPress);
MyDoor.DoorOpen += new DoorHandler(lgtDorOpnLis.OnDoorOpen);//灯管预定门的打开事件;
MyDoor.DoorOpen += new DoorHandler(pwtDorOpnLis.OnDoorOpen);//功率管预定门的打开事件;
MyDoor.DoorOpen += new DoorHandler(timDorOpnLis.OnDoorOpen);//定时器预定门的打开事件;
MyDoor.DoorClose += new DoorHandler(lgtDorClsLis.OnDoorClose);//灯管预定门的关闭事件;
MyDoor.DoorClose += new DoorHandler(timDorClsLis.OnDoorClose);//定时器预定门的关闭时间;
//显示器预定功率管的关闭事件
MyPowerTube.PowerTubeOff += new PowerTubeHandler(disPwtOffLis.OnPowerTubeOff);
//显示器预定功率管的开启事件
MyPowerTube.PowerTubeOn += new PowerTubeHandler(disPwtOnLis.OnPowerTubeOn);
//显示器预定定时器的剩余时间改变事件
MyTimer.TimerCount += new TimerHandler(disTimCouLis.OnTimerCount);
//灯管预定定时器的超时事件
MyTimer.TimerExpired += new TimerHandler(lgtTimExpLis.OnTimerExpired);
//功率管预定定时器的超时事件
MyTimer.TimerExpired += new TimerHandler(pwtTimExpLis.OnTimerExpired);
//蜂鸣器预定定时器的超时事件
MyTimer.TimerExpired += new TimerHandler(bepTimExpLis.OnTimerExpired);
MyTimer.TimerOff += new TimerHandler(lgtTimOffLis.OnTimerOff);//灯管预定定时器的停止事件
MyTimer.TimerOff += new TimerHandler(pwtTimOffLis.OnTimerOff);//功率管预定定时器的停止事件
MyTimer.TimerOn += new TimerHandler(lgtTimOnLis.OnTimerOn);//灯管预定定时器的启动事件
MyTimer.TimerOn += new TimerHandler(pwtTimOnLis.OnTimerOn);//功率管预定定时器的启动事件
//功率管预定定时器的暂停事件
MyTimer.TimerPause += new TimerHandler(pwtTimPauLis.OnTimerPause);
//功率管预定定时器的继续事件
MyTimer.TimerResume += new TimerHandler(pwtTimResLis.OnTimerResume);
<< 上一页 [11] [12] [13] [14] [15] 下一页