Repository: louislam/uptime-kuma
File: extra/exe-builder/Program.cs (C#)

Code before:
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new UptimeKumaApplicationContext(isIntranet));
        }
    }

    public class UptimeKumaApplicationContext : ApplicationContext
    {
        private static Mutex mutex = null;

        const string appName = "Uptime Kuma";

        private NotifyIcon trayIcon;
        private Process process;

        private MenuItem statusMenuItem;
        private MenuItem runWhenStarts;
        private MenuItem openMenuItem;

        private RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);

        private readonly bool intranetOnly = false;

        public UptimeKumaApplicationContext(bool intranetOnly = false) {

            // Single instance only
            bool createdNew;
            mutex = new Mutex(true, appName, out createdNew);
            if (!createdNew) {
                return;
            }

            this.intranetOnly = intranetOnly;

            var startingText = "Starting server...";
            trayIcon = new NotifyIcon();
            trayIcon.Text = startingText;

            runWhenStarts = new MenuItem("Run when system starts", RunWhenStarts);
            runWhenStarts.Checked = registryKey.GetValue(appName) != null;

            statusMenuItem = new MenuItem(startingText);
            statusMenuItem.Enabled = false;

            openMenuItem = new MenuItem("Open", Open);
            openMenuItem.Enabled = false;

            trayIcon.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
            trayIcon.ContextMenu = new ContextMenu(new MenuItem[] {

Review comment (suggestion):
```suggestion
        public UptimeKumaApplicationContext(bool intranetOnly) {
```

See above (GitHub won't let me merge this into one suggestion)

Code after:
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new UptimeKumaApplicationContext(isIntranet));
        }
    }

    public class UptimeKumaApplicationContext : ApplicationContext
    {
        private static Mutex mutex = null;

        const string appName = "Uptime Kuma";

        private NotifyIcon trayIcon;
        private Process process;

        private MenuItem statusMenuItem;
        private MenuItem runWhenStarts;
        private MenuItem openMenuItem;

        private RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);

        private readonly bool intranetOnly;

        public UptimeKumaApplicationContext(bool intranetOnly) {

            // Single instance only
            bool createdNew;
            mutex = new Mutex(true, appName, out createdNew);
            if (!createdNew) {
                return;
            }

            this.intranetOnly = intranetOnly;

            var startingText = "Starting server...";
            trayIcon = new NotifyIcon();
            trayIcon.Text = startingText;

            runWhenStarts = new MenuItem("Run when system starts", RunWhenStarts);
            runWhenStarts.Checked = registryKey.GetValue(appName) != null;

            statusMenuItem = new MenuItem(startingText);
            statusMenuItem.Enabled = false;

            openMenuItem = new MenuItem("Open", Open);
            openMenuItem.Enabled = false;

            trayIcon.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
            trayIcon.ContextMenu = new ContextMenu(new MenuItem[] {
                statusMenuItem,
                openMenuItem,