private void timerCallback(object state) { var channel = channelInformationManager.CurrentChannel.Value; var time = channelInformationManager.CurrentTime.Value; if (channel != null && time.HasValue) { SynchronizationContext.Post((_) => { for (int i = RegisteredServices.Count - 1; i >= 0; i--) { ChatCollectService.IChatCollectService service = RegisteredServices[i]; try { NewChatProduced?.Invoke(service.GetChats(channel, time.Value + TimeAdjustment.Value).Select(chat => { chat.SetSourceService(service.ServiceEntry); return(chat); })); } catch (ChatCollectService.ChatCollectException e) { registeredServices.Remove(service); ErrorOccurredInChatCollecting?.Invoke(service, e.Message); service.Dispose(); } } }, null); } }
public void RemoveService(ChatCollectService.IChatCollectService service) { registeredServices.Remove(service); service.Dispose(); }