public async void SetFlipResourcesAsync()
        {
            try {
                var result = await DoubanWebProcess.GetMDoubanResponseAsync(
                    path : "https://m.douban.com/rexxar/api/v2/promos?page=selection",
                    host : "m.douban.com",
                    reffer : null);

                JObject jo     = JObject.Parse(result);
                var     promos = jo["promos"];
                if (promos.HasValues)
                {
                    var newList = new List <PromosItem>();
                    promos.Children().ToList().ForEach(singleton => {
                        var notif = singleton["notification"];
                        var uri   = UriDecoder.GetUrlFromUri(singleton["uri"].Value <string>());
                        newList.Add(new PromosItem {
                            ImageSrc            = new Uri(singleton["image"].Value <string>()),
                            Image               = singleton["image"].Value <string>(),
                            NotificationCount   = notif.HasValues ? notif["count"].Value <uint>() : 0,
                            NotificationVersion = notif.HasValues ? notif["version"].Value <string>() : null,
                            Text = singleton["text"].Value <string>(),
                            Uri  = uri,
                            ID   = singleton["id"].Value <string>(),
                        });
                    });
                    FlipResouces.Source = newList;
                    InitFlipTimer(newList);
                }
            } catch { /* Ignore */ }
        }
Esempio n. 2
0
        private void GridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            var item = e.ClickedItem as MovieItem;

            if (item == null || item.PathUrl == null)
            {
                return;
            }
            NavigateToBase?.Invoke(
                null,
                new NavigateParameter {
                ToUri    = new Uri(UriDecoder.GetUrlFromUri(item.PathInnerUri, UriCastEnum.Movie)),
                IsNative = true,
                Title    = item.Title,
            },
                GetFrameInstance(FrameType.Content),
                GetPageType(NavigateType.MovieContent));
        }
        private void IndexList_ItemClick(object sender, ItemClickEventArgs e)
        {
            var item = e.ClickedItem as IndexItem;

            if (item == null || item.Type == IndexItem.ItemType.DateBlock)
            {
                return;
            }
            NavigateToBase?.Invoke(
                sender,
                new Core.Models.NavigateParameter {
                ToUri = item.PathUrl != null ?
                        new Uri(UriDecoder.GetUrlFromUri(item.PathUrl)) :
                        null,
                Title    = item.Title,
                IsNative = true
            },
                GetFrameInstance(Core.Models.FrameType.Content),
                GetPageType(Core.Models.NavigateType.ItemClickNative));
        }
        private void FilterGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            var item = e.ClickedItem as ItemGroup <MovieItem>;

            if (item == null || item.GroupPathUrl == null)
            {
                return;
            }
            var keyword = new Regex(@"/tv/(?<key_word>.+)").Match(item.GroupPathUrl).Groups["key_word"].Value;

            if (keyword != "")
            {
                keyword = UriDecoder.EditKeyWordsForTVFilter(keyword, "tv");
            }
            NavigateToBase?.Invoke(
                null,
                new NavigateParameter {
                ToUri = new Uri(item.GroupPathUrl), ApiHeadString = keyword, Title = item.GroupName
            },
                GetFrameInstance(FrameType.Content),
                GetPageType(NavigateType.TVFilter));
        }