Mercurial > servermonitor
diff ServerMonitor/Forms/SettingsForm.cs @ 40:c4fc74593a78 default tip
Mono fix
author | Brad Greco <brad@bgreco.net> |
---|---|
date | Sat, 13 Jun 2020 13:28:20 -0400 |
parents | 7645122aa7a9 |
children |
line wrap: on
line diff
--- a/ServerMonitor/Forms/SettingsForm.cs Tue Jun 09 20:59:00 2020 -0400 +++ b/ServerMonitor/Forms/SettingsForm.cs Sat Jun 13 13:28:20 2020 -0400 @@ -48,6 +48,8 @@ ErrorSoundComboBox.SelectedIndex = getSoundSettingIndex(ErrorSoundComboBox); WarningSoundComboBox.SelectedIndex = getSoundSettingIndex(WarningSoundComboBox); InformationSoundComboBox.SelectedIndex = getSoundSettingIndex(InformationSoundComboBox); + + AutorunCheckBox.Enabled = !Helpers.IsMono(); } /// <summary>Gets whether an autorun registry key for this program exists.</summary> @@ -55,6 +57,10 @@ private bool GetAutorun() { RegistryKey key = Registry.CurrentUser.OpenSubKey(autorunKey, false); + if (key == null) + { + return false; + } string value = (string)key.GetValue(autorunName, string.Empty); return value.StartsWith(Application.ExecutablePath); } @@ -63,6 +69,11 @@ /// <param name="autorun">Whether autorun should be enabled or disabled.</param> private void SetAutorun(bool autorun) { + if (Helpers.IsMono()) + { + return; + } + RegistryKey key = Registry.CurrentUser.OpenSubKey(autorunKey, true); if (autorun) key.SetValue(autorunName, Application.ExecutablePath.ToString());