public Presenter( IView view, IManager postprocessorsManager, IPostprocessorOutputFormFactory outputFormsFactory, ILogSourcesManager logSourcesManager, ITempFilesManager tempFiles, IShellOpen shellOpen, NewLogSourceDialog.IPresenter newLogSourceDialog, Telemetry.ITelemetryCollector telemetry, IChangeNotification changeNotification, MainForm.IPresenter mainFormPresenter ) { this.view = view; this.postprocessorsManager = postprocessorsManager; this.outputFormsFactory = outputFormsFactory; this.tempFiles = tempFiles; this.shellOpen = shellOpen; this.newLogSourceDialog = newLogSourceDialog; this.telemetry = telemetry; this.changeNotification = changeNotification.CreateChainedChangeNotification(false); this.view.SetViewModel(this); logSourcesManager.OnLogSourceAnnotationChanged += (sender, e) => { RefreshView(); }; // todo: create when there a least one postprocessor exists. Postprocessors may come from plugins or it can be internal trace. mainFormPresenter.AddCustomTab(view.UIControl, TabCaption, this); mainFormPresenter.TabChanging += (sender, e) => OnTabPageSelected(e.CustomTabTag == this); }
public Presenter( IView view, ILogSourcesManager logSources, Preprocessing.IManager preprocessings, IModelThreads threads, IPresentersFacade navHandler, IAlertPopup alerts, IClipboardAccess clipboard, IShellOpen shellOpen, IColorTheme theme, IHeartBeatTimer heartBeat, IChangeNotification changeNotification ) { this.view = view; this.presentersFacade = navHandler; this.alerts = alerts; this.preprocessings = preprocessings; this.clipboard = clipboard; this.shellOpen = shellOpen; this.theme = theme; this.changeNotification = changeNotification.CreateChainedChangeNotification(initiallyActive: false); logSources.OnLogSourceStatsChanged += (s, e) => { if (s == logSources) { pendingUpdateFlag.Invalidate(); } }; threads.OnThreadListChanged += (s, e) => pendingUpdateFlag.Invalidate(); threads.OnThreadPropertiesChanged += (s, e) => pendingUpdateFlag.Invalidate(); heartBeat.OnTimer += (s, e) => { if (pendingUpdateFlag.Validate()) { ++forceUpdateRevision; changeNotification.Post(); } }; this.getViewState = () => emptyViewState; view.SetViewModel(this); }
public Presenter( IView view, IPluginsManagerInternal pluginsManager, IChangeNotification changeNotification, AutoUpdate.IAutoUpdater autoUpdater ) { this.pluginsManager = pluginsManager; this.view = view; this.autoUpdater = autoUpdater; this.changeNotification = changeNotification.CreateChainedChangeNotification(); this.fetchCancellation = new CancellationTokenSource(); this.pluginInstallationRequestsBuilder = pluginsManager.CreatePluginInstallationRequestsBuilder(); this.listItemsSelector = Selectors.Create( () => pluginInstallationRequestsBuilder.InstallationRequests, () => pluginsInfo, () => selectedPlugin, (requests, all, selected) => { return(ImmutableArray.CreateRange(all.Select(p => new ListItem(p, requests, selected?.Id)))); } ); this.selectedPluginDataSelector = Selectors.Create( listItemsSelector, list => { var itemData = list.Select(i => i.MakeSelectedPluginData()).FirstOrDefault(i => i != null); return(itemData ?? new SelectedPluginData { actionCaption = "Install", actionEnabled = false, caption = "", description = "" }); } ); view.SetViewModel(this); this.FetchPlugins(); }
public Presenter( IView view, IManagerInternal postprocessorsManager, ICorrelationManager correlationManager, IFactory presentersFactory, ITempFilesManager tempFiles, IShellOpen shellOpen, NewLogSourceDialog.IPresenter newLogSourceDialog, IChangeNotification changeNotification, MainForm.IPresenter mainFormPresenter ) { this.view = view; this.postprocessorsManager = postprocessorsManager; this.correlationManager = correlationManager; this.presentersFactory = presentersFactory; this.tempFiles = tempFiles; this.shellOpen = shellOpen; this.changeNotification = changeNotification.CreateChainedChangeNotification(false); InitAndAddProstprocessorHandler(ViewControlId.StateInspector, PostprocessorKind.StateInspector); InitAndAddProstprocessorHandler(ViewControlId.Timeline, PostprocessorKind.Timeline); InitAndAddProstprocessorHandler(ViewControlId.Sequence, PostprocessorKind.SequenceDiagram); InitAndAddProstprocessorHandler(ViewControlId.Correlate, PostprocessorKind.Correlator); InitAndAddProstprocessorHandler(ViewControlId.TimeSeries, PostprocessorKind.TimeSeries); viewControlHandlers.Add(ViewControlId.LogsCollectionControl1, new GenericLogsOpenerControlHandler(newLogSourceDialog)); viewControlHandlers.Add(ViewControlId.AllPostprocessors, new AllPostprocessorsControlHandler(postprocessorsManager, correlationManager)); this.getControlsData = Selectors.Create( () => ( viewControlHandlers[ViewControlId.StateInspector].GetCurrentData(), viewControlHandlers[ViewControlId.Timeline].GetCurrentData(), viewControlHandlers[ViewControlId.Sequence].GetCurrentData(), viewControlHandlers[ViewControlId.Correlate].GetCurrentData(), viewControlHandlers[ViewControlId.TimeSeries].GetCurrentData(), viewControlHandlers[ViewControlId.LogsCollectionControl1].GetCurrentData(), viewControlHandlers[ViewControlId.AllPostprocessors].GetCurrentData() ), _ => { return(ImmutableDictionary.CreateRange( viewControlHandlers.Select(h => new KeyValuePair <ViewControlId, ControlData>(h.Key, h.Value.GetCurrentData())) )); } ); this.getActionStates = Selectors.Create( getControlsData, ctrlData => ImmutableDictionary.CreateRange( ctrlData.Select(h => { Action makeAction(string id) => h.Value.Content.Contains($"*{id}") ? () => viewControlHandlers[h.Key].ExecuteAction(id, ClickFlags.None) : (Action)null; return(new KeyValuePair <ViewControlId, ActionState>( h.Key, new ActionState { Enabled = !h.Value.Disabled, Run = makeAction(Constants.RunActionId), Show = makeAction(Constants.ShowVisualizerActionId) } )); }) ) ); this.view.SetViewModel(this); if (IsBrowser.Value) { this.changeNotification.Active = true; } else { mainFormPresenter.TabChanging += (sender, e) => { this.changeNotification.Active = e.TabID == MainForm.TabIDs.Postprocessing; }; } }