/// <summary> /// Constructor /// </summary> /// <param name="ac">alarm collection to serve as model</param> /// <param name="file">file path to write alarm data on close</param> public ControllerMVC(AlarmCollection ac, string file) { model = ac; filename = file; myTimer = new Timer(); myTimer.Interval = 1000; myTimer.Tick += CheckAlarms; myTimer.Start(); }
public AlarmForm(DialogPrompter p, AlarmResponder r, AlarmCollection a) { InitializeComponent(); this.prompter = p; this.responder = r; this.model = a; uxAlarmListbox.DataSource = model.alarms; if (model.alarms.Count > 0) { DisplayState(AppState.LISTENING, -1); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); AlarmCollection model = new AlarmCollection(10, file); ControllerMVC controller = new ControllerMVC(model, file); AlarmForm view = new AlarmForm(controller.PromptEditWindow, controller.QuietAlarm, model); view.CloseApp += controller.SaveAlarms; controller.RegisterObserver(view.DisplayState); Application.Run(view); }
/// <summary> /// Constructor /// </summary> /// <param name="ac">data to store</param> /// <param name="fn">filepath of storage file</param> public AlarmWriterMVC(AlarmCollection ac, string fn) { filename = fn; data = ac; }
/// <summary> /// Constructor /// </summary> /// <param name="ac"></param> /// <param name="file"></param> public AlarmReaderMVC(AlarmCollection ac, string file) { filename = file; data = ac; }