public ChatModule( TVTCommentSettings settings, IEnumerable <ChatService.IChatService> chatServices, ChatCollectServiceModule collectServiceModule, IPCModule ipc, ChannelInformationModule channelInformationModule ) { Chats = new ReadOnlyObservableCollection <Chat>(chats); ChatModRules = new ReadOnlyObservableCollection <ChatModRuleEntry>(chatModRules); this.settings = settings; this.chatServices = chatServices; this.ipc = ipc; this.collectServiceModule = collectServiceModule; disposables.Add(ChatPreserveCount.Subscribe(x => onChatPreserveCountChanged())); disposables.Add(channelInformationModule.CurrentChannel.Subscribe(x => { if (ClearChatsOnChannelChange.Value) { ClearChats(); } })); collectServiceModule.NewChatProduced += collectServiceModule_NewChatProduced; loadSettings(); }
public ChatCollectServiceCreationPresetModule( TVTCommentSettings settings, IEnumerable <ChatCollectServiceEntry.IChatCollectServiceEntry> collectServiceEntries ) { this.settings = settings; this.collectServiceEntries = collectServiceEntries; CreationPresets = new ReadOnlyObservableCollection <ChatCollectServiceCreationPreset>(creationPresets); }
public DefaultChatCollectServiceModule( TVTCommentSettings settings, ChannelInformationModule channelInformationModule, ChatCollectServiceModule collectServiceModule, IEnumerable <ChatCollectServiceEntry.IChatCollectServiceEntry> serviceEntryList ) { this.settings = settings; this.channelInformationModule = channelInformationModule; this.collectServiceModule = collectServiceModule; this.serviceEntryList = serviceEntryList; loadSettings(); disposables.Add(channelInformationModule.CurrentTime.Subscribe(timeChanged)); disposables.Add(LiveChatCollectService.ObserveCollectionChanged(newServiceEntry => { if (IsEnabled.Value && !lastIsRecord.GetValueOrDefault(true)) { if (collectServiceModule.RegisteredServices.All(x => x.ServiceEntry != newServiceEntry)) { collectServiceModule.AddService(newServiceEntry, null); } } }, oldServiceEntry => { if (IsEnabled.Value && !lastIsRecord.GetValueOrDefault(true)) { foreach (var service in collectServiceModule.RegisteredServices.Where(x => x.ServiceEntry == oldServiceEntry)) { collectServiceModule.RemoveService(service); } } }, () => { if (IsEnabled.Value && !lastIsRecord.GetValueOrDefault(true)) { collectServiceModule.ClearServices(); } })); disposables.Add(RecordChatCollectService.ObserveCollectionChanged(newServiceEntry => { if (IsEnabled.Value && lastIsRecord.GetValueOrDefault(false)) { if (collectServiceModule.RegisteredServices.All(x => x.ServiceEntry != newServiceEntry)) { collectServiceModule.AddService(newServiceEntry, null); } } }, oldServiceEntry => { if (IsEnabled.Value && lastIsRecord.GetValueOrDefault(false)) { foreach (var service in collectServiceModule.RegisteredServices.Where(x => x.ServiceEntry == oldServiceEntry)) { collectServiceModule.RemoveService(service); } } }, () => { if (IsEnabled.Value && lastIsRecord.GetValueOrDefault(false)) { collectServiceModule.ClearServices(); } })); disposables.Add(channelInformationModule.CurrentTime.Subscribe(timeChanged)); }