Example #1
0
        public MangaContentPage(MangaItem item)
        {
            InitializeComponent();

            this.mangaItem = item;
            this.contents  = Manga.QueryMangaContent(this.mangaItem);

            this.BindingContext = this.mangaItem;
            this.SetBinding(TitleProperty, "Title");
            this.ItemsSource = contents;
        }
Example #2
0
        public static async Task <List <String> > FetchMangaContentsAsync(MangaItem item)
        {
            var web = new HtmlWeb();
            var doc = await web.LoadFromWebAsync(item.Link);

            var nodes = doc.DocumentNode.Descendants()
                        .Where(x => x.Id == "post")
                        .First().Descendants("div")
                        .Where(x => x.Attributes["class"].Value == "contents")
                        .First().Descendants("img");

            return(nodes.Select(x => x.Attributes["src"].Value).ToList());
        }
Example #3
0
        public static async Task <int> FetchMangaContents(MangaItem item)
        {
            var realm = item.Realm;

            var contents = await Zang.FetchMangaContentsAsync(item);

            realm.Write(() =>
            {
                foreach (var content in contents)
                {
                    realm.Add(new MangaContent
                    {
                        MangaItem = item,
                        ImageURL  = content
                    });
                }
            });

            return(0);
        }
Example #4
0
        public static IQueryable <MangaContent> QueryMangaContent(MangaItem item)
        {
            var realm = item.Realm;

            return(realm.All <MangaContent>().Where(x => x.MangaItem == item));
        }