示例#1
0
        private void linkLabelClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            IBookmark bmk = ((LinkLabel)sender).Tag as IBookmark;

            if (bmk != null)
            {
                handler.ShowMessage(bmk, BookmarkNavigationOptions.EnablePopups | BookmarkNavigationOptions.NoLinksInPopups | BookmarkNavigationOptions.GenericStringsSet);
            }
        }
示例#2
0
        void IViewEvents.OnBookmarkLinkClicked(ControlFlag controlId)
        {
            IBookmark bmk = null;

            if (controlId == ControlFlag.FirstMessageLinkLabel)
            {
                bmk = firstMessageBmk;
            }
            else if (controlId == ControlFlag.LastMessageLinkLabel)
            {
                bmk = lastMessageBmk;
            }
            if (bmk != null)
            {
                presentersFacade.ShowMessage(bmk, BookmarkNavigationOptions.EnablePopups | BookmarkNavigationOptions.GenericStringsSet | BookmarkNavigationOptions.NoLinksInPopups);
            }
        }
        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();
        }