Esempio n. 1
0
 /// <summary>
 /// Remove a Movie
 /// Remove all references to this movies in all heroes
 /// </summary>
 /// <param name="movie"></param>
 /// <returns></returns>
 public bool RemoveMovie(ISearchableMovie movie)
 {
     foreach (Hero h in this.ListHeros)
     {
         int index = h.ListMovies.FindIndex(mov => mov.GetId() == movie.GetId());
         if (index != -1)
         {
             h.ListMovies.RemoveAt(index);
         }
     }
     this.ListMovies.Remove(movie);
     return(true);
 }
Esempio n. 2
0
        /// <summary>
        /// Add a movie
        /// Create all references to this movie in all heroes
        /// </summary>
        /// <param name="movie"></param>
        /// <returns></returns>
        public bool AddMovie(ISearchableMovie movie)
        {
            foreach (string hero in movie.GetHeroString())
            {
                int index = this.ListHeros.FindIndex(h => h.Id == hero);
                if (index != -1)
                {
                    movie.AddListHero(this.ListHeros[index]);
                    this.ListHeros[index].ListMovies.Add((Movie)movie);
                }
            }
            this.ListMovies.Add((ISearchableMovie)movie);

            return(true);
        }
Esempio n. 3
0
 public void SendNavigateMovie(ISearchableMovie movie)
 {
     MessengerInstance.Send <MovieMessage>(new MovieMessage(this, movie, "Navigate Movie Message"));
 }
Esempio n. 4
0
 public HistoryObject(string NomVM, ISearchableMovie Movie)
 {
     this.NomVM = NomVM;
     this.Hero  = null;
     this.Movie = Movie;
 }
Esempio n. 5
0
 public HistoryObject(string NomVM, Hero Hero)
 {
     this.NomVM = NomVM;
     this.Hero  = Hero;
     this.Movie = null;
 }
Esempio n. 6
0
 public HistoryObject(ViewModelBase Source)
 {
     this.NomVM = Source.GetType().Name;
     this.Hero  = this.NomVM == "HeroViewModel" ? ((HeroViewModel)Source).Hero : null;
     this.Movie = this.NomVM == "FilmViewModel" ? ((FilmViewModel)Source).Movie : null;
 }
Esempio n. 7
0
 public HistoryObject(string NomVM)
 {
     this.NomVM = NomVM;
     this.Hero  = null;
     this.Movie = null;
 }
Esempio n. 8
0
 public MovieMessage(object sender, object target, ISearchableMovie movie, string status) : base(sender, target)
 {
     Movie  = movie;
     Status = status;
 }
Esempio n. 9
0
 public MovieMessage(ISearchableMovie movie, string status) : base()
 {
     Movie  = movie;
     Status = status;
 }
Esempio n. 10
0
 /// <summary>
 /// Update a Movie in the List
 /// Remove old + Add new
 /// makes sure it doesn't create not linked movie (because of ID changes etc)
 /// </summary>
 /// <param name="movie"></param>
 /// <returns></returns>
 public bool UpdateMovie(ISearchableMovie movieNew, ISearchableMovie movieOld)
 {
     RemoveMovie(movieOld);
     AddMovie(movieNew);
     return(true);
 }
Esempio n. 11
0
 public HistoryMessage(object sender, object target, ISearchableMovie movie, string status) : base(sender, target)
 {
     Hero   = null;
     Movie  = movie;
     Status = status;
 }
Esempio n. 12
0
 public HistoryMessage(ISearchableMovie movie, string status) : base()
 {
     Hero   = null;
     Movie  = movie;
     Status = status;
 }