Exemplo n.º 1
0
        public void LoadAnimeList(bool needSynopsis = false)
        {
            var width = EpisodesFlowPanel.Width;

            EpisodesFlowPanel.Controls.Clear();
            AnimeSynopsis.Text = CleanSynopsis(AnimeSynopsis.Text);

            _phantomObject.Navigate().GoToUrl(AnimeUrl);
            if (needSynopsis)
            {
                AnimeSynopsis.Text = CleanSynopsis(_phantomObject.FindElementsByTagName("p")[2].Text);
            }
            var myTable = _phantomObject.FindElementsByClassName("episode");

            foreach (var node in myTable)
            {
                var epcontrol = new EpisodeControl
                {
                    Text = node.Text.Trim(),
                    Tag  = node.GetAttribute("data-value")
                };
                if (StaticsClass.MyAnimeListObject != null)
                {
                    epcontrol.RateIcon.Click += RateIcon_Click;
                }
                else
                {
                    epcontrol.RateIcon.Visible = false;
                }
                EpisodesFlowPanel.Controls.Add(epcontrol);
                EpisodesFlowPanel.Controls.SetChildIndex(epcontrol, 0);
            }
            BringToFront();
        }
        public void LoadAnimeList(bool needSynopsis = false)
        {
            var width = EpisodesFlowPanel.Width;

            EpisodesFlowPanel.Controls.Clear();
            AnimeSynopsis.Text = CleanSynopsis(AnimeSynopsis.Text);

            var splitData = AnimeUrl.Split('/');

            splitData[splitData.Length - 1] = System.Web.HttpUtility.UrlEncode(splitData.Last(), System.Text.Encoding.UTF8);
            AnimeUrl = string.Join("/", splitData);

            _phantomObject.Navigate().GoToUrl(AnimeUrl);
            if (needSynopsis)
            {
                AnimeSynopsis.Text = CleanSynopsis(_phantomObject.FindElementsByTagName("p")[2].Text);
            }
            var myTable = _phantomObject.FindElementsByClassName("episode");

            foreach (var node in myTable)
            {
                var epcontrol = new EpisodeControl
                {
                    Text = node.Text.Trim(),
                    Tag  = node.GetAttribute("data-value")
                };
                if (StaticsClass.MyAnimeListObject != null)
                {
                    epcontrol.RateIcon.Click += RateIcon_Click;
                }
                else
                {
                    epcontrol.RateIcon.Visible = false;
                }
                EpisodesFlowPanel.Controls.Add(epcontrol);
                EpisodesFlowPanel.Controls.SetChildIndex(epcontrol, 0);
            }
            BringToFront();
        }