public Presenter( IBookmarks bookmarks, IView view, LogViewer.IPresenter viewerPresenter, SearchResult.IPresenter searchResultPresenter, BookmarksList.IPresenter listPresenter, StatusReports.IPresenter statusReportFactory, IPresentersFacade navHandler, IAlertPopup alerts, ITraceSourceFactory traceSourceFactory ) { this.bookmarks = bookmarks; this.view = view; this.viewerPresenter = viewerPresenter; this.tracer = traceSourceFactory.CreateTraceSource("UI", "ui.bmkm"); this.statusReportFactory = statusReportFactory; this.searchResultPresenter = searchResultPresenter; this.navHandler = navHandler; this.listPresenter = listPresenter; this.alerts = alerts; listPresenter.Click += (s, bmk) => { IPresenter myPublicIntf = this; myPublicIntf.NavigateToBookmark(bmk, BookmarkNavigationOptions.EnablePopups | BookmarkNavigationOptions.BookmarksStringsSet); }; view.SetPresenter(this); }
public Presenter( IBookmarks bookmarks, IView view, LogViewer.IPresenter viewerPresenter, SearchResult.IPresenter searchResultPresenter, BookmarksList.IPresenter listPresenter, StatusReports.IPresenter statusReportFactory, IPresentersFacade navHandler, IViewUpdates viewUpdates, IAlertPopup alerts) { this.bookmarks = bookmarks; this.view = view; this.viewerPresenter = viewerPresenter; this.tracer = new LJTraceSource("UI", "ui.bmkm"); this.statusReportFactory = statusReportFactory; this.searchResultPresenter = searchResultPresenter; this.viewUpdates = viewUpdates; this.navHandler = navHandler; this.listPresenter = listPresenter; this.alerts = alerts; viewerPresenter.FocusedMessageBookmarkChanged += delegate(object sender, EventArgs args) { listPresenter.SetMasterFocusedMessage(viewerPresenter.GetFocusedMessageBookmark()); }; listPresenter.Click += (s, bmk) => { IPresenter myPublicIntf = this; myPublicIntf.NavigateToBookmark(bmk, BookmarkNavigationOptions.EnablePopups | BookmarkNavigationOptions.BookmarksStringsSet); }; view.SetPresenter(this); }
public Presenter( ILogSourcesManager sourcesManager, Preprocessing.ILogSourcesPreprocessingManager preprocessingManager, IInvokeSynchronization invoker, IHeartBeatTimer heartbeat, IPresentersFacade presentersFacade, StatusReports.IPresenter statusReports ) { this.preprocessingManager = preprocessingManager; this.presentersFacade = presentersFacade; this.statusReports = statusReports; this.updateInvokeHelper = new AsyncInvokeHelper(invoker, Update) { ForceAsyncInvocation = true }; sourcesManager.OnLogSourceStatsChanged += (sender, e) => { bool?logSourceNeedsFixing = null; if ((e.Flags & LogProviderStatsFlag.FirstMessageWithTimeConstraintViolation) != 0 || (e.Flags & LogProviderStatsFlag.Error) != 0) { var badMsg = ((ILogSource)sender).Provider.Stats.FirstMessageWithTimeConstraintViolation; var failedWithBoundaryDates = ((ILogSource)sender).Provider.Stats.Error is BadBoundaryDatesException; logSourceNeedsFixing = badMsg != null || failedWithBoundaryDates; } if (logSourceNeedsFixing != null) { bool updated; if (logSourceNeedsFixing.Value) { updated = logSourcesRequiringReordering.Add((ILogSource)sender); } else { updated = logSourcesRequiringReordering.Remove((ILogSource)sender); } if (updated) { updateFlag.Invalidate(); } } }; sourcesManager.OnLogSourceRemoved += (sender, e) => { updateFlag.Invalidate(); }; heartbeat.OnTimer += (sender, e) => { if (e.IsNormalUpdate && updateFlag.Validate()) { Update(); } }; }
public Presenter( ILogSourcesManager logSources, IShutdown shutdown, Progress.IProgressAggregatorFactory progressFactory, IAlertPopup alerts, IFileDialogs fileDialogs, StatusReports.IPresenter statusReport ) { this.logSources = logSources; this.shutdown = shutdown; this.progressFactory = progressFactory; this.alerts = alerts; this.fileDialogs = fileDialogs; this.statusReport = statusReport; }
public PreprocessingInteractionsPresenter( IView view, IManager manager, StatusReports.IPresenter statusReports, IChangeNotification changeNotification ) { this.view = view; this.manager = manager; this.changeNotification = changeNotification; this.manager.PreprocessingYieldFailed += (sender, args) => { statusReports.CreateNewStatusReport().ShowStatusPopup( args.LogSourcePreprocessing.DisplayName, "Failed to handle " + string.Join(", ", args.FailedProviders.Select(provider => provider.Factory.GetUserFriendlyConnectionName(provider.ConnectionParams))), true ); }; this.manager.PreprocessingWillYieldProviders += (sender, arg) => { if ((arg.LogSourcePreprocessing.Flags & PreprocessingOptions.Silent) != 0) { return; } if (arg.Providers.Count == 0) { statusReports.CreateNewStatusReport().ShowStatusPopup( arg.LogSourcePreprocessing.DisplayName, "No log of known format is detected", true ); } else if (arg.Providers.Count > 1) { items.AddRange(arg.Providers.Select((p, i) => new MutableItem(arg, i))); UpdateDialogPromise(); ++itemsRevision; arg.PostponeUntilCompleted(dialogDone.Task); changeNotification.Post(); } }; this.manager.PreprocessingWillDispose += (sender, arg) => { if (items.RemoveAll(i => i.eventArg.LogSourcePreprocessing == arg.LogSourcePreprocessing) > 0) { ++itemsRevision; UpdateDialogPromise(); changeNotification.Post(); } }; this.dialogViewData = Selectors.Create( () => itemsRevision, () => selectedKey, (rev, selectedKey) => { if (items.Count == 0) { return(null); } return(new DialogViewData { Title = "Select logs to load", Items = ImmutableArray.CreateRange(items.Select(item => new ImmutableItem { Title = item.title, IsChecked = item.isChecked, Key = item.key, IsSelected = item.key == selectedKey, })) }); } ); this.view.SetViewModel(this); }
public Presenter( IView view, ISearchManager searchManager, ISearchHistory searchHistory, IUserDefinedSearches userDefinedSearches, ILogSourcesManager sourcesManager, IFiltersFactory filtersFactory, ISearchResultsPanelView searchResultsPanelView, LoadedMessages.IPresenter loadedMessagesPresenter, SearchResult.IPresenter searchResultPresenter, StatusReports.IPresenter statusReportFactory, SearchEditorDialog.IPresenter searchEditorDialog, SearchesManagerDialog.IPresenter searchesManagerDialog, IAlertPopup alerts ) { this.view = view; this.searchManager = searchManager; this.searchHistory = searchHistory; this.filtersFactory = filtersFactory; this.searchResultsPanelView = searchResultsPanelView; this.loadedMessagesPresenter = loadedMessagesPresenter; this.searchResultPresenter = searchResultPresenter; this.statusReportFactory = statusReportFactory; this.sourcesManager = sourcesManager; this.searchesManagerDialog = searchesManagerDialog; this.alerts = alerts; this.quickSearchPresenter = new QuickSearchTextBox.Presenter(view.SearchTextBox); this.searchEditorDialog = searchEditorDialog; InvalidateSearchHistoryList(); searchHistory.OnChanged += (sender, args) => InvalidateSearchHistoryList(); sourcesManager.OnLogSourceAdded += (sender, e) => UpdateSearchControls(); sourcesManager.OnLogSourceRemoved += (sender, e) => UpdateSearchControls(); UpdateSearchControls(); UpdateUserDefinedSearchDependentControls(false); view.SetPresenter(this); quickSearchPresenter.OnSearchNow += (sender, args) => { if (quickSearchPresenter.Text != "") { DoSearch(reverseDirection: args.ReverseSearchModifier); } }; quickSearchPresenter.OnCancelled += (sender, args) => { bool searchCancelled = false; foreach (var r in searchManager.Results.Where(r => r.Status == SearchResultStatus.Active)) { r.Cancel(); searchCancelled = true; } if (!searchCancelled && InputFocusAbandoned != null) { InputFocusAbandoned(this, EventArgs.Empty); } }; quickSearchPresenter.SetSuggestionsHandler((sender, e) => { if (e.Etag == searchListEtag) { return; } foreach (var i in searchHistory.Items) { var description = new StringBuilder(); GetUserFriendlySearchHistoryEntryDescription(i, description); e.AddItem(new QuickSearchTextBox.SuggestionItem() { DisplayString = description.ToString(), SearchString = (i as ISimpleSearchHistoryEntry)?.Options.Template, Category = "recent searches", Data = i }); } foreach (var i in userDefinedSearches.Items) { var description = new StringBuilder(); GetUserFriendlySearchHistoryEntryDescription(i, description); e.AddItem(new QuickSearchTextBox.SuggestionItem() { DisplayString = description.ToString(), LinkText = "edit", Category = "Filters", Data = i }); } e.ConfigureCategory("Filters", linkText: "manage", alwaysVisible: true); e.Etag = searchListEtag; }); quickSearchPresenter.OnCurrentSuggestionChanged += (sender, e) => { var datum = quickSearchPresenter.CurrentSuggestion?.Data; var searchHistoryEntry = datum as ISimpleSearchHistoryEntry; if (searchHistoryEntry != null) { ReadControlsFromSelectedHistoryEntry(searchHistoryEntry); } UpdateUserDefinedSearchDependentControls( datum is IUserDefinedSearch || datum is IUserDefinedSearchHistoryEntry); }; quickSearchPresenter.OnSuggestionLinkClicked += (sender, e) => { var uds = e.Suggestion.Data as IUserDefinedSearch; if (uds == null) { return; } searchEditorDialog.Open(uds); }; quickSearchPresenter.OnCategoryLinkClicked += (sender, e) => { HandleSearchesManagerDialog(); }; userDefinedSearches.OnChanged += (sender, e) => { InvalidateSearchHistoryList(); }; }
public Presenter( ILogSourcesManager logSources, Preprocessing.IManager preprocessingsManager, IView view, LogViewer.IPresenterInternal viewerPresenter, SearchResult.IPresenter searchResultPresenter, SearchPanel.IPresenter searchPanelPresenter, SourcesManager.IPresenter sourcesManagerPresenter, MessagePropertiesDialog.IPresenter messagePropertiesDialogPresenter, LoadedMessages.IPresenter loadedMessagesPresenter, BookmarksManager.IPresenter bookmarksManagerPresenter, IHeartBeatTimer heartBeatTimer, ITabUsageTracker tabUsageTracker, StatusReports.IPresenter statusReportFactory, IDragDropHandler dragDropHandler, IPresentersFacade presentersFacade, IAutoUpdater autoUpdater, Progress.IProgressAggregator progressAggregator, IAlertPopup alerts, SharingDialog.IPresenter sharingDialogPresenter, IssueReportDialogPresenter.IPresenter issueReportDialogPresenter, IShutdownSource shutdown, IColorTheme theme, IChangeNotification changeNotification, ITraceSourceFactory traceSourceFactory ) { this.tracer = traceSourceFactory.CreateTraceSource("UI", "ui.main"); this.logSources = logSources; this.preprocessingsManager = preprocessingsManager; this.view = view; this.tabUsageTracker = tabUsageTracker; this.searchPanelPresenter = searchPanelPresenter; this.searchResultPresenter = searchResultPresenter; this.bookmarksManagerPresenter = bookmarksManagerPresenter; this.viewerPresenter = viewerPresenter; this.presentersFacade = presentersFacade; this.dragDropHandler = dragDropHandler; this.heartBeatTimer = heartBeatTimer; this.autoUpdater = autoUpdater; this.progressAggregator = progressAggregator; this.alerts = alerts; this.sharingDialogPresenter = sharingDialogPresenter; this.issueReportDialogPresenter = issueReportDialogPresenter; this.shutdown = shutdown; this.statusRepors = statusReportFactory; this.theme = theme; this.changeNotification = changeNotification; view.SetViewModel(this); viewerPresenter.ManualRefresh += delegate(object sender, EventArgs args) { using (tracer.NewFrame) { tracer.Info("----> User Command: Refresh"); logSources.Refresh(); } }; viewerPresenter.FocusedMessageBookmarkChanged += delegate(object sender, EventArgs args) { if (searchResultPresenter != null) { searchResultPresenter.MasterFocusedMessage = viewerPresenter.FocusedMessageBookmark; } }; if (messagePropertiesDialogPresenter != null) { viewerPresenter.DefaultFocusedMessageActionCaption = "Show properties..."; viewerPresenter.DefaultFocusedMessageAction += (s, e) => { messagePropertiesDialogPresenter.Show(); }; } if (searchResultPresenter != null) { searchResultPresenter.OnClose += (sender, args) => searchPanelPresenter.CollapseSearchResultPanel(); searchResultPresenter.OnResizingStarted += (sender, args) => view.BeginSplittingSearchResults(); } sourcesManagerPresenter.OnBusyState += (_, evt) => SetWaitState(evt.BusyStateRequired); searchPanelPresenter.InputFocusAbandoned += delegate(object sender, EventArgs args) { loadedMessagesPresenter.LogViewerPresenter.ReceiveInputFocus(); }; loadedMessagesPresenter.OnResizingStarted += (s, e) => view.BeginSplittingTabsPanel(); this.heartBeatTimer.OnTimer += (sender, e) => { if (e.IsRareUpdate) { SetAnalyzingIndication(logSources.Items.Any(s => s.TimeGaps.IsWorking)); } }; logSources.OnLogSourceAdded += (sender, evt) => { UpdateFormCaption(); }; logSources.OnLogSourceRemoved += (sender, evt) => { UpdateFormCaption(); }; progressAggregator.ProgressStarted += (sender, args) => { view.SetTaskbarState(TaskbarState.Progress); UpdateFormCaption(); }; progressAggregator.ProgressEnded += (sender, args) => { view.SetTaskbarState(TaskbarState.Idle); UpdateFormCaption(); }; progressAggregator.ProgressChanged += (sender, args) => { view.UpdateTaskbarProgress(args.ProgressPercentage); UpdateFormCaption(); }; if (sharingDialogPresenter != null) { sharingDialogPresenter.AvailabilityChanged += (sender, args) => { UpdateShareButton(); }; sharingDialogPresenter.IsBusyChanged += (sender, args) => { UpdateShareButton(); }; } ; UpdateFormCaption(); UpdateShareButton(); view.SetIssueReportingMenuAvailablity(issueReportDialogPresenter.IsAvailable); }
public Presenter( ISearchManager searchManager, IBookmarks bookmarks, IFiltersList hlFilters, IView view, IPresentersFacade navHandler, LoadedMessages.IPresenter loadedMessagesPresenter, IHeartBeatTimer heartbeat, ISynchronizationContext uiThreadSynchronization, StatusReports.IPresenter statusReports, LogViewer.IPresenterFactory logViewerPresenterFactory, IColorTheme theme, IChangeNotification changeNotification ) { this.searchManager = searchManager; this.bookmarks = bookmarks; this.hlFilters = hlFilters; this.view = view; this.loadedMessagesPresenter = loadedMessagesPresenter; this.statusReports = statusReports; this.theme = theme; this.changeNotification = changeNotification; var(messagesPresenter, messagesModel) = logViewerPresenterFactory.CreateSearchResultsPresenter( view.MessagesView, loadedMessagesPresenter.LogViewerPresenter); this.messagesPresenter = messagesPresenter; this.messagesPresenter.FocusedMessageDisplayMode = LogViewer.FocusedMessageDisplayModes.Slave; this.messagesPresenter.DblClickAction = Presenters.LogViewer.PreferredDblClickAction.DoDefaultAction; this.messagesPresenter.DefaultFocusedMessageActionCaption = "Go to message"; this.messagesPresenter.DisabledUserInteractions = LogViewer.UserInteraction.RawViewSwitching; this.messagesPresenter.DefaultFocusedMessageAction += async(s, e) => { if (messagesPresenter.FocusedMessage != null) { if (await navHandler.ShowMessage(messagesPresenter.FocusedMessageBookmark, BookmarkNavigationOptions.EnablePopups | BookmarkNavigationOptions.SearchResultStringsSet ).IgnoreCancellation()) { loadedMessagesPresenter.LogViewerPresenter.ReceiveInputFocus(); } } }; this.hlFilters.OnPropertiesChanged += (sender, args) => { if (args.ChangeAffectsFilterResult) { lazyUpdateFlag.Invalidate(); } }; this.hlFilters.OnFiltersListChanged += (sender, args) => { lazyUpdateFlag.Invalidate(); }; this.hlFilters.OnFilteringEnabledChanged += (sender, args) => { lazyUpdateFlag.Invalidate(); }; this.searchManager.SearchResultChanged += (sender, e) => { if ((e.Flags & SearchResultChangeFlag.HitCountChanged) != 0 || (e.Flags & SearchResultChangeFlag.ProgressChanged) != 0 || (e.Flags & SearchResultChangeFlag.PinnedChanged) != 0 || (e.Flags & SearchResultChangeFlag.VisibleChanged) != 0) { lazyUpdateFlag.Invalidate(); } if ((e.Flags & SearchResultChangeFlag.StatusChanged) != 0) { lazyUpdateFlag.Invalidate(); uiThreadSynchronization.Post(ValidateView); uiThreadSynchronization.Post(PostSearchActions); } }; this.searchManager.CombinedSearchResultChanged += (sender, e) => { uiThreadSynchronization.Post(() => messagesModel.RaiseSourcesChanged()); }; this.searchManager.SearchResultsChanged += (sender, e) => { lazyUpdateFlag.Invalidate(); messagesModel.RaiseSourcesChanged(); uiThreadSynchronization.Post(ValidateView); uiThreadSynchronization.Post(PreSearchActions); }; heartbeat.OnTimer += (sender, args) => { if (args.IsNormalUpdate) { ValidateView(); } }; view.SetViewModel(this); UpdateExpandedState(); }