Presenter() 공개 메소드

public Presenter ( ISearchResultsWindowViewModel viewModel ) : SearchResultsDockablePresenter
viewModel ISearchResultsWindowViewModel
리턴 SearchResultsDockablePresenter
예제 #1
0
        public void FindAllReferences(Declaration declaration)
        {
            if (_state.Status != ParserState.Ready)
            {
                return;
            }

            var viewModel = CreateViewModel(declaration);

            if (!viewModel.SearchResults.Any())
            {
                _messageBox.NotifyWarn(string.Format(RubberduckUI.AllReferences_NoneFound, declaration.IdentifierName), RubberduckUI.Rubberduck);
                return;
            }

            if (viewModel.SearchResults.Count == 1)
            {
                _navigateCommand.Execute(viewModel.SearchResults.Single().GetNavigationArgs());
                return;
            }

            _viewModel.AddTab(viewModel);
            _viewModel.SelectedTab = viewModel;

            try
            {
                var presenter = _presenterService.Presenter(_viewModel);
                presenter.Show();
            }
            catch (Exception e)
            {
                _logger.Error(e);
            }
        }
        private void ShowResults(SearchResultsViewModel viewModel)
        {
            if (viewModel.SearchResults.Count == 1)
            {
                viewModel.NavigateCommand.Execute(viewModel.SearchResults[0].GetNavigationArgs());
                return;
            }

            try
            {
                _viewModel.AddTab(viewModel);
                _viewModel.SelectedTab = viewModel;

                var presenter = _presenterService.Presenter(_viewModel);
                presenter.Show();
            }
            catch (Exception e)
            {
                _logger.Error(e);
            }
        }