-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetTimeForm.cs
More file actions
36 lines (30 loc) · 1006 Bytes
/
SetTimeForm.cs
File metadata and controls
36 lines (30 loc) · 1006 Bytes
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
namespace WorkTimer
{
public partial class SetTimeForm : Form
{
public TimeSpan SelectedTime { get; private set; }
public SetTimeForm()
{
InitializeComponent();
}
private void btnSet_Click(object sender, EventArgs e)
{
int hours = (int)numHours.Value;
int minutes = (int)numMinutes.Value;
int seconds = (int)numSeconds.Value;
if (hours == 0 && minutes == 0 && seconds == 0)
{
MessageBox.Show("Please set a time greater than zero.", "Invalid Time", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
SelectedTime = new TimeSpan(hours, minutes, seconds);
this.DialogResult = DialogResult.OK;
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
}
}