Пример #1
0
        public SearchViewModel(IPresentationManager presentationManager, IImageManager imageManager, IApiClient apiClient, ISessionManager sessionManager, INavigationService navService, IPlaybackManager playbackManager, ILogger logger)
        {

            _presentationManager = presentationManager;
            _imageManager = imageManager;
            _apiClient = apiClient;
            _sessionManager = sessionManager;
            _navService = navService;
            _playbackManager = playbackManager;
            _logger = logger;
            _dispatcher = Dispatcher.CurrentDispatcher;

            LoadMatchedItemsViewModel();
            LoadMatchedPeopleViewModel();

            AlphaInputViewModel = new AlphaInputViewModel(UpdateSearchText, presentationManager, _imageManager, _apiClient, _navService, _playbackManager, _logger);

        }
        // Add a new char to current search, causes searc to fire
        private Task<Boolean> UpdateSearchText(AlphaInputViewModel viewModel)
        {
            var currentSearch = CurrentSearch;

            var indexOption = viewModel.CurrentIndexOption == null ? string.Empty : viewModel.CurrentIndexOption.Name;

            if (string.Compare(indexOption, "_") == 0)
                indexOption = " ";

            if (string.Compare(indexOption, "back") == 0)
            {
                if (CurrentSearch.Length > 0)
                    CurrentSearch = CurrentSearch.Substring(0, CurrentSearch.Length - 1);
            }
            else
                CurrentSearch = CurrentSearch + indexOption;

            return Task.FromResult(true);
        }