diff --git a/HudsonTrayTracker/UI/Controls/NotificationSettingsControl.cs b/HudsonTrayTracker/UI/Controls/NotificationSettingsControl.cs index 451a028..ad9bcfb 100644 --- a/HudsonTrayTracker/UI/Controls/NotificationSettingsControl.cs +++ b/HudsonTrayTracker/UI/Controls/NotificationSettingsControl.cs @@ -42,7 +42,10 @@ protected override void OnLoad(EventArgs e) if (DesignMode || Process.GetCurrentProcess().ProcessName == "devenv") return; - configurationService = (ConfigurationService)ContextRegistry.GetContext().GetObject("ConfigurationService"); + if (configurationService == null) + { + configurationService = (ConfigurationService)ContextRegistry.GetContext().GetObject("ConfigurationService"); + } statusLabel.Text = HudsonTrayTrackerResources.ResourceManager.GetString("NotificationSettings_" + Status); SoundPath = configurationService.GetSoundPath(Status); @@ -71,6 +74,11 @@ private void ChooseFile() private void SetPath(string path) { + if (configurationService == null) + { + configurationService = (ConfigurationService)ContextRegistry.GetContext().GetObject("ConfigurationService"); + } + configurationService.SetSoundPath(Status, path); SoundPath = path; }