/// <param name="form">Implentation of <see cref="IForm"/></param> public Presenter(IForm form, MainForm.IPresenter mainFormPresenter) { this.form = form; this.mainFormPresenter = mainFormPresenter; ShowPreview(); }
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 static void Init( Dialog.IPresenter optionsDialogPresenter, Plugins.IPageAvailability pluginsPageAvailability, Persistence.IStorageManager storageManager, MainForm.IPresenter mainFormPresenter, IAlertPopup popup ) { async void handler(object s, EventArgs e) { mainFormPresenter.Loaded -= handler; if (pluginsPageAvailability.IsAvailable) { bool showOffer = false; var storageEntry = storageManager.GetEntry("PluginsInstallationOffer"); using (var section = storageEntry.OpenXMLSection("state", Persistence.StorageSectionOpenFlag.ReadWrite)) { if (section.Data.Root == null) { showOffer = true; section.Data.Add(new XElement("root")); } } if (showOffer) { await Task.Delay(1000); string pluginsLocation = "LogJoint options dialog"; if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { pluginsLocation = "menu LogJoint -> Preferences... -> Plug-ins"; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { pluginsLocation = "Options... -> Configuration... -> Plug-ins"; } if (popup.ShowPopup( "Plug-ins", "LogJoint offers features via plug-ins. Do you want to choose plug-ins now?" + Environment.NewLine + Environment.NewLine + "You can manage plug-ins any time in " + Environment.NewLine + pluginsLocation, AlertFlags.YesNoCancel ) == AlertFlags.Yes) { optionsDialogPresenter.ShowDialog(Dialog.PageId.Plugins); } } } } mainFormPresenter.Loaded += handler; }
public void Init( MessagePropertiesDialog.IPresenter messagePropertiesDialogPresenter, ThreadsList.IPresenter threadsListPresenter, SourcesList.IPresenter sourcesListPresenter, BookmarksManager.IPresenter bookmarksManagerPresenter, MainForm.IPresenter mainFormPresenter, About.IPresenter aboutDialogPresenter, Options.Dialog.IPresenter optionsDialogPresenter, HistoryDialog.IPresenter historyDialogPresenter ) { this.messagePropertiesDialogPresenter = messagePropertiesDialogPresenter; this.threadsListPresenter = threadsListPresenter; this.sourcesListPresenter = sourcesListPresenter; this.bookmarksManagerPresenter = bookmarksManagerPresenter; this.mainFormPresenter = mainFormPresenter; this.optionsDialogPresenter = optionsDialogPresenter; this.historyDialogPresenter = historyDialogPresenter; this.aboutDialogPresenter = aboutDialogPresenter; }
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; }; } }