Example #1
0
        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
            });
        }
Example #2
0
        private async void DownloadSpotlightItem_OnClick(object sender, RoutedEventArgs e)
        {
            var context = sender.GetDataContext <SpotlightArticle>();

            await PixivEx.DownloadSpotlight(context);

            MessageQueue.Enqueue(Externally.DownloadSpotlightComplete(context));
        }
Example #3
0
        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));
        }
Example #4
0
        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));
        }
Example #5
0
        private async void DownloadButton_OnClick(object sender, RoutedEventArgs e)
        {
            var model = currentModel;

            DownloadList.Remove(model);
            await PixivEx.DownloadIllustInternal(model);

            messageQueue.Enqueue(Externally.DownloadComplete(model));
        }
Example #6
0
        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));
        }
Example #7
0
        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);
        }
Example #8
0
        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;
                }
            }
        }
Example #9
0
 private void Notice(string str, int?pages = null)
 {
     messageQueue.Enqueue(pages != null ? Externally.NoticeProgressString((int)pages) : str);
 }