summaryrefslogtreecommitdiffstats
path: root/agent/windows-setup-agent/GlobalZonesInputBox.cs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:32:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:32:39 +0000
commit56ae875861ab260b80a030f50c4aff9f9dc8fff0 (patch)
tree531412110fc901a5918c7f7442202804a83cada9 /agent/windows-setup-agent/GlobalZonesInputBox.cs
parentInitial commit. (diff)
downloadicinga2-e6c8b97d844e301093c7e2c03da489629676e2c4.tar.xz
icinga2-e6c8b97d844e301093c7e2c03da489629676e2c4.zip
Adding upstream version 2.14.2.upstream/2.14.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--agent/windows-setup-agent/GlobalZonesInputBox.cs46
1 files changed, 46 insertions, 0 deletions
diff --git a/agent/windows-setup-agent/GlobalZonesInputBox.cs b/agent/windows-setup-agent/GlobalZonesInputBox.cs
new file mode 100644
index 0000000..cd8054d
--- /dev/null
+++ b/agent/windows-setup-agent/GlobalZonesInputBox.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace Icinga
+{
+ public partial class GlobalZonesInputBox : Form
+ {
+ private ListView.ListViewItemCollection globalZonesItems;
+
+ public GlobalZonesInputBox(ListView.ListViewItemCollection globalZonesItems)
+ {
+ InitializeComponent();
+
+ this.globalZonesItems = globalZonesItems;
+ }
+
+ private void Warning(string message)
+ {
+ MessageBox.Show(this, message, Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
+
+
+ private void btnOK_Click(object sender, EventArgs e)
+ {
+ if (txtGlobalZoneName.Text == "global-templates" || txtGlobalZoneName.Text == "director-global") {
+ Warning("This global zone is configured by default.");
+ return;
+ }
+
+ foreach (ListViewItem lvw in globalZonesItems) {
+ if (txtGlobalZoneName.Text == lvw.Text) {
+ Warning("This global zone is already defined.");
+ return;
+ }
+ }
+
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ }
+}