Esempio n. 1
0
        private void BuildLayout(IEnumerable <AnimeInfoClass> animeList)
        {
            StaticsClass.InvokeIfRequired(MainFrmPanel, MainFrmPanel.SuspendLayout);
            StaticsClass.InvokeIfRequired(MainFrmPanel, () =>
            {
                while (MainFrmPanel.Controls.Count > 0)
                {
                    MainFrmPanel.Controls[0].Dispose();
                }
            });
            GC.Collect(); //clear old bitmap cache, if needed.
            StaticsClass.InvokeIfRequired(MainFrmPanel, MainFrmPanel.Controls.Clear);
            var alIst = new List <Control> ();

            foreach (var animeInfo in animeList)
            {
                var animeControl = new AnimeControl(animeInfo);
                animeControl.LoadAnime += StartLoadingAnimeInformation;
                if (animeInfo.AnimeThumbnailURL.Contains(VariablesClass.MasterURL))
                {
                    animeControl.AnimeImage.Image = GetImage(animeInfo.AnimeThumbnailURL);
                }
                else
                {
                    animeControl.AnimeImage.ImageLocation = animeInfo.AnimeThumbnailURL;
                }
                alIst.Add(animeControl);
            }
            StaticsClass.InvokeIfRequired(MainFrmPanel, () => MainFrmPanel.Controls.AddRange(alIst.ToArray()));
            StaticsClass.InvokeIfRequired(MainFrmPanel, MainFrmPanel.ResumeLayout);
            StaticsClass.InvokeIfRequired(MainFrmPanel, SetFlowMargin);
        }
Esempio n. 2
0
 private void SetFlowMargin()
 {
     using (var ctrl = new AnimeControl())
     {
         int TotalControlSize     = ctrl.Width + ctrl.Padding.Vertical + ctrl.Margin.Vertical;
         int TotalPaddingRequired = (MainFrmPanel.Width - (TotalControlSize * (int)Math.Floor((Decimal)MainFrmPanel.Width / TotalControlSize))) / 2;
         TotalPaddingRequired -= MainFrmPanel.VerticalScroll.Visible ? SystemInformation.VerticalScrollBarWidth / 2 : 0;
         MainFrmPanel.Padding  = new Padding(TotalPaddingRequired, 0, 0, 0);
     }
 }
Esempio n. 3
0
 private async void StartLoadingAnimeInformation(AnimeControl ac)
 {
     LoadedAnime.AnimeName.Text     = ac.AnimeName.Text;
     LoadedAnime.AnimeSynopsis.Text = ac.AnimeInfo.AnimeSeriesSynopsis;
     LoadedAnime.AnimeImage.Image   = ac.AnimeImage.Image;
     LoadedAnime.AnimeUrl           = $"http://{VariablesClass.MasterURL}" + ac.AnimeInfo.AnimeSeriesURL;
     LoadedAnime.LoadAnimeList(true);
     if (StaticsClass.MyAnimeListObject != null)
     {
         await LoadedAnime.GetAnimeId();
     }
     MainFrmPanel.SendToBack();
 }