-
Notifications
You must be signed in to change notification settings - Fork 0
/
Alarm501.cs
53 lines (47 loc) · 1.37 KB
/
Alarm501.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AdelaRahman.CIS501.AlarmClock
{
public partial class Alarm501 : Form
{
private BindingList<string> alarms = new BindingList<string>();
public Alarm501()
{
InitializeComponent();
}
private void AddButton_Click(object sender, EventArgs e)
{
AddEditAlarm form = new AddEditAlarm();
form.ShowDialog();
StatusText.Text = "";
if (form.DialogResult == DialogResult.OK)
{
alarms.Add(form.on);
AlarmList.DataSource = alarms;
}
}
private void EditButton_Click(object sender, EventArgs e)
{
AddEditAlarm editForm = new AddEditAlarm();
editForm.ShowDialog();
}
private void AlarmList_SelectedIndexChanged(object sender, EventArgs e)
{
if (AlarmList != null)
{
EditButton.Enabled = true;
}
if (AlarmList.Items.Count >= 10)
{
AddButton.Enabled = false;
}
}
}
}