]> granicus.if.org Git - icinga2/blob - agent/windows-setup-agent/ServiceStatus.cs
Merge pull request #6305 from gunnarbeutner/feature/environment-variable
[icinga2] / agent / windows-setup-agent / ServiceStatus.cs
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Text;
7 using System.Windows.Forms;
8 using System.ServiceProcess;
9 using System.Diagnostics;
10
11 namespace Icinga
12 {
13         public partial class ServiceStatus : Form
14         {
15                 public ServiceStatus()
16                 {
17                         InitializeComponent();
18
19                         try {
20                                 ServiceController sc = new ServiceController("icinga2");
21
22                                 txtStatus.Text = sc.Status.ToString();
23                         } catch (InvalidOperationException) {
24                                 txtStatus.Text = "Not Available";
25                         }
26                 }
27
28                 private void btnReconfigure_Click(object sender, EventArgs e)
29                 {
30                         new SetupWizard().ShowDialog(this);
31                 }
32
33                 private void btnOK_Click(object sender, EventArgs e)
34                 {
35                         Close();
36                 }
37
38                 private void btnOpenConfigDir_Click(object sender, EventArgs e) {
39                         Process.Start("explorer.exe", Program.Icinga2DataDir);
40                 }
41         }
42 }