Example #1
0
        public Presenter(
            Settings.IGlobalSettingsAccessor settings,
            IView view,
            LogViewer.IPresenterFactory logViewerPresenterFactory)
        {
            this.view             = view;
            this.settingsAccessor = settings;

            this.sampleMessagesBaseTime   = DateTime.UtcNow;
            this.colorTable               = new AdjustingColorsGenerator(new PastelColorsGenerator(), PaletteBrightness.Normal);
            this.sampleThreads            = new ModelThreads(colorTable);
            this.dummyModel               = new LogViewer.DummyModel(threads: sampleThreads);
            this.sampleLogViewerPresenter = logViewerPresenterFactory.Create(
                dummyModel, view.PreviewLogView, createIsolatedPresenter: true);
            this.sampleLogViewerPresenter.ShowTime                 = false;
            this.sampleLogViewerPresenter.ShowRawMessages          = false;
            this.sampleLogViewerPresenter.DisabledUserInteractions =
                LogViewer.UserInteraction.FontResizing |
                LogViewer.UserInteraction.RawViewSwitching |
                LogViewer.UserInteraction.FramesNavigationMenu |
                LogViewer.UserInteraction.CopyMenu;

            this.viewFonts = view.PreviewLogView;

            this.fontSizeControl = new LabeledStepperPresenter.Presenter(view.FontSizeControlView);
            this.fontSizeControl.OnValueChanged += (sender, e) => UpdateSampleLogView(fullUpdate: false);

            view.SetPresenter(this);

            InitView();

            UpdateSampleLogView(fullUpdate: true);
        }
        public Presenter(
            IView view,
            ITempFilesManager tempFilesManager,
            LogViewer.IPresenterFactory logViewerPresenterFactory
            )
        {
            this.view = view;
            this.view.SetEventsHandler(this);
            this.tempFilesManager = tempFilesManager;

            this.threads          = new ModelThreads();
            this.logSourceThreads = new LogSourceThreads(
                LJTraceSource.EmptyTracer, threads, null);
            this.model        = new Presenters.LogViewer.DummyModel(threads);
            this.logPresenter = logViewerPresenterFactory.Create(
                model, view.LogViewer, createIsolatedPresenter: true);
            logPresenter.ShowTime = true;
        }
Example #3
0
        public Presenter(
            ILogSourcesManager logSources,
            IBookmarks bookmarks,
            IView view,
            IHeartBeatTimer heartbeat,
            LogViewer.IPresenterFactory logViewerPresenterFactory
            )
        {
            this.logSources        = logSources;
            this.bookmarks         = bookmarks;
            this.view              = view;
            this.messagesPresenter = logViewerPresenterFactory.Create(
                logViewerPresenterFactory.CreateLoadedMessagesModel(),
                view.MessagesView,
                createIsolatedPresenter: false
                );
            this.messagesPresenter.DblClickAction = Presenters.LogViewer.PreferredDblClickAction.SelectWord;
            this.UpdateRawViewButton();
            this.UpdateColoringControls();
            this.messagesPresenter.RawViewModeChanged            += (s, e) => UpdateRawViewButton();
            this.messagesPresenter.NavigationIsInProgressChanged += (s, e) =>
            { view.SetNavigationProgressIndicatorVisibility(messagesPresenter.NavigationIsInProgress); };
            this.messagesPresenter.ViewTailModeChanged += (s, e) => UpdateViewTailButton();

            heartbeat.OnTimer += (sender, args) =>
            {
                if (args.IsNormalUpdate && rawViewUpdateFlag.Validate())
                {
                    UpdateRawViewAvailability();
                    UpdateRawViewMode();
                    UpdateRawViewButton();
                }
                if (args.IsNormalUpdate && tailUpdateFlag.Validate())
                {
                    UpdateViewTailButton();
                }
            };
            logSources.OnLogSourceRemoved += (sender, evt) =>
            {
                if (logSources.Items.Count(s => !s.IsDisposed) == 0)
                {
                    automaticRawView = true;                     // reset automatic mode when last source is gone
                }
                rawViewUpdateFlag.Invalidate();
                tailUpdateFlag.Invalidate();
            };
            logSources.OnLogSourceAdded += (sender, evt) =>
            {
                rawViewUpdateFlag.Invalidate();
                tailUpdateFlag.Invalidate();
            };
            logSources.OnLogSourceVisiblityChanged += (sender, evt) =>
            {
                rawViewUpdateFlag.Invalidate();
                tailUpdateFlag.Invalidate();
            };


            this.view.SetEventsHandler(this);

            tailUpdateFlag.Invalidate();
            rawViewUpdateFlag.Invalidate();
        }
        public Presenter(
            ISearchManager searchManager,
            IBookmarks bookmarks,
            IFiltersList hlFilters,
            IView view,
            IPresentersFacade navHandler,
            LoadedMessages.IPresenter loadedMessagesPresenter,
            IHeartBeatTimer heartbeat,
            IInvokeSynchronization uiThreadSynchronization,
            StatusReports.IPresenter statusReports,
            LogViewer.IPresenterFactory logViewerPresenterFactory
            )
        {
            this.searchManager           = searchManager;
            this.bookmarks               = bookmarks;
            this.hlFilters               = hlFilters;
            this.view                    = view;
            this.loadedMessagesPresenter = loadedMessagesPresenter;
            this.statusReports           = statusReports;
            var messagesModel = logViewerPresenterFactory.CreateSearchResultsModel();

            this.messagesPresenter = logViewerPresenterFactory.Create(
                messagesModel,
                view.MessagesView,
                createIsolatedPresenter: false
                );
            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.GetFocusedMessageBookmark(),
                                                     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);
            };
            this.UpdateRawViewMode();
            this.UpdateColoringMode();

            heartbeat.OnTimer += (sender, args) =>
            {
                if (args.IsNormalUpdate)
                {
                    ValidateView();
                }
            };

            loadedMessagesPresenter.LogViewerPresenter.RawViewModeChanged += (sender, args) =>
            {
                UpdateRawViewMode();
            };
            loadedMessagesPresenter.LogViewerPresenter.ColoringModeChanged += (sender, args) =>
            {
                UpdateColoringMode();
            };

            view.SetEventsHandler(this);
            UpdateExpandedState();
        }