/// <summary> /// Constructor: initializes snoozeUntilTime to harmless value /// </summary> public AlarmController() { this.alarmList = new List <Alarm>(); this.audioController = AbstractAudioController.GetController(); this.guiController = AbstractGuiController.GetController(); this.snoozeUntilTime = TimeFetcher.getCurrentTime(); }
/// <summary> /// Assigns the platform dependent controllers at runtime /// </summary> private void AssignPlatformControllers() { AbstractAudioController.SetController(new AudioController()); AbstractGuiController.SetController(new GuiController()); AbstractDataDriver.addType(typeof(List <Alarm>)); AbstractDataDriver.addType(typeof(Alarm)); AbstractDataDriver.addType(typeof(Audio.Audio)); AbstractDataDriver.Instance = new DataDriver(); }
/// <summary> /// Called when the application exits /// </summary> protected override void OnExit(ExitEventArgs e) { base.OnExit(e); //turn off all alarms AbstractAudioController.GetController().endAllAlarms(); //teardown the alarm/time controllers ac.Teardown(); //finally save any residual state data AbstractDataDriver.Instance.Shutdown(); }
/// <summary> /// Builds controller objects and starts th e app /// </summary> public App() { AbstractGuiController.SetController(new GuiController()); TimePulseGenerator.Instance = new TimePulseGenerator(new SengDispatcherTimer()); AbstractAudioController.SetController(new AudioController()); this.Startup += this.Application_Startup; this.Exit += this.Application_Exit; this.UnhandledException += this.Application_UnhandledException; InitializeComponent(); TimeController tc = new TimeController(); GuiEventCaller.GetCaller().AddListener(tc); TimePulseGenerator.Instance.registerListener(tc); AlarmController ac = new AlarmController(); GuiEventCaller.GetCaller().AddListener(ac); TimePulseGenerator.Instance.registerListener(ac); }