コード例 #1
0
        private async void TryQuerySingle(string illustId)
        {
            if (!int.TryParse(illustId, out _))
            {
                Notice(Externally.InputIllegal("单个作品"));
                return;
            }

            try
            {
                IllustViewer.Show(await PixivHelper.IllustrationInfo(illustId));
            }
            catch (ApiException exception)
            {
                if (exception.StatusCode == HttpStatusCode.NotFound || exception.StatusCode == HttpStatusCode.BadRequest)
                {
                    Notice(Externally.IdDoNotExists);
                }
                else
                {
                    throw;
                }
            }
        }
コード例 #2
0
        private async void BrowsingHistoryMainImage_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            MainWindow.Instance.DownloadQueueDialogHost.CurrentSession.Close();
            var ctx = sender.GetDataContext <BrowsingHistory>();

            switch (ctx.Type)
            {
            case "spotlight":
                MainWindow.MessageQueue.Enqueue(AkaI18N.SearchingSpotlight);

                var tasks = await Tasks <string, Illustration> .Of(await PixivClient.Instance.GetArticleWorks(ctx.BrowseObjectId)).Mapping(PixivHelper.IllustrationInfo).Construct().WhenAll();

                var result = tasks.Peek(i =>
                {
                    i.IsManga        = true;
                    i.FromSpotlight  = true;
                    i.SpotlightTitle = ctx.BrowseObjectState;
                }).ToArray();

                PixivHelper.RecordTimelineInternal(new BrowsingHistory
                {
                    BrowseObjectId        = ctx.BrowseObjectId,
                    BrowseObjectState     = ctx.BrowseObjectState,
                    BrowseObjectThumbnail = ctx.BrowseObjectThumbnail,
                    IsReferToSpotlight    = true,
                    Type = "spotlight"
                });

                MainWindow.Instance.OpenIllustBrowser(result[0].Apply(r => r.MangaMetadata = result.ToArray()));
                break;

            case "illust":
                MainWindow.Instance.OpenIllustBrowser(await PixivHelper.IllustrationInfo(ctx.BrowseObjectId));
                break;
            }
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: ziyuejun/Pixeval
        private async void TryQuerySingle(string illustId)
        {
            if (!int.TryParse(illustId, out _))
            {
                MessageQueue.Enqueue(SR.InputIllegal("单个作品"));
                return;
            }

            try
            {
                OpenIllustBrowser(await PixivHelper.IllustrationInfo(illustId));
            }
            catch (ApiException exception)
            {
                if (exception.StatusCode == HttpStatusCode.NotFound || exception.StatusCode == HttpStatusCode.BadRequest)
                {
                    MessageQueue.Enqueue(SR.IdDoNotExists);
                }
                else
                {
                    throw;
                }
            }
        }
コード例 #4
0
ファイル: MainWindow.xaml.cs プロジェクト: artszys/Pixeval
 private async void ReferImage_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     OpenIllustBrowser(await PixivHelper.IllustrationInfo(sender.GetDataContext <Trends>().TrendObjectId));
     e.Handled = true;
 }