This repository has been archived by the owner on Jul 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
frmOptions.cs
84 lines (73 loc) · 2.46 KB
/
frmOptions.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
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
namespace ZabbixTray
{
public partial class frmOptions : Form
{
frmMain parentForm;
public frmOptions(frmMain frm)
{
InitializeComponent();
parentForm = new frmMain();
parentForm = frm;
}
private void frmOptions_Load(object sender, EventArgs e)
{
tbURL.Text = parentForm.ApiURL;
tbUsername.Text = parentForm.ApiUsername;
tbPassword.Text = parentForm.ApiPassword;
cbInterval.SelectedIndex = cbInterval.Items.IndexOf(parentForm.CheckInterval.ToString());
cbPriority.SelectedIndex = cbPriority.Items.IndexOf(parentForm.getPriorityValue(parentForm.MinPriority));
if (parentForm.ShowAck)
{
cbShowAck.Checked = true;
}
else
{
cbShowAck.Checked = false;
}
if (parentForm.ShowPopup)
{
cbShowPopup.Checked = true;
}
else
{
cbShowPopup.Checked = false;
}
if (parentForm.IgnoreSSLErrors)
{
cbIgnoreSSLErrors.Checked = true;
}
else
{
cbIgnoreSSLErrors.Checked = false;
}
}
private void btnOK_Click(object sender, EventArgs e)
{
parentForm.ApiURL = tbURL.Text;
parentForm.ApiUsername = tbUsername.Text;
parentForm.ApiPassword = tbPassword.Text;
parentForm.CheckInterval = Int32.Parse(cbInterval.SelectedItem.ToString());
parentForm.MinPriority = parentForm.getPriorityKey(cbPriority.SelectedItem.ToString());
parentForm.ShowAck = cbShowAck.Checked;
parentForm.ShowPopup = cbShowPopup.Checked;
parentForm.IgnoreSSLErrors = cbIgnoreSSLErrors.Checked;
parentForm.saveSettings();
parentForm.reset();
this.Dispose();
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Dispose();
}
}
}