/// <summary> /// Charge les infos nécéssaire pour faire apparaitre le dlg /// </summary> /// <param name="id">l'id du massLoad</param> public async Task <bool> LoadDlg(int id) { var retour = true; try { ListeFilmDlg?.Clear(); //si il n'y a pas de liste, on cherche if (ListeData.First(x => x.Id == id).Results == null || ListeData.First(x => x.Id == id).Results?.total_results == 0 || TextChanged) { var film = ListeData.First(x => x.Id == id); var res = await _movieDbBusiness.RechercheFilm(film.Name); if (res.total_results == 1) { film.Movie = await GetFilm(res.results[0].id); film.Resultat = film.Movie.Titre; film.IsOk = true; film.PlusieursRes = false; film.Color = "ForestGreen"; film.Results = res; } else if (res.total_results > 1) { film.Results = res; film.Resultat = ResourceLoader.GetForCurrentView().GetString("PlusieursRes"); film.PlusieursRes = true; film.Color = "OrangeRed"; } else { film.Resultat = ResourceLoader.GetForCurrentView().GetString("AucunRes"); film.Color = "Firebrick"; film.IsOk = false; film.PlusieursRes = false; retour = false; } TextChanged = false; } if (ListeData.Count(x => x.Id == id) > 0) { var tmp = ListeData.First(x => x.Id == id); if (tmp.Results != null) { ListeFilmDlg = new List <ResultSearchMovieJson>(ListeData.First(x => x.Id == id).Results.results); } SelectedMassLoad = id; } return(retour); } catch (Exception) { return(false); } }
/// <summary> /// Récupère un film d'internet à partir de la dlg /// </summary> /// <param name="idFilmInternet">l'id internet</param> public async Task SelectMovieFmDlg(int idFilmInternet) { var film = await GetFilm(idFilmInternet); var massLoad = ListeData.First(x => x.Id == SelectedMassLoad); massLoad.Movie = film; massLoad.Resultat = film.Titre; massLoad.IsOk = true; massLoad.Color = "ForestGreen"; UpdateListeData(); }
/// <summary> /// Efface un film de la liste /// </summary> /// <param name="id">l'id du massLoad à supprimer</param> public void DeleteMovie(int id) { ListeData.Remove(ListeData.First(x => x.Id == id)); UpdateListeData(); }