예제 #1
0
        public Presenter(IChangeNotification changeNotification)
        {
            this.changeNotification = changeNotification;
            this.searchBox          = new QuickSearchTextBox.Presenter(null, changeNotification);
            searchBox.HideClearButton();

            searchBox.OnCancelled += (s, e) => DoHide();
            searchBox.OnSearchNow += (s, e) => DoSearch(e.ReverseSearchModifier);
        }
예제 #2
0
        public Presenter(
            ILogSourcesManager logSourcesManager,
            IChangeNotification changeNotification,
            IView view,
            Preprocessing.IManager sourcesPreprocessingManager,
            Preprocessing.IStepsFactory preprocessingStepsFactory,
            MRU.IRecentlyUsedEntities mru,
            QuickSearchTextBox.IPresenter searchBoxPresenter,
            IAlertPopup alerts,
            ITraceSourceFactory traceSourceFactory
            )
        {
            this.view = view;
            this.changeNotification          = changeNotification;
            this.logSourcesManager           = logSourcesManager;
            this.sourcesPreprocessingManager = sourcesPreprocessingManager;
            this.preprocessingStepsFactory   = preprocessingStepsFactory;
            this.mru = mru;
            this.searchBoxPresenter = searchBoxPresenter;
            this.trace  = traceSourceFactory.CreateTraceSource("UI", "hist-dlg");
            this.alerts = alerts;

            items            = Selectors.Create(() => visible, () => acceptedFilter, MakeItems);
            actuallySelected = Selectors.Create(() => items().displayItems, () => selected,
                                                (items, selected) => items.SelectMany(i => i.Flatten()).Where(i => selected.Contains(i.key)).ToImmutableList());
            openButtonEnabled = Selectors.Create(actuallySelected, selected => selected.Any(IsOpenable));
            rootViewItem      = Selectors.Create(() => items().displayItems, () => selected, () => expanded, MakeRootItem);

            searchBoxPresenter.OnSearchNow += (s, e) =>
            {
                acceptedFilter = searchBoxPresenter.Text;
                FocusItemsListAndSelectFirstItem();
                changeNotification.Post();
            };
            searchBoxPresenter.OnRealtimeSearch += (s, e) =>
            {
                acceptedFilter = searchBoxPresenter.Text;
                changeNotification.Post();
            };
            searchBoxPresenter.OnCancelled += (s, e) =>
            {
                if (acceptedFilter != "")
                {
                    acceptedFilter = "";
                    searchBoxPresenter.Focus(null);
                }
                else
                {
                    visible = false;
                }
                changeNotification.Post();
            };

            view.SetViewModel(this);
        }
 public void Init()
 {
     view = Substitute.For <IView>();
     presentationObjectsFactory = Substitute.For <Postprocessing.Common.IPresentationObjectsFactory>();
     bookmarks               = Substitute.For <IBookmarks>();
     storageManager          = Substitute.For <Persistence.IStorageManager>();
     loadedMessagesPresenter = Substitute.For <LoadedMessages.IPresenter>();
     userNamesProvider       = Substitute.For <IUserNamesProvider>();
     view.When(v => v.SetViewModel(Arg.Any <IViewModel>())).Do(x => viewModel = x.Arg <IViewModel>());
     quickSearchTextBoxPresenter = Substitute.For <QuickSearchTextBox.IPresenter>();
     changeNotification          = Substitute.For <IChangeNotification>();
     theme = Substitute.For <IColorTheme>();
     theme.ThreadColors.Returns(ImmutableArray.Create(new Color(1), new Color(2)));
     presentationObjectsFactory.CreateQuickSearch(Arg.Any <QuickSearchTextBox.IView>()).Returns(quickSearchTextBoxPresenter);
 }
예제 #4
0
        public Presenter(
            ILogSourcesManager logSourcesManager,
            IView view,
            Preprocessing.IManager sourcesPreprocessingManager,
            Preprocessing.IStepsFactory preprocessingStepsFactory,
            MRU.IRecentlyUsedEntities mru,
            QuickSearchTextBox.IPresenter searchBoxPresenter,
            IAlertPopup alerts,
            ITraceSourceFactory traceSourceFactory
            )
        {
            this.view = view;
            this.logSourcesManager           = logSourcesManager;
            this.sourcesPreprocessingManager = sourcesPreprocessingManager;
            this.preprocessingStepsFactory   = preprocessingStepsFactory;
            this.mru = mru;
            this.searchBoxPresenter = searchBoxPresenter;
            this.trace  = traceSourceFactory.CreateTraceSource("UI", "hist-dlg");
            this.alerts = alerts;

            searchBoxPresenter.OnSearchNow += (s, e) =>
            {
                UpdateItems();
                FocusItemsListAndSelectFirstItem();
            };
            searchBoxPresenter.OnRealtimeSearch += (s, e) => UpdateItems();
            searchBoxPresenter.OnCancelled      += (s, e) =>
            {
                if (itemsFiltered)
                {
                    UpdateItems();
                    searchBoxPresenter.Focus(null);
                }
                else
                {
                    view.Hide();
                }
            };

            view.SetEventsHandler(this);
        }