public Presenter(
            ILogSourcesManager logSources,
            IView view,
            ILogSourcesPreprocessingManager logSourcesPreprocessings,
            SourcePropertiesWindow.IPresenter propertiesWindowPresenter,
            LogViewer.IPresenter logViewerPresenter,
            IPresentersFacade navHandler,
            IAlertPopup alerts,
            IFileDialogs fileDialogs,
            IClipboardAccess clipboard,
            IShellOpen shellOpen,
            SaveJointLogInteractionPresenter.IPresenter saveJointLogInteractionPresenter
            )
        {
            this.logSources = logSources;
            this.view       = view;
            this.propertiesWindowPresenter = propertiesWindowPresenter;
            this.logViewerPresenter        = logViewerPresenter;
            this.logSourcesPreprocessings  = logSourcesPreprocessings;
            this.alerts      = alerts;
            this.fileDialogs = fileDialogs;
            this.clipboard   = clipboard;
            this.shellOpen   = shellOpen;
            this.saveJointLogInteractionPresenter = saveJointLogInteractionPresenter;

            logViewerPresenter.FocusedMessageChanged += (sender, args) =>
            {
                view.InvalidateFocusedMessageArea();
            };

            view.SetPresenter(this);
        }
Example #2
0
        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);
        }
Example #3
0
        public Presenter(
            IView view,
            ILogSourcesManager logSources,
            Preprocessing.ILogSourcesPreprocessingManager preprocessings,
            IPresentersFacade navHandler,
            IAlertPopup alerts,
            IClipboardAccess clipboard,
            IShellOpen shellOpen
            )
        {
            this.view             = view;
            this.presentersFacade = navHandler;
            this.alerts           = alerts;
            this.preprocessings   = preprocessings;
            this.clipboard        = clipboard;
            this.shellOpen        = shellOpen;
            this.logSources       = logSources;

            view.SetEventsHandler(this);

            logSources.OnLogSourceColorChanged += (s, e) =>
            {
                if (object.ReferenceEquals(s, source) && currentWindow != null)
                {
                    UpdateColorPanel();
                }
            };
        }
        public PluginTabPagePresenter(
            IView view,
            IPostprocessorsManager postprocessorsManager,
            IPostprocessorOutputFormFactory outputFormsFactory,
            ILogSourcesManager logSourcesManager,
            ITempFilesManager tempFiles,
            IShellOpen shellOpen,
            NewLogSourceDialog.IPresenter newLogSourceDialog,
            Telemetry.ITelemetryCollector telemetry
            )
        {
            this.view = view;
            this.view.SetEventsHandler(this);
            this.postprocessorsManager = postprocessorsManager;
            this.outputFormsFactory    = outputFormsFactory;
            this.tempFiles             = tempFiles;
            this.shellOpen             = shellOpen;
            this.newLogSourceDialog    = newLogSourceDialog;
            this.telemetry             = telemetry;

            logSourcesManager.OnLogSourceAnnotationChanged += (sender, e) =>
            {
                RefreshView();
            };
        }
 public CorrelatorPostprocessorControlHandler(
     IPostprocessorsManager postprocessorsManager,
     ITempFilesManager tempFilesManager,
     IShellOpen shellOpen
     )
 {
     this.postprocessorsManager = postprocessorsManager;
     this.tempFilesManager      = tempFilesManager;
     this.postprocessorId       = PostprocessorIds.Correlator;
     this.shellOpen             = shellOpen;
 }
Example #6
0
 public CorrelatorPostprocessorControlHandler(
     ICorrelationManager correlationManager,
     ITempFilesManager tempFilesManager,
     IShellOpen shellOpen
     )
 {
     this.correlationManager = correlationManager;
     this.tempFilesManager   = tempFilesManager;
     this.shellOpen          = shellOpen;
     this.getControlData     = Selectors.Create(
         () => correlationManager.StateSummary,
         GetCurrentData
         );
 }
Example #7
0
 public static PresentationObjects Create(
     ModelObjects model,
     IClipboardAccess clipboardAccess,
     IShellOpen shellOpen,
     IAlertPopup alertPopup,
     IFileDialogs fileDialogs,
     IPromptDialog promptDialog,
     About.IAboutConfig aboutConfig,
     MainForm.IDragDropHandler dragDropHandler,
     ISystemThemeDetector systemThemeDetector,
     IViewsFactory views
     )
 {
     T callOptionalFactory <T>(Func <T> factory) where T : class
        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);
        }
Example #9
0
 public LogSourcePostprocessorControlHandler(
     IManagerInternal postprocessorsManager,
     PostprocessorKind postprocessorKind,
     Func <IPostprocessorVisualizerPresenter> visualizerPresenter,
     IShellOpen shellOpen,
     ITempFilesManager tempFiles
     )
 {
     this.postprocessorsManager = postprocessorsManager;
     this.postprocessorKind     = postprocessorKind;
     this.visualizerPresenter   = visualizerPresenter;
     this.shellOpen             = shellOpen;
     this.tempFiles             = tempFiles;
     this.getOutputs            = Selectors.Create(
         () => postprocessorsManager.LogSourcePostprocessors,
         outputs => ImmutableList.CreateRange(
             outputs.Where(output => output.Postprocessor.Kind == postprocessorKind)
             )
         );
     this.getControlData = Selectors.Create(
         getOutputs,
         outputs => GetCurrentData(outputs, postprocessorKind)
         );
 }
Example #10
0
 public Presenter(IShellOpen shellOpen)
 {
     this.shellOpen = shellOpen;
 }
        public Presenter(
            ILogSourcesManager logSources,
            IView view,
            IManager logSourcesPreprocessings,
            SourcePropertiesWindow.IPresenter propertiesWindowPresenter,
            LogViewer.IPresenterInternal logViewerPresenter,
            IAlertPopup alerts,
            IFileDialogs fileDialogs,
            IClipboardAccess clipboard,
            IShellOpen shellOpen,
            SaveJointLogInteractionPresenter.IPresenter saveJointLogInteractionPresenter,
            IColorTheme theme,
            IChangeNotification changeNotification,
            IHeartBeatTimer heartbeat
            )
        {
            this.logSources = logSources;
            this.view       = view;
            this.propertiesWindowPresenter = propertiesWindowPresenter;
            this.logSourcesPreprocessings  = logSourcesPreprocessings;
            this.alerts      = alerts;
            this.fileDialogs = fileDialogs;
            this.clipboard   = clipboard;
            this.shellOpen   = shellOpen;
            this.saveJointLogInteractionPresenter = saveJointLogInteractionPresenter;
            this.changeNotification = changeNotification;

            void updateItems()
            {
                itemsRevision++;
                changeNotification.Post();
            }

            logSources.OnLogSourceVisiblityChanged  += (s, e) => updateItems();
            logSources.OnLogSourceAnnotationChanged += (s, e) => updateItems();
            logSources.OnLogSourceColorChanged      += (s, e) => updateItems();

            logSourcesPreprocessings.PreprocessingChangedAsync += (s, e) => pendingUpdateFlag.Invalidate();
            logSources.OnLogSourceStatsChanged += (s, e) =>
            {
                if ((e.Flags & (LogProviderStatsFlag.Error | LogProviderStatsFlag.CachedMessagesCount | LogProviderStatsFlag.State | LogProviderStatsFlag.BytesCount | LogProviderStatsFlag.BackgroundAcivityStatus)) != 0)
                {
                    pendingUpdateFlag.Invalidate();
                }
            };

            heartbeat.OnTimer += (s, e) =>
            {
                if (pendingUpdateFlag.Validate())
                {
                    updateItems();
                }
            };

            this.getRoot = Selectors.Create(
                () => logSources.Items,
                () => logSourcesPreprocessings.Items,
                () => theme.ThreadColors,
                () => expandedKeys,
                () => selectedKeys,
                () => itemsRevision,
                (sources, preprocessings, themeColors, expanded, selected, rev) => new RootViewItem
            {
                Items = ImmutableArray.CreateRange(
                    EnumItemsData(sources, preprocessings, themeColors, expanded, selected, logSourcesPreprocessings))
            }
                );

            this.getSelectedSources = Selectors.Create(
                getRoot,
                root => ImmutableArray.CreateRange(
                    ViewItem.Flatten(root).Where(i => i.IsSelected).SelectMany(i =>
            {
                if (i is LogSourceViewItem singleSource)
                {
                    return new[] { singleSource.LogSource }
                }
                ;
                if (i is SourcesContainerViewItem container)
                {
                    return(container.LogSources.Select(x => x.LogSource));
                }
                return(Enumerable.Empty <ILogSource>());
            })
                    .Distinct()
                    )
                );

            this.getSelectedPreprocessings = Selectors.Create(
                getRoot,
                root => ImmutableArray.CreateRange(
                    ViewItem.Flatten(root).OfType <PreprocessingViewItem>().Select(p => p.Preprocessing)
                    )
                );

            this.getFocusedMessageItem = Selectors.Create(
                () => logViewerPresenter.FocusedMessage,
                getRoot,
                (msg, root) =>
            {
                var ls = msg?.GetLogSource();
                return((IViewItem)ViewItem.Flatten(root).FirstOrDefault(
                           i => (i as LogSourceViewItem)?.LogSource == ls
                           ));
            }
                );

            view.SetViewModel(this);
        }
        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;
                };
            }
        }
 public MarkdownService(IFileSystemOperations fileSystemOperations, IShellOpen shellOpen)
 {
     this.fileSystemOperations = fileSystemOperations;
     this.shellOpen            = shellOpen;
 }