public void AddToHistory(Pixeez.Objects.Work illust)
 {
     if (HistoryItems.Items is ObservableCollection <PixivItem> )
     {
         Application.Current.HistoryAdd(illust, HistoryItems.Items);
         UpdateDetail();
     }
 }
Exemple #2
0
 public static async Task <Pixeez.Objects.Metadata> GetMetaData(this Pixeez.Objects.Work work, Pixeez.Tokens tokens = null)
 {
     if (work is Pixeez.Objects.Work)
     {
         return(await GetMetaData(GetAjaxMetaPageUrl(work.Id), tokens));
     }
     else
     {
         return(null);
     }
 }
Exemple #3
0
        public static async Task <List <Pixeez.Objects.MetaPages> > GetMetaPages(this Pixeez.Objects.Work work, Pixeez.Tokens tokens = null)
        {
            List <Pixeez.Objects.MetaPages> result = null;

            if (work is Pixeez.Objects.Work)
            {
                var pages_url = GetAjaxMetaPageUrl(work.Id);
                List <Pixeez.Objects.Page> pages = work.PageCount > 1 ? await GetMetaPages(pages_url, tokens) : null;

                result = pages is List <Pixeez.Objects.Page>?pages.Select(p => new Pixeez.Objects.MetaPages()
                {
                    ImageUrls = p.ImageUrls
                }).ToList() : null;
            }
            return(result);
        }
Exemple #4
0
        public static async Task <Pixeez.Objects.UgoiraInfo> GetUgoiraMetaInfo(this Pixeez.Objects.Work work)
        {
            Pixeez.Objects.UgoiraInfo result = null;
            if (work is Pixeez.Objects.Work)
            {
                if (work.UgoiraMeta is Pixeez.Objects.UgoiraInfo)
                {
                    result = work.UgoiraMeta;
                }
                else
                {
                    result = await GetUgoiraMetaInfo(work.Id ?? 0);

                    work.UgoiraMeta = result;
                }
            }
            return(result);
        }
Exemple #5
0
        public static async Task <Pixeez.Objects.UgoiraInfo> GetUgoiraMeta(this Pixeez.Objects.Work Illust, bool ajax = false)
        {
            Pixeez.Objects.UgoiraInfo info = null;
            long id = 0;

            try
            {
                if (Illust.IsUgoira)
                {
                    id = Illust.Id.Value;
                    if (Illust.UgoiraMeta is Pixeez.Objects.UgoiraInfo)
                    {
                        info = Illust.UgoiraMeta;
                    }
                    else
                    {
                        if (ajax)
                        {
                            info = await GetUgoiraMetaInfo(id);
                        }
                        else
                        {
                            var tokens = await CommonHelper.ShowLogin();

                            var ugoira_meta = await tokens.GetUgoiraMetadata(id);

                            info = ugoira_meta is Pixeez.Objects.UgoiraMetadata ? ugoira_meta.Metadata : null;
                        }
                        if (info is Pixeez.Objects.UgoiraInfo)
                        {
                            Illust.UgoiraMeta = info;
                        }
                    }
                }
            }
            catch (Exception ex) { ex.ERROR($"GetUgoiraMeta_{id}"); }
            return(info);
        }