Esempio n. 1
0
        /// <summary>
        /// Add button action, get alarm from the adderremover class, adds alarm to the list of alarms,
        /// Refresh the alarm list and writes the alarm using the FileWriter method
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addButton_Click(object sender, EventArgs e)
        {
            AdderRemover adderRemover = new AdderRemover();

            adderRemover.ShowDialog();
            if (adderRemover.Time != null)
            {
                Alarm time = adderRemover.Time.GetValueOrDefault();
                //Handle by the controller Delegate

                handlerDel(time, State.Added);
            }
        }
Esempio n. 2
0
        private void AlarmEditor(Alarm a)
        {
            Alarm        selected = Alarms[view.SelectedIndex];
            AdderRemover editor   = new AdderRemover();

            editor.Time = selected;
            editor.ShowDialog();
            if (editor.Time != null)
            {
                Alarm time = editor.Time.GetValueOrDefault();
                IO.AlarmFileEditor(time, view.SelectedAlarm);
                Alarms[view.SelectedIndex] = time;

                //(from values in Alarms select values.Key).ToList() //A little dirty solution but won't have reference to the key.
            }
        }