public static ListCollectionView GetVideosView <T>(OnlineVideosMainWindow window, IList <T> videoList, bool addNextPage, bool useTitle2 = false) where T : OnlineVideos.VideoInfo { List <Video> convertedVideos = new List <Video>(); foreach (OnlineVideos.VideoInfo video in videoList) { convertedVideos.Add(new Video(video, useTitle2)); } if (addNextPage) { convertedVideos.Add( new Video( new OnlineVideos.VideoInfo() { Title = OnlineVideos.Translation.Instance.NextPage }) { ThumbnailImage = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images\\NextPage.png") }); } return(new ListCollectionView(convertedVideos) { Filter = new Predicate <object>(v => (((Video)v).Name ?? "").ToLower().Contains(window.CurrentFilter)) }); }
public static ListCollectionView GetSitesView(OnlineVideosMainWindow window) { return new ListCollectionView(OnlineVideos.Sites.Updater.OnlineSites.Select(s => new GlobalSite(s)).ToList()) { Filter = new Predicate<object>(site => (((GlobalSite)site).Name ?? "").ToLower().Contains(window.CurrentFilter)) }; }
public static ListCollectionView GetCategoriesView(OnlineVideosMainWindow window, IList <OnlineVideos.Category> categories, string preselectedCategoryName = null) { int? indexToSelect = null; List <Category> convertedCategories = new List <Category>(); int i = 0; if (categories != null) { foreach (var c in categories) { if (preselectedCategoryName != null && c.Name == preselectedCategoryName) { indexToSelect = i; } convertedCategories.Add(new Category(c)); i++; } } ListCollectionView view = new ListCollectionView(convertedCategories) { Filter = new Predicate <object>(cat => (((Category)cat).Name ?? "").ToLower().Contains(window.CurrentFilter)) }; if (indexToSelect != null) { view.MoveCurrentToPosition(indexToSelect.Value); } return(view); }
public static ListCollectionView GetSitesView(OnlineVideosMainWindow window) { return(new ListCollectionView(OnlineVideos.Sites.Updater.OnlineSites.Select(s => new GlobalSite(s)).ToList()) { Filter = new Predicate <object>(site => (((GlobalSite)site).Name ?? "").ToLower().Contains(window.CurrentFilter)) }); }
public static ListCollectionView GetSitesView(OnlineVideosMainWindow window, string preselectedSiteName = null) { int? indexToSelect = null; List <Site> convertedSites = new List <Site>(); int i = 0; foreach (var s in OnlineVideos.OnlineVideoSettings.Instance.SiteUtilsList.Values) { if (preselectedSiteName != null && s.Settings.Name == preselectedSiteName) { indexToSelect = i; } convertedSites.Add(new Site(s)); i++; } ListCollectionView view = new ListCollectionView(convertedSites) { Filter = new Predicate <object>(s => ((ViewModels.Site)s).Name.ToLower().Contains(window.CurrentFilter)), }; if (indexToSelect != null) { view.MoveCurrentToPosition(indexToSelect.Value); } return(view); }
public static ListCollectionView GetSitesView(OnlineVideosMainWindow window, string preselectedSiteName = null) { int? indexToSelect = null; List<Site> convertedSites = new List<Site>(); int i = 0; foreach (var s in OnlineVideos.OnlineVideoSettings.Instance.SiteUtilsList.Values) { if (preselectedSiteName != null && s.Settings.Name == preselectedSiteName) indexToSelect = i; convertedSites.Add(new Site(s)); i++; } ListCollectionView view = new ListCollectionView(convertedSites) { Filter = new Predicate<object>(s => ((ViewModels.Site)s).Name.ToLower().Contains(window.CurrentFilter)), }; if (indexToSelect != null) view.MoveCurrentToPosition(indexToSelect.Value); return view; }
public static ListCollectionView GetCategoriesView(OnlineVideosMainWindow window, IList<OnlineVideos.Category> categories, string preselectedCategoryName = null) { int? indexToSelect = null; List<Category> convertedCategories = new List<Category>(); int i = 0; if (categories != null) { foreach (var c in categories) { if (preselectedCategoryName != null && c.Name == preselectedCategoryName) indexToSelect = i; convertedCategories.Add(new Category(c)); i++; } } ListCollectionView view = new ListCollectionView(convertedCategories) { Filter = new Predicate<object>(cat => (((Category)cat).Name ?? "").ToLower().Contains(window.CurrentFilter)) }; if (indexToSelect != null) view.MoveCurrentToPosition(indexToSelect.Value); return view; }