コード例 #1
0
ファイル: HitomiPanel.cs プロジェクト: 2dongsik2/HitomiViewer
        public override async void HitomiPanel_Loaded(object sender, RoutedEventArgs e)
        {
            this.nameLabel.Content = h.name + " (로딩중)";
            InternetP parser = new InternetP();

            parser.index = int.Parse(h.id);
            h            = await parser.HitomiData();

            //h = await parser.HitomiData2(h, int.Parse(h.id));
            if (Global.config.origin_thumb.Get <bool>() && h.files != null && h.files.Length >= 1 && h.files[0] != null)
            {
                this.pageLabel.Content = h.files.Length;
                this.nameLabel.Content = h.name + " (썸네일 로딩중)";
                ImageProcessor.ProcessAsync(h.files[0].url).then((byte[] image) =>
                {
                    h.thumbnail.preview_img = image;
                    base.h = this.h;
                    this.nameLabel.Content = h.name;
                }, null, sourceName: MethodBase.GetCurrentMethod().FullName());
            }
            else
            {
                var preview_image = await ImageProcessor.ProcessAsync(h.thumbnail.preview_url).@catch(null, MethodBase.GetCurrentMethod().FullName());

                h.thumbnail.preview_img = preview_image;
                base.h = this.h;
                this.nameLabel.Content = h.name;
            }
            BitmapImage image = h.thumbnail.preview_img.ToImage();

            thumbNail.Source       = image;
            thumbBrush.ImageSource = image;
            thumbNail.MouseEnter  += (object _, MouseEventArgs __) => thumbNail.ToolTip = GetToolTip(panel.Height);
            Init();
        }
コード例 #2
0
        public async void FastParser(int[] ids)
        {
            start(ids.Length);
            for (int i = 0; i < ids.Length; i++)
            {
                InternetP parser = new InternetP();
                parser.index = ids[i];
                Hitomi h = await parser.HitomiData();

                h.type = Hitomi.Type.Hitomi;
                h.id   = ids[i].ToString();
                update(h, i, ids.Count());
            }
            end();
        }
コード例 #3
0
        private async void Search_Button_Click(object sender, RoutedEventArgs e)
        {
            string SearchText = Search_Text.Text;
            int    number     = 0;

            if (int.TryParse(SearchText, out number))
            {
                MainPanel.Children.Clear();
                InternetP            parser = new InternetP(index: number);
                Tuple <bool, Hitomi> data   = await parser.isHiyobiData();

                bool   result = data.Item1;
                Hitomi h      = data.Item2;
                if (!result)
                {
                    h = await parser.HitomiData();
                }
                MainPanel.Children.Add(new HitomiPanel(h, this, true));
            }
            else
            {
                File_Search_Button_Click(sender, e);
            }
        }