Ejemplo n.º 1
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);
        }
 public GenericLogsOpenerControlHandler(
     NewLogSourceDialog.IPresenter newLogSourceDialog
     )
 {
     this.newLogSourceDialog = newLogSourceDialog;
     this.controlData        = new ControlData(false, "*1 Open* logs");
 }
        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();
            };
        }
Ejemplo n.º 4
0
 public GenericLogsOpenerControlHandler(
     NewLogSourceDialog.IPresenter newLogSourceDialog
     )
 {
     this.newLogSourceDialog = newLogSourceDialog;
 }
Ejemplo n.º 5
0
        public Presenter(
            ILogSourcesManager logSources,
            IUserDefinedFormatsManager udfManager,
            IRecentlyUsedEntities mru,
            Preprocessing.IManager logSourcesPreprocessings,
            IView view,
            Preprocessing.IStepsFactory preprocessingStepsFactory,
            Workspaces.IWorkspacesManager workspacesManager,
            SourcesList.IPresenter sourcesListPresenter,
            NewLogSourceDialog.IPresenter newLogSourceDialogPresenter,
            IHeartBeatTimer heartbeat,
            SharingDialog.IPresenter sharingDialogPresenter,
            HistoryDialog.IPresenter historyDialogPresenter,
            IPresentersFacade facade,
            SourcePropertiesWindow.IPresenter sourcePropertiesWindowPresenter,
            IAlertPopup alerts,
            ITraceSourceFactory traceSourceFactory,
            IChangeNotification changeNotification
            )
        {
            this.logSources = logSources;
            this.udfManager = udfManager;
            this.mru        = mru;
            this.view       = view;
            this.logSourcesPreprocessings    = logSourcesPreprocessings;
            this.preprocessingStepsFactory   = preprocessingStepsFactory;
            this.workspacesManager           = workspacesManager;
            this.newLogSourceDialogPresenter = newLogSourceDialogPresenter;
            this.sourcesListPresenter        = sourcesListPresenter;
            this.tracer = traceSourceFactory.CreateTraceSource("UI", "smgr-ui");
            this.sharingDialogPresenter          = sharingDialogPresenter;
            this.historyDialogPresenter          = historyDialogPresenter;
            this.sourcePropertiesWindowPresenter = sourcePropertiesWindowPresenter;
            this.alerts             = alerts;
            this.presentersFacade   = facade;
            this.changeNotification = changeNotification;

            sourcesListPresenter.DeleteRequested += (sender, args) =>
            {
                DeleteSelectedSources();
            };

            logSourcesPreprocessings.PreprocessingAdded += (sender, args) =>
            {
                if ((args.LogSourcePreprocessing.Flags & PreprocessingOptions.HighlightNewPreprocessing) != 0)
                {
                    preprocessingAwaitingHighlighting = args.LogSourcePreprocessing;
                    pendingUpdateFlag.Invalidate();
                }
            };

            heartbeat.OnTimer += (sender, args) =>
            {
                if (pendingUpdateFlag.Validate())
                {
                    UpdateView();
                }
            };

            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;
                };
            }
        }
Ejemplo n.º 7
0
        public Presenter(
            ILogSourcesManager logSources,
            IUserDefinedFormatsManager udfManager,
            IRecentlyUsedEntities mru,
            Preprocessing.ILogSourcesPreprocessingManager logSourcesPreprocessings,
            ILogSourcesController logSourcesController,
            IView view,
            Preprocessing.IPreprocessingStepsFactory preprocessingStepsFactory,
            Workspaces.IWorkspacesManager workspacesManager,
            SourcesList.IPresenter sourcesListPresenter,
            NewLogSourceDialog.IPresenter newLogSourceDialogPresenter,
            IHeartBeatTimer heartbeat,
            SharingDialog.IPresenter sharingDialogPresenter,
            HistoryDialog.IPresenter historyDialogPresenter,
            IPresentersFacade facade,
            SourcePropertiesWindow.IPresenter sourcePropertiesWindowPresenter,
            IAlertPopup alerts
            )
        {
            this.logSources           = logSources;
            this.udfManager           = udfManager;
            this.logSourcesController = logSourcesController;
            this.mru  = mru;
            this.view = view;
            this.logSourcesPreprocessings    = logSourcesPreprocessings;
            this.preprocessingStepsFactory   = preprocessingStepsFactory;
            this.workspacesManager           = workspacesManager;
            this.newLogSourceDialogPresenter = newLogSourceDialogPresenter;
            this.sourcesListPresenter        = sourcesListPresenter;
            this.tracer = new LJTraceSource("UI", "smgr-ui");
            this.sharingDialogPresenter          = sharingDialogPresenter;
            this.historyDialogPresenter          = historyDialogPresenter;
            this.sourcePropertiesWindowPresenter = sourcePropertiesWindowPresenter;
            this.alerts           = alerts;
            this.presentersFacade = facade;

            sourcesListPresenter.DeleteRequested += delegate(object sender, EventArgs args)
            {
                DeleteSelectedSources();
            };
            logSources.OnLogSourceAdded += (sender, args) =>
            {
                UpdateRemoveAllButton();
            };
            logSources.OnLogSourceRemoved += (sender, args) =>
            {
                updateTracker.Invalidate();
                UpdateRemoveAllButton();
            };
            logSourcesPreprocessings.PreprocessingAdded += (sender, args) =>
            {
                updateTracker.Invalidate();
                UpdateRemoveAllButton();
                if ((args.LogSourcePreprocessing.Flags & PreprocessingOptions.HighlightNewPreprocessing) != 0)
                {
                    preprocessingAwaitingHighlighting = args.LogSourcePreprocessing;
                }
            };
            logSourcesPreprocessings.PreprocessingDisposed += (sender, args) =>
            {
                updateTracker.Invalidate();
                UpdateRemoveAllButton();
            };
            logSourcesPreprocessings.PreprocessingChangedAsync += (sender, args) =>
            {
                updateTracker.Invalidate();
            };
            sourcesListPresenter.SelectionChanged += delegate(object sender, EventArgs args)
            {
                bool anySourceSelected  = sourcesListPresenter.SelectedSources.Any();
                bool anyPreprocSelected = sourcesListPresenter.SelectedPreprocessings.Any();
                view.EnableDeleteSelectedSourcesButton(anySourceSelected || anyPreprocSelected);
                view.EnableTrackChangesCheckBox(anySourceSelected);
                UpdateTrackChangesCheckBox();
                view.SetPropertiesButtonState(
                    sourcePropertiesWindowPresenter != null && sourcesListPresenter.SelectedSources.Count() == 1);
            };

            logSources.OnLogSourceVisiblityChanged += (sender, args) =>
            {
                updateTracker.Invalidate();
            };
            logSources.OnLogSourceAnnotationChanged += (sender, args) =>
            {
                updateTracker.Invalidate();
            };
            logSources.OnLogSourceTrackingFlagChanged += (sender, args) =>
            {
                updateTracker.Invalidate();
            };
            logSources.OnLogSourceStatsChanged += (sender, args) =>
            {
                if ((args.Flags & (LogProviderStatsFlag.Error | LogProviderStatsFlag.CachedMessagesCount | LogProviderStatsFlag.State | LogProviderStatsFlag.BytesCount | LogProviderStatsFlag.BackgroundAcivityStatus)) != 0)
                {
                    updateTracker.Invalidate();
                }
            };
            heartbeat.OnTimer += (sender, args) =>
            {
                if (updateTracker.Validate())
                {
                    UpdateView();
                }
            };

            this.sharingDialogPresenter.AvailabilityChanged += (sender, args) =>
            {
                UpdateShareButton();
            };
            this.sharingDialogPresenter.IsBusyChanged += (sender, args) =>
            {
                UpdateShareButton();
            };

            view.SetPresenter(this);

            UpdateShareButton();
        }