forked from Ken98045/On-Guard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateEmailAddressDialog.cs
95 lines (80 loc) · 2.55 KB
/
CreateEmailAddressDialog.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using System;
using System.Windows.Forms;
namespace SAAI
{
/// <summary>
/// A dialog for creating an email adddress for use through out the applicaton.
/// We also associate start time, end time, and days of week for the email address.
/// later we may associate that start/end time with an area rather than the email address.
/// </summary>
public partial class CreateEmailAddressDialog : Form
{
public EmailOptions Email { get; set; }
public CreateEmailAddressDialog()
{
InitializeComponent();
}
public CreateEmailAddressDialog(EmailOptions options)
{
InitializeComponent();
Email = options;
emailText.Text = Email.EmailAddress;
numberOfImages.Value = Email.NumberOfImages;
sizeImageToNumeric.Value = Email.SizeDownToPercent;
coolDownNumeric.Value = Email.CoolDown.CooldownTime;
check247.Checked = Email.AllTheTime;
fromTime.Value = Email.StartTime;
toTime.Value = Email.EndTime;
for (int i = 0; i < 7; i++)
{
daysOfWeekList.SetItemChecked(i, Email.DaysOfWeek[i]);
}
}
private void OkButton_Click(object sender, EventArgs e)
{
if (null == Email)
{
Email = new EmailOptions(emailText.Text, (int)coolDownNumeric.Value);
}
Email.EmailAddress = this.emailText.Text;
Email.NumberOfImages = (int)this.numberOfImages.Value;
Email.SizeDownToPercent = (int)this.sizeImageToNumeric.Value;
Email.CoolDown.CooldownTime = (int)this.coolDownNumeric.Value;
Email.AllTheTime = check247.Checked;
Email.StartTime = this.fromTime.Value;
Email.EndTime = this.toTime.Value;
for (int i = 0; i < 7; i++)
{
Email.DaysOfWeek[i] = this.daysOfWeekList.GetItemChecked(i);
}
DialogResult = DialogResult.OK;
Close();
}
private void CancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void OnCheckChanged(object sender, EventArgs e)
{
if (check247.Checked)
{
for (int i = 0; i < 7; i++)
{
daysOfWeekList.SetItemChecked(i, true);
}
}
}
private void MMSHelperButton_Click(object sender, EventArgs e)
{
using (MMSHelper dlg = new MMSHelper())
{
DialogResult result = dlg.ShowDialog();
if (DialogResult != DialogResult.Cancel)
{
emailText.Text = dlg.SelectedMMS;
}
}
}
}
}