void IConfigChangeHandler.ConfigUpdated(ConfigSettings newSettings) { lock (_pollTimer) { if (_pollTimer.Interval != newSettings.PollFrequencyTimeSpan) { _pollTimer.Stop(); _pollTimer.Interval = newSettings.PollFrequencyTimeSpan; lock (_countdownTimer) { _countdownTimer.PollFrequency = newSettings.PollFrequencyTimeSpan; _countdownTimer.Reset(); } _pollTimer.Start(); } } }
void DataFetched(object sender, RunWorkerCompletedEventArgs e) { try { if (e.Error != null) { _fetchExceptionHandler.Handle(e.Error); return; } var xmlResults = e.Result as IEnumerable <string>; IEnumerable <ProjectStatus> projectData = new List <ProjectStatus>(); if (xmlResults != null) { projectData = xmlResults.SelectMany(xml => { try { return(_transformer.Transform(xml)); } catch (Exception exception) { _log.Error(exception); return(new List <ProjectStatus>()); } }); } _view.DataContext = new ViewModels.ViewDataViewModel(_viewSettings, projectData); _discJockey.PlaySounds(projectData); } finally { _view.ShowProgress = false; _pollTimer.Start(); _countdownTimer.Reset(); _countdownTimer.Start(); } }