Exemplo n.º 1
0
        public Presenter(
            IView view,
            ITempFilesManager tempFilesManager,
            ITraceSourceFactory traceSourceFactory,
            RegularExpressions.IRegexFactory regexFactory,
            LogViewer.IPresenterFactory logViewerPresenterFactory,
            ISynchronizationContext synchronizationContext,
            LogMedia.IFileSystem fileSystem
            )
        {
            this.view = view;
            this.view.SetEventsHandler(this);
            this.tempFilesManager       = tempFilesManager;
            this.traceSourceFactory     = traceSourceFactory;
            this.regexFactory           = regexFactory;
            this.synchronizationContext = synchronizationContext;
            this.fileSystem             = fileSystem;

            this.threads          = new ModelThreads();
            this.logSourceThreads = new LogSourceThreads(
                LJTraceSource.EmptyTracer, threads, null);
            this.model            = new Presenters.LogViewer.DummyModel();
            this.logPresenter     = logViewerPresenterFactory.CreateIsolatedPresenter(model, view.LogViewer);
            logPresenter.ShowTime = true;
            logPresenter.EmptyViewMessageAllowed = false;
        }
Exemplo n.º 2
0
 public Factory(
     IAlertPopup alerts,
     IFileDialogs fileDialogs,
     Help.IPresenter help,
     ILogProviderFactoryRegistry registry,
     IFormatDefinitionsRepository repo,
     IUserDefinedFormatsManager userDefinedFormatsManager,
     ITempFilesManager tempFilesManager,
     ITraceSourceFactory traceSourceFactory,
     RegularExpressions.IRegexFactory regexFactory,
     LogViewer.IPresenterFactory logViewerPresenterFactory,
     IViewsFactory viewFactories,
     ISynchronizationContext synchronizationContext,
     FieldsProcessor.IFactory fieldsProcessorFactory
     )
 {
     this.viewFactories             = viewFactories;
     this.alerts                    = alerts;
     this.registry                  = registry;
     this.fileDialogs               = fileDialogs;
     this.userDefinedFormatsManager = userDefinedFormatsManager;
     this.help                      = help;
     this.repo                      = repo;
     this.tempFilesManager          = tempFilesManager;
     this.logViewerPresenterFactory = logViewerPresenterFactory;
     this.traceSourceFactory        = traceSourceFactory;
     this.regexFactory              = regexFactory;
     this.synchronizationContext    = synchronizationContext;
     this.fieldsProcessorFactory    = fieldsProcessorFactory;
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        public Presenter(
            IView view,
            ITempFilesManager tempFilesManager,
            ITraceSourceFactory traceSourceFactory,
            LogViewer.IPresenterFactory logViewerPresenterFactory,
            ISynchronizationContext synchronizationContext
            )
        {
            this.view = view;
            this.view.SetEventsHandler(this);
            this.tempFilesManager       = tempFilesManager;
            this.traceSourceFactory     = traceSourceFactory;
            this.synchronizationContext = synchronizationContext;

            this.threads          = new ModelThreads();
            this.logSourceThreads = new LogSourceThreads(
                LJTraceSource.EmptyTracer, threads, null);
            this.model            = new Presenters.LogViewer.DummyModel();
            this.logPresenter     = logViewerPresenterFactory.CreateIsolatedPresenter(model, view.LogViewer);
            logPresenter.ShowTime = true;
        }
Exemplo n.º 6
0
 public ObjectsFactory(
     IAlertPopup alerts,
     IFileDialogs fileDialogs,
     Help.IPresenter help,
     ILogProviderFactoryRegistry registry,
     IFormatDefinitionsRepository repo,
     IUserDefinedFormatsManager userDefinedFormatsManager,
     ITempFilesManager tempFilesManager,
     LogViewer.IPresenterFactory logViewerPresenterFactory,
     ViewFactories viewFactories
     )
 {
     this.viewFactories             = viewFactories;
     this.alerts                    = alerts;
     this.registry                  = registry;
     this.fileDialogs               = fileDialogs;
     this.userDefinedFormatsManager = userDefinedFormatsManager;
     this.help                      = help;
     this.repo                      = repo;
     this.tempFilesManager          = tempFilesManager;
     this.logViewerPresenterFactory = logViewerPresenterFactory;
 }
Exemplo n.º 7
0
        public Presenter(
            Settings.IGlobalSettingsAccessor settings,
            IView view,
            LogViewer.IPresenterFactory logViewerPresenterFactory,
            IChangeNotification changeNotification,
            IColorTheme theme
            )
        {
            this.view             = view;
            this.settingsAccessor = settings;

            this.sampleMessagesBaseTime   = DateTime.UtcNow;
            this.temporaryColorTheme      = new TemporaryColorTheme(theme, changeNotification);
            this.sampleThreads            = new ModelThreads(new ColorLease(temporaryColorTheme.ThreadColorsCount));
            this.dummyModel               = new LogViewer.DummyModel();
            this.sampleLogViewerPresenter = logViewerPresenterFactory.CreateIsolatedPresenter(
                dummyModel, view.PreviewLogView,
                theme: temporaryColorTheme);
            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);
        }
Exemplo n.º 8
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();
        }
Exemplo n.º 9
0
        public Presenter(
            ISearchManager searchManager,
            IBookmarks bookmarks,
            IFiltersList hlFilters,
            IView view,
            IPresentersFacade navHandler,
            LoadedMessages.IPresenter loadedMessagesPresenter,
            IHeartBeatTimer heartbeat,
            ISynchronizationContext uiThreadSynchronization,
            StatusReports.IPresenter statusReports,
            LogViewer.IPresenterFactory logViewerPresenterFactory,
            IColorTheme theme,
            IChangeNotification changeNotification
            )
        {
            this.searchManager                    = searchManager;
            this.bookmarks                        = bookmarks;
            this.hlFilters                        = hlFilters;
            this.view                             = view;
            this.loadedMessagesPresenter          = loadedMessagesPresenter;
            this.statusReports                    = statusReports;
            this.theme                            = theme;
            this.changeNotification               = changeNotification;
            var(messagesPresenter, messagesModel) = logViewerPresenterFactory.CreateSearchResultsPresenter(
                view.MessagesView, loadedMessagesPresenter.LogViewerPresenter);
            this.messagesPresenter = messagesPresenter;
            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.FocusedMessageBookmark,
                                                     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);
            };

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

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