Repository: Kyome22/RunCat_for_windows
File: RunCat365/Program.cs (C#)

Code before:
                var keyName = @"Software\Microsoft\Windows\CurrentVersion\Run";
                using var rKey = Registry.CurrentUser.OpenSubKey(keyName);
                if (rKey is null) return false;
                var value = (rKey.GetValue(Application.ProductName) is not null);
                rKey.Close();
                return value;
            }
        }

        private static async Task<bool> SetStartupAsync(bool isChecked) {
            if (IsRunningAsPackaged()) {
                bool active = !isChecked;
                bool changeCheck = false;
                if (startupTask is null) startupTask = await StartupTask.GetAsync("RunCatStartup");
                if (active) {
                    switch (startupTask.State) {
                        case StartupTaskState.Enabled:
                            changeCheck = true;
                            break;
                        case StartupTaskState.Disabled:
                            StartupTaskState newState = await startupTask.RequestEnableAsync();
                            if (newState == StartupTaskState.Enabled) {
                                changeCheck = true;
                            } else {
                                MessageBox.Show("Launch at Startup could not be activated.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                changeCheck = false;
                            }
                            break;
                        case StartupTaskState.DisabledByUser:
                            MessageBox.Show("Launch at startup was disabled by the user, enable it in Task Manager > Startup, search RunCat365 and enable it.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            changeCheck = false;
                            break;
                        case StartupTaskState.DisabledByPolicy:
                            MessageBox.Show("Launch at startup was disabled by policy.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            changeCheck = false;
                            break;
                    }
                } else if (!active) {
                    if (startupTask.State == StartupTaskState.Enabled) startupTask.Disable();
                    changeCheck = true;
                }
                return changeCheck;
            } else {
                var productName = Application.ProductName;
                if (productName is null) return false;
                var keyName = @"Software\Microsoft\Windows\CurrentVersion\Run";
                using var rKey = Registry.CurrentUser.OpenSubKey(keyName, true);
                if (rKey is null) return false;
                if (isChecked) {
                    rKey.DeleteValue(productName, false);
                } else {

Review comment (suggestion):
`MessageBox.Show` is a UI-related operation, right? Please separate the UI logic from the business logic. At the very least, I'd prefer not to have UI-related code directly in `Program.cs`.

Code after:
            }
        }

        private void UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
        {
            if (e.Category == UserPreferenceCategory.General)
            {
                var systemTheme = GetSystemTheme();
                contextMenuManager.SetIcons(systemTheme, manualTheme, runner);
            }
        }

        private static void OpenRepository()
        {
            try
            {
                Process.Start(new ProcessStartInfo()
                {
                    FileName = "https://github.com/Kyome22/RunCat365.git",
                    UseShellExecute = true
                });
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e.Message}");
            }
        }

        private void Exit()
        {
            cpuRepository.Close();
            animateTimer.Stop();
            fetchTimer.Stop();
            contextMenuManager.HideNotifyIcon();
            Application.Exit();
        }

        private void OnApplicationExit(object? sender, EventArgs e)
        {
            UserSettings.Default.Runner = runner.ToString();
            UserSettings.Default.Theme = manualTheme.ToString();
            UserSettings.Default.FPSMaxLimit = fpsMaxLimit.ToString();
            UserSettings.Default.Save();
        }

        private void AnimationTick(object? sender, EventArgs e)
        {
            contextMenuManager.AdvanceFrame();
        }

        private void FetchSystemInfo(