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); }
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); }
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)); }