public SearchResultMessagesModel( ILogSourcesManager logSources, ISearchManager searchManager, IFiltersFactory filtersFactory ) { this.searchManager = searchManager; logSources.OnLogSourceColorChanged += (s, e) => { OnLogSourceColorChanged?.Invoke(s, e); }; int searchFiltersListVersion = 0; searchManager.SearchResultsChanged += (s, e) => ++ searchFiltersListVersion; searchManager.SearchResultChanged += (s, e) => searchFiltersListVersion += ((e.Flags & SearchResultChangeFlag.VisibleChanged) != 0 ? 1 : 0); this.getSearchFiltersList = Selectors.Create( () => searchFiltersListVersion, _ => { var list = filtersFactory.CreateFiltersList(FilterAction.Exclude, FiltersListPurpose.Search); foreach (var f in searchManager .Results .Where(r => r.Visible && r.OptionsFilter != null) .Select(r => r.OptionsFilter)) { list.Insert(list.Items.Count, f.Clone()); } return(list); } ); }
public SearchResultMessagesModel( ILogSourcesManager logSources, ISearchManager searchManager, IFiltersFactory filtersFactory, IModelThreads threads, IBookmarks bookmarks, Settings.IGlobalSettingsAccessor settings ) { this.logSources = logSources; this.searchManager = searchManager; this.threads = threads; this.bookmarks = bookmarks; this.settings = settings; this.filtersFactory = filtersFactory; logSources.OnLogSourceColorChanged += (s, e) => { OnLogSourceColorChanged?.Invoke(s, e); }; }
public PresentationModel( ILogSourcesManager logSources, ISynchronizationContext sync ) { this.logSources = logSources; this.synchronizationContext = sync; updateSourcesInvoker = new AsyncInvokeHelper(sync, UpdateSources); logSources.OnLogSourceColorChanged += (s, e) => { OnLogSourceColorChanged?.Invoke(s, e); }; logSources.OnLogSourceAdded += (s, e) => { updateSourcesInvoker.Invoke(); }; logSources.OnLogSourceRemoved += (s, e) => { updateSourcesInvoker.Invoke(); }; logSources.OnLogSourceStatsChanged += (s, e) => { if ((e.Flags & LogProviderStatsFlag.PositionsRange) != 0) { if ((e.Flags & LogProviderStatsFlag.AvailableTimeUpdatedIncrementallyFlag) != 0) { FireMessagesChanged(s, isIncrementalChange: true); } else if (IsExposableLogSource(e.Value) && !IsExposableLogSource(e.OldValue)) { updateSourcesInvoker.Invoke(); } else { FireMessagesChanged(s, isIncrementalChange: false); } } }; }
void ILogSourcesManagerInternal.OnSourceColorChanged(ILogSource logSource) { OnLogSourceColorChanged?.Invoke(logSource, EventArgs.Empty); changeNotification.Post(); }