Beispiel #1
0
        public override Task OnNavigatedToAsync(INavigationParameters parameters)
        {
            var mode = parameters.GetNavigationMode();

            if (mode == NavigationMode.New)
            {
                SearchOption = new TagSearchPagePayloadContent()
                {
                    Keyword = System.Net.WebUtility.UrlDecode(parameters.GetValue <string>("keyword"))
                };
            }

            SelectedSearchTarget.Value = SearchTarget.Tag;

            SelectedSearchSort.Value = VideoSearchOptionListItems.First(x => x.Sort == SearchOption.Sort && x.Order == SearchOption.Order);


            Database.SearchHistoryDb.Searched(SearchOption.Keyword, SearchOption.SearchTarget);

            TagSearchBookmark = Database.BookmarkDb.Get(Database.BookmarkType.SearchWithTag, SearchOption.Keyword)
                                ?? new Database.Bookmark()
            {
                BookmarkType = Database.BookmarkType.SearchWithTag,
                Label        = SearchOption.Keyword,
                Content      = SearchOption.Keyword
            };

            FollowButtonService.SetFollowTarget(this);

            RaisePropertyChanged(nameof(TagSearchBookmark));

            PageManager.PageTitle = $"\"{SearchOption.Keyword}\"";

            return(base.OnNavigatedToAsync(parameters));
        }
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            if (e.Parameter is string && e.NavigationMode == NavigationMode.New)
            {
                SearchOption = PagePayloadBase.FromParameterString <TagSearchPagePayloadContent>(e.Parameter as string);
            }

            SelectedSearchTarget.Value = SearchOption?.SearchTarget ?? SearchTarget.Tag;

            SelectedSearchSort.Value = VideoSearchOptionListItems.First(x => x.Sort == SearchOption.Sort && x.Order == SearchOption.Order);


            Database.SearchHistoryDb.Searched(SearchOption.Keyword, SearchOption.SearchTarget);

            TagSearchBookmark = Database.BookmarkDb.Get(Database.BookmarkType.SearchWithTag, SearchOption.Keyword)
                                ?? new Database.Bookmark()
            {
                BookmarkType = Database.BookmarkType.SearchWithTag,
                Label        = SearchOption.Keyword,
                Content      = SearchOption.Keyword
            };

            FollowButtonService.SetFollowTarget(this);

            RaisePropertyChanged(nameof(TagSearchBookmark));



            base.OnNavigatedTo(e, viewModelState);
        }