public MainForm() { InitializeComponent(); updatesKiller = new UpdatesKiller(Settings.Instance.data.KillWindowsUpdate); SetupSettingsToggles(); ContextMenu sysTrayContextMenu = new ContextMenu(); sysTrayContextMenu.MenuItems.Add("Open Win10BSFixer", (_, __) => { Show(); this.WindowState = FormWindowState.Normal; }); sysTrayContextMenu.MenuItems.Add("Exit", (_, __) => { ReallyExit(); }); NotifyIcon.ContextMenu = sysTrayContextMenu; if (RunOnStartupHandler.Installed()) { InstallButton.Text = "Uninstall"; } else { InstallButton.Text = "Install + run on startup"; } }
private void InstallButton_Click(object sender, EventArgs e) { if (!RunOnStartupHandler.Installed()) { RunOnStartupHandler.InstallAndScheduleForStartup(); } else { RunOnStartupHandler.Uninstall(); } if (RunOnStartupHandler.Installed()) { InstallButton.Text = "Uninstall"; } else { InstallButton.Text = "Install + run on startup"; } }