Example #1
0
        /// <summary>
        /// Event handler for when the add alarm button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnAddAlarm_Click(object sender, EventArgs e)
        {
            AddEditAlarm addEditAlarm = new AddEditAlarm();

            if (addEditAlarm.ShowDialog() == DialogResult.OK)
            {
                alarmList.Add(addEditAlarm);
                listBox.Items.Add(addEditAlarm.ToString());
            }
            WriteAlarms();
        }
Example #2
0
        /// <summary>
        /// Event handler for when the edit button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            int          index        = listBox.SelectedIndex;
            AddEditAlarm addEditAlarm = new AddEditAlarm();

            if (index >= 0)
            {
                if (addEditAlarm.ShowDialog() == DialogResult.OK)
                {
                    alarmList[index]     = addEditAlarm;
                    listBox.Items[index] = addEditAlarm.ToString();
                }
                WriteAlarms();
            }
        }