//public static ObservableCollection<Film> LoadFilmList(string id) //{ // //ObservableCollection<Film> temp = new ObservableCollection<Film>(); // //ObservableCollection<Film> tempReturn = new ObservableCollection<Film>(); // //string fileContent; // //StorageFile file = ApplicationData.Current.LocalFolder.GetFileAsync("FilmData.json").AsTask().Result; // //fileContent = Windows.Storage.FileIO.ReadTextAsync(file).AsTask().Result; // //temp = JsonConvert.DeserializeObject<ObservableCollection<Film>>(fileContent); // //foreach (Film f in temp) // //{ // // if (f.playlistId == id) // // { // // tempReturn.Add(f); // // } // //} // // playListCollection[playListCollection.IndexOf()] // return tempReturn; //} public static void SetFavorites(Playlist pl) { int index = playListCollection.IndexOf(pl); if (playListCollection[index] != null) { if (playListCollection[index].IsFavorite) { playListCollection[index].IsFavorite = false; } else { playListCollection[index].IsFavorite = true; } } }
public static void SaveFilmList(Playlist playlist, ObservableCollection<Film> filmList) { Playlist temp = playListCollection[playListCollection.IndexOf(playlist)]; temp.filmsList = filmList; }
private static bool CheckCategory(Playlist pl, string category) { bool result = false; if (category == "All") { result = true; } else if (category == "Dubbed") { if (pl.title.Contains("(Dub)")) { result = true; } } else if (category == "Subbed") { if (pl.title.Contains("(Sub)")) { result = true; } } else if (category == "Most popular") { if (pl.popularityIndex >= 1000) { result = true; } } else if (category == "Recently updated") { if (pl.publishedDate >= DateTime.Now.AddDays(-7)) { result = true; } } else if (category == "Favorites") { result = pl.IsFavorite; } else result = false; return result; }
private void SetPopupValue(Playlist pl) { Title = pl.title; ImagePath = pl.imagePath; OtherNames = pl.otherNames; Description = pl.description; }
public void Saving(Playlist plt) { plSelected = plt; }
public MainViewModel() { plSelected = new Playlist(); PlCollection = AniTubeData.playListCollection; navigationService = SimpleIoc.Default.GetInstance<INavigationService>(); SetGenres(); GenresPopupCommand = new RelayCommand(() => { GenresIsOpen = true; }); FilterCommand = new RelayCommand(() => { PlCollection = AniTubeData.Filtrate(KeyWord, GenresList, CategorySelectedItem.Content.ToString()); }); ItemSelectedCommand = new RelayCommand<Playlist>((playlist) => { plSelected = playlist; SetPopupValue(playlist); ButtonFavoritesVisibility(playlist.isFavorite); IsOpen = true; }); ButtonSetFavorite = new RelayCommand(() => { AniTubeData.SetFavorites(plSelected); if (plSelected.isFavorite) { ButtonFavoritesVisibility(true); } else { ButtonFavoritesVisibility(false); } }); ButtonHDCommand = new RelayCommand(() => { navigationService.Navigate(typeof(PlaylistView)); Messenger.Default.Send(true, "videoQuality"); Messenger.Default.Send(plSelected, "plToken"); IsOpen = false; }); ButtonSDCommand = new RelayCommand(() => { navigationService.Navigate(typeof(PlaylistView)); Messenger.Default.Send(false, "videoQuality"); Messenger.Default.Send(plSelected, "plToken"); IsOpen = false; }); }