コード例 #1
0
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            IsValidCommunity = false;

            if (e.Parameter is string)
            {
                var id = e.Parameter as string;

                if (NiconicoRegex.IsCommunityId(id))
                {
                    CommunityId      = id;
                    IsValidCommunity = true;
                }
            }

            base.OnNavigatedTo(e, viewModelState);
        }
コード例 #2
0
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            IsValidCommunity = false;

            if (e.Parameter is string)
            {
                var id = e.Parameter as string;

                if (NiconicoRegex.IsCommunityId(id))
                {
                    CommunityId      = id;
                    IsValidCommunity = true;
                }
            }

            CanDownload = HohoemaApp.UserSettings.CacheSettings.IsUserAcceptedCache &&
                          HohoemaApp.UserSettings.CacheSettings.IsEnableCache &&
                          HohoemaApp.IsLoggedIn;

            base.OnNavigatedTo(e, viewModelState);
        }
コード例 #3
0
ファイル: IconClient.cs プロジェクト: tor4kichi/OpenNiconico2
        public static async Task <byte[]> GetIconAsync(NiconicoContext context, string requestId)
        {
            if (!NiconicoRegex.IsCommunityId(requestId))
            {
                throw new ArgumentException();
            }

            var communityNumber = requestId.Substring(2).ToUInt();

            try
            {
                return(await context.HttpClient
                       .GetByteArrayAsync(string.Format(NiconicoUrls.CommunityIconUrl, communityNumber / 10000, communityNumber)));
            }
            catch (AggregateException ex)
            {
                if (ex.HResult != -2146233088)
                {
                    throw;
                }
            }

            return(await context.HttpClient.GetByteArrayAsync(NiconicoUrls.CommunityBlankIconUrl));
        }