forked from Ken98045/On-Guard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddUrlDlialog.cs
87 lines (71 loc) · 2.1 KB
/
AddUrlDlialog.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
using System;
using System.Windows.Forms;
namespace SAAI
{
/// <summary>
/// A simple dialog to an an URL with a Cooldown.
/// We could make the URLs global like the email addresses, but not for now
/// </summary>
public partial class AddUrlDialog : Form
{
public UrlOptions Options { get; }
public AddUrlDialog(UrlOptions options)
{
InitializeComponent();
Options = options;
if (null == options)
{
Options = new UrlOptions(string.Empty, 0, 300, 0);
}
urlText.Text = Options.Url;
urlCoolDownNumeric.Value = Options.CoolDown.CooldownTime;
WaitTimeNumeric.Value = Options.WaitTime;
}
private void OkButton_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(urlText.Text))
{
MessageBox.Show(this, "You must enter an URL to notify (or we can't get there from here)!", "The URL Cannot be Empty!");
DialogResult = DialogResult.None;
}
else
{
Options.BIFlags = 0;
Options.Url = urlText.Text;
if (FlagCheckBox.Checked) Options.BIFlags |= (int) BIFLAGS.Flagged;
if (ConfirmCheckBox.Checked) Options.BIFlags |= (int) BIFLAGS.Confirmed;
if (ResetCheckBox.Checked) Options.BIFlags |= (int) BIFLAGS.Reset;
DialogResult = DialogResult.OK;
}
}
private void CancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void AutoFillButton_Click(object sender, EventArgs e)
{
urlText.Text = "{Auto Fill}";
}
private void ConfirmOnCheckChanged(object sender, EventArgs e)
{
}
private void FlagCheckChanged(object sender, EventArgs e)
{
}
private void ResetCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (ResetCheckBox.Checked)
{
FlagCheckBox.Checked = false;
ConfirmCheckBox.Checked = false;
}
}
}
public enum BIFLAGS
{
Uncomfirmed = 0,
Flagged = 1,
Confirmed = 2,
Reset = 4
}
}