コード例 #1
0
 private async Task SetTwitchElements(bool interactive = false, string query = "")
 {
     var twitchResult =
         await _liveStreamManager.GetTwitchFeed(0, 80, "PS4", interactive, query, Shell.Instance.ViewModel.CurrentTokens);
     await AccountAuthHelpers.UpdateTokens(Shell.Instance.ViewModel.CurrentUser, twitchResult);
     var result = await ResultChecker.CheckSuccess(twitchResult);
     if (!result)
     {
         return;
     }
     var twitchList = JsonConvert.DeserializeObject<TwitchEntity>(twitchResult.ResultJson);
     if (twitchList?.streams == null) return;
     foreach (TwitchEntity.Stream twitch in twitchList.streams)
     {
         var entity = new LiveBroadcastEntity();
         entity.ParseFromTwitch(twitch);
         LiveBroadcastCollection.Add(entity);
     }
 }
コード例 #2
0
        private async Task SetNicoDougaElements(bool interactive = false, string query = "")
        {
            var nicoNicoResultEntity =
                await _liveStreamManager.GetNicoFeed("onair", "PS4", interactive, 0, 80, "view", query, Shell.Instance.ViewModel.CurrentTokens);
            await AccountAuthHelpers.UpdateTokens(Shell.Instance.ViewModel.CurrentUser, nicoNicoResultEntity);
            var result = await ResultChecker.CheckSuccess(nicoNicoResultEntity);
            if (!result)
            {
                return;
            }
            var nicoNicoEntity = JsonConvert.DeserializeObject<NicoNicoEntity>(nicoNicoResultEntity.ResultJson);
            if (nicoNicoEntity?.programs == null) return;
            foreach (NicoNicoEntity.Program program in nicoNicoEntity.programs)
            {
                var entity = new LiveBroadcastEntity();
                entity.ParseFromNicoNico(program);
                LiveBroadcastCollection.Add(entity);
            }

        }
コード例 #3
0
        private async Task SetUstreamElements(bool interactive = false, string query = "")
        {
            var filterList = new Dictionary<string, string>
            {
                {"platform", "PS4"},
                {"type", "live"},
                {"interactive", interactive ? "true" : "false"}
            };

            var ustreamResultList =
                await
                    _liveStreamManager.GetUstreamFeed(0, 80, "compact", filterList, "views", query,
                        Shell.Instance.ViewModel.CurrentTokens);
            await AccountAuthHelpers.UpdateTokens(Shell.Instance.ViewModel.CurrentUser, ustreamResultList);
            var result = await ResultChecker.CheckSuccess(ustreamResultList);
            if (!result)
            {
                return;
            }
            var ustreamList = JsonConvert.DeserializeObject<UstreamEntity>(ustreamResultList.ResultJson);
            if (ustreamList?.items == null) return;
            foreach (UstreamEntity.Item ustream in ustreamList.items)
            {
                var entity = new LiveBroadcastEntity();
                entity.ParseFromUstream(ustream);
                LiveBroadcastCollection.Add(entity);
            }

        }