Mercurial > servermonitor
comparison 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 |
comparison
equal
deleted
inserted
replaced
39:7645122aa7a9 | 40:c4fc74593a78 |
---|---|
46 WarningComboBox.SelectedItem = Settings.Default.WarningAction; | 46 WarningComboBox.SelectedItem = Settings.Default.WarningAction; |
47 InformationComboBox.SelectedItem = Settings.Default.InformationAction; | 47 InformationComboBox.SelectedItem = Settings.Default.InformationAction; |
48 ErrorSoundComboBox.SelectedIndex = getSoundSettingIndex(ErrorSoundComboBox); | 48 ErrorSoundComboBox.SelectedIndex = getSoundSettingIndex(ErrorSoundComboBox); |
49 WarningSoundComboBox.SelectedIndex = getSoundSettingIndex(WarningSoundComboBox); | 49 WarningSoundComboBox.SelectedIndex = getSoundSettingIndex(WarningSoundComboBox); |
50 InformationSoundComboBox.SelectedIndex = getSoundSettingIndex(InformationSoundComboBox); | 50 InformationSoundComboBox.SelectedIndex = getSoundSettingIndex(InformationSoundComboBox); |
51 | |
52 AutorunCheckBox.Enabled = !Helpers.IsMono(); | |
51 } | 53 } |
52 | 54 |
53 /// <summary>Gets whether an autorun registry key for this program exists.</summary> | 55 /// <summary>Gets whether an autorun registry key for this program exists.</summary> |
54 /// <returns>Whether an autorun registry key for this program exists</returns> | 56 /// <returns>Whether an autorun registry key for this program exists</returns> |
55 private bool GetAutorun() | 57 private bool GetAutorun() |
56 { | 58 { |
57 RegistryKey key = Registry.CurrentUser.OpenSubKey(autorunKey, false); | 59 RegistryKey key = Registry.CurrentUser.OpenSubKey(autorunKey, false); |
60 if (key == null) | |
61 { | |
62 return false; | |
63 } | |
58 string value = (string)key.GetValue(autorunName, string.Empty); | 64 string value = (string)key.GetValue(autorunName, string.Empty); |
59 return value.StartsWith(Application.ExecutablePath); | 65 return value.StartsWith(Application.ExecutablePath); |
60 } | 66 } |
61 | 67 |
62 /// <summary>Sets whether this program should automatically start with Windows.</summary> | 68 /// <summary>Sets whether this program should automatically start with Windows.</summary> |
63 /// <param name="autorun">Whether autorun should be enabled or disabled.</param> | 69 /// <param name="autorun">Whether autorun should be enabled or disabled.</param> |
64 private void SetAutorun(bool autorun) | 70 private void SetAutorun(bool autorun) |
65 { | 71 { |
72 if (Helpers.IsMono()) | |
73 { | |
74 return; | |
75 } | |
76 | |
66 RegistryKey key = Registry.CurrentUser.OpenSubKey(autorunKey, true); | 77 RegistryKey key = Registry.CurrentUser.OpenSubKey(autorunKey, true); |
67 if (autorun) | 78 if (autorun) |
68 key.SetValue(autorunName, Application.ExecutablePath.ToString()); | 79 key.SetValue(autorunName, Application.ExecutablePath.ToString()); |
69 else | 80 else |
70 key.DeleteValue(autorunName, false); | 81 key.DeleteValue(autorunName, false); |