コード例 #1
0
ファイル: VieModel_Main.cs プロジェクト: scropothree/Jvedio
 public void Flow()
 {
     if (MovieList != null)
     {
         CurrentMovieListHideOrChanged?.Invoke(this, EventArgs.Empty); //停止下载
         int DisPlayNum = Properties.Settings.Default.DisplayNumber;
         int SetFlowNum = Properties.Settings.Default.FlowNum;
         Movies = new List <Movie>();
         for (int i = (CurrentPage - 1) * DisPlayNum + FlowNum * SetFlowNum; i < (CurrentPage - 1) * DisPlayNum + (FlowNum + 1) * SetFlowNum; i++)
         {
             if (CurrentMovieList.Count < DisPlayNum)
             {
                 if (i <= MovieList.Count - 1)
                 {
                     Movie movie = MovieList[i];
                     if (!Properties.Settings.Default.AsyncShowImage)
                     {
                         LoadImageAndInfo(ref movie);
                     }
                     if (!string.IsNullOrEmpty(movie.id))
                     {
                         Movies.Add(movie);
                     }
                 }
                 else
                 {
                     break;
                 }
             }
             else
             {
                 FlowNum = 0;
             }
         }
         CurrentMovieList.AddRange(Movies);
         CurrentCount = CurrentMovieList.Count;
         App.Current.Dispatcher.Invoke((Action) delegate
         {
             CurrentMovieListChangedCompleted?.Invoke(this, EventArgs.Empty);
             Main main = App.Current.Windows[0] as Main;
             if (Properties.Settings.Default.ShowImageMode == "预览图")
             {
                 main.ImageSlideTimer.Start();                                                    //0.5s后开始展示预览图
             }
             IsFlipOvering = false;
             main.AsyncLoadImage(); //异步加载图片
             main.IsFlowing = false;
             main.SetSelected();
         });
     }
 }
コード例 #2
0
ファイル: VieModel_Main.cs プロジェクト: scropothree/Jvedio
        /// <summary>
        /// 翻页:加载图片以及其他
        /// </summary>
        public bool FlipOver()
        {
            GetLabelList();
            if (Properties.Settings.Default.ShowImageMode == "列表模式")
            {
                ShowDetailsData();
            }
            else
            {
                IsFlipOvering = true;
                Task.Run(() =>
                {
                    if (MovieList != null)
                    {
                        TotalPage = (int)Math.Ceiling((double)MovieList.Count / (double)Properties.Settings.Default.DisplayNumber);

                        int DisPlayNum = Properties.Settings.Default.DisplayNumber;
                        int FlowNum    = Properties.Settings.Default.FlowNum;
                        DisposeMovieList(CurrentMovieList);

                        Console.WriteLine("CurrentPage=" + CurrentPage);
                        Movies = new List <Movie>();
                        for (int i = (CurrentPage - 1) * DisPlayNum; i < (CurrentPage - 1) * DisPlayNum + FlowNum; i++)
                        {
                            if (i <= MovieList.Count - 1)
                            {
                                Movie movie = MovieList[i];
                                if (!Properties.Settings.Default.AsyncShowImage)
                                {
                                    LoadImageAndInfo(ref movie);
                                }
                                Movies.Add(movie);
                            }
                            else
                            {
                                break;
                            }
                            if (Movies.Count == FlowNum)
                            {
                                break;
                            }
                        }

                        //添加标签戳
                        for (int i = 0; i < Movies.Count; i++)
                        {
                            if (Identify.IsHDV(Movies[i].filepath))
                            {
                                Movies[i].tagstamps += "高清";
                            }
                            if (Identify.IsCHS(Movies[i].filepath))
                            {
                                Movies[i].tagstamps += "中文";
                            }
                            if (Identify.IsFlowOut(Movies[i].filepath))
                            {
                                Movies[i].tagstamps += "流出";
                            }
                        }
                        //List<Movie> movies = Movies;
                        //Movies = new List<Movie>();


                        //for (int i = 0; i < movies.Count; i++)
                        //{
                        //    if (!string.IsNullOrEmpty(movies[i].tagstamps))
                        //    {
                        //        if (ShowHDV && movies[i].tagstamps.IndexOf("高清") >=0 && !Movies.Contains(movies[i]))  Movies.Add(movies[i]);
                        //        if (ShowCHS && movies[i].tagstamps.IndexOf("中文") >= 0 && !Movies.Contains(movies[i])) Movies.Add(movies[i]);
                        //        if (ShowFlowOut && movies[i].tagstamps.IndexOf("流出") >= 0 && !Movies.Contains(movies[i])) Movies.Add(movies[i]);

                        //        if(!ShowHDV && !ShowCHS && !ShowFlowOut && !Movies.Contains(movies[i])) Movies.Add(movies[i]);

                        //    }
                        //}



                        App.Current.Dispatcher.Invoke((Action) delegate
                        {
                            CurrentMovieList = new ObservableCollection <Movie>();
                            CurrentMovieList.AddRange(Movies);
                            CurrentCount = CurrentMovieList.Count;
                            Main main    = App.Current.Windows[0] as Main;
                            if (Properties.Settings.Default.ShowImageMode == "预览图")
                            {
                                main.ImageSlideTimer.Start();                                            //0.5s后开始展示预览图
                            }
                            IsFlipOvering = false;
                            main.AsyncLoadImage(); //异步加载图片
                            main.IsFlowing = false;
                            main.SetSelected();
                            CurrentMovieListChangedCompleted?.Invoke(this, EventArgs.Empty);
                        });
                    }
                });
            }

            return(true);
        }
コード例 #3
0
ファイル: VieModel_Main.cs プロジェクト: catbei2020/Jvedio
        /// <summary>
        /// 翻页:加载图片以及其他
        /// </summary>
        public void FlipOver()
        {
            if (Properties.Settings.Default.ShowImageMode == "列表模式")
            {
                ShowDetailsData();
            }
            else
            {
                IsFlipOvering = true;
                Task.Run(() =>
                {
                    if (MovieList != null)
                    {
                        TotalPage = (int)Math.Ceiling((double)MovieList.Count / (double)Properties.Settings.Default.DisplayNumber);

                        int DisPlayNum = Properties.Settings.Default.DisplayNumber;
                        int FlowNum    = Properties.Settings.Default.FlowNum;
                        DisposeMovieList(CurrentMovieList);

                        Console.WriteLine("CurrentPage=" + CurrentPage);
                        Movies = new List <Movie>();
                        for (int i = (CurrentPage - 1) * DisPlayNum; i < (CurrentPage - 1) * DisPlayNum + FlowNum; i++)
                        {
                            if (i <= MovieList.Count - 1)
                            {
                                Movie movie = MovieList[i];
                                if (!Properties.Settings.Default.AsyncShowImage)
                                {
                                    LoadImageAndInfo(ref movie);
                                }
                                Movies.Add(movie);
                            }
                            else
                            {
                                break;
                            }
                            if (Movies.Count == FlowNum)
                            {
                                break;
                            }
                        }


                        App.Current.Dispatcher.Invoke((Action) delegate
                        {
                            CurrentMovieList = new ObservableCollection <Movie>();
                            CurrentMovieList.AddRange(Movies);
                            CurrentCount = CurrentMovieList.Count;
                            Main main    = App.Current.Windows[0] as Main;
                            if (Properties.Settings.Default.ShowImageMode == "预览图")
                            {
                                main.ImageSlideTimer.Start();                                                    //0.5s后开始展示预览图
                            }
                            IsFlipOvering = false;
                            main.AsyncLoadImage(); //异步加载图片
                            main.IsFlowing = false;
                            main.SetSelected();


                            CurrentMovieListChangedCompleted?.Invoke(this, EventArgs.Empty);
                        });
                    }
                });
            }
        }