Ejemplo n.º 1
0
 /// <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();
 }
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 /// <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;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ac"></param>
 /// <param name="file"></param>
 public AlarmReaderMVC(AlarmCollection ac, string file)
 {
     filename = file;
     data     = ac;
 }