private async void ShowArtist(string userId) { if (!userId.IsNumber()) { MessageQueue.Enqueue(Externally.InputIllegal("单个用户")); return; } try { await HttpClientFactory.AppApiService.GetUserInformation(new UserInformationRequest { Id = userId }); } catch (ApiException e) { if (e.StatusCode == HttpStatusCode.NotFound) { MessageQueue.Enqueue(Externally.CannotFindUser); return; } } OpenUserBrowser(); SetUserBrowserContext(new User { Id = userId }); }
private async void DownloadSpotlightItem_OnClick(object sender, RoutedEventArgs e) { var context = sender.GetDataContext <SpotlightArticle>(); await PixivEx.DownloadSpotlight(context); MessageQueue.Enqueue(Externally.DownloadSpotlightComplete(context)); }
private async void DownloadButton_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var model = sender.GetDataContext <Illustration>(); DownloadList.Remove(model); await PixivEx.DownloadIllustInternal(model); MessageQueue.Enqueue(Externally.DownloadComplete(model)); }
private async void DownloadNowMenuItem_OnClick(object sender, RoutedEventArgs e) { var illust = sender.GetDataContext <Illustration>(); DownloadList.Remove(illust); await PixivEx.DownloadIllustInternal(illust); MessageQueue.Enqueue(Externally.DownloadComplete(illust)); }
private async void DownloadButton_OnClick(object sender, RoutedEventArgs e) { var model = currentModel; DownloadList.Remove(model); await PixivEx.DownloadIllustInternal(model); messageQueue.Enqueue(Externally.DownloadComplete(model)); }
private async void DownloadSingleFromDownloadListButton_OnClick(object sender, RoutedEventArgs e) { var illust = sender.GetDataContext <Illustration>(); DownloadList.Remove(illust); await PixivEx.DownloadIllustInternal(illust); Notice(Externally.DownloadComplete(illust)); }
private async void ShowArtist(string userId) { if (!userId.IsNumber()) { Notice(Externally.InputIllegal("单个用户")); return; } try { await HttpClientFactory.AppApiService.GetUserInformation(new UserInformationRequest { Id = userId }); } catch (ApiException e) { if (e.StatusCode == HttpStatusCode.NotFound) { Notice(Externally.CannotFindUser); return; } } UserViewer.Show(userId); }
private async void TryQuerySingle(string illustId) { if (!int.TryParse(illustId, out _)) { MessageQueue.Enqueue(Externally.InputIllegal("单个作品")); return; } try { OpenIllustBrowser(await PixivHelper.IllustrationInfo(illustId)); } catch (ApiException exception) { if (exception.StatusCode == HttpStatusCode.NotFound || exception.StatusCode == HttpStatusCode.BadRequest) { MessageQueue.Enqueue(Externally.IdDoNotExists); } else { throw; } } }
private void Notice(string str, int?pages = null) { messageQueue.Enqueue(pages != null ? Externally.NoticeProgressString((int)pages) : str); }