Пример #1
0
 public EditGenreViewModel(Genre genre)
 {
     this.Genre = genre;
     this.Name  = genre.Name;
     EditGenre  = new SimpleCommand <object>((object ignored) =>
     {
         Genre.Edit(Name);
         RaiseFinished();
     }, (object ignored) => !string.IsNullOrWhiteSpace(Name));
     PropertyChanged += (object sender, PropertyChangedEventArgs args) => EditGenre.RaiseCanExecuteChanged();
 }
Пример #2
0
        public CreateGenreViewModel(Database database)
        {
            this._database = database;

            AddGenre = new SimpleCommand <object>((ignored) =>
            {
                database.AddGenre(new Genre(Name));
                RaiseFinished();
            }, (ignored) => !string.IsNullOrWhiteSpace(Name));
            PropertyChanged += (sender, prop) => AddGenre.RaiseCanExecuteChanged();
        }
Пример #3
0
 public CreateActorViewModel(Database database)
 {
     this._database = database;
     AddActor       = new SimpleCommand <object>((object ignored) =>
     {
         database.AddActor(new Actor(FirstName, LastName));
         RaiseFinished();
     }, (object ignored) => !string.IsNullOrWhiteSpace(FirstName) &&
                                                 !string.IsNullOrWhiteSpace(LastName));
     PropertyChanged += (object sender, PropertyChangedEventArgs args) => AddActor.RaiseCanExecuteChanged();
 }
Пример #4
0
 public EditActorViewModel(Actor actor)
 {
     this.Actor     = actor;
     this.FirstName = actor.FirstName;
     this.LastName  = actor.LastName;
     EditActor      = new SimpleCommand <object>((object ignored) =>
     {
         Actor.Edit(FirstName, LastName);
         RaiseFinished();
     }, (object ignored) => !string.IsNullOrWhiteSpace(FirstName) &&
                                                 !string.IsNullOrWhiteSpace(LastName));
     PropertyChanged += (object sender, PropertyChangedEventArgs args) => EditActor.RaiseCanExecuteChanged();
 }
Пример #5
0
        public CreateMovieViewModel(Database database)
        {
            this._database = database;

            AddMovie = new SimpleCommand <object>((ignored) =>
            {
                database.AddMovie(new Movie(Title, ReleaseDate, Actor, Genre));
                RaiseFinished();
            }, (ignored) => !string.IsNullOrWhiteSpace(Title) &&
                                                  ReleaseDate != null &&
                                                  Actor != null &&
                                                  Genre != null);

            PropertyChanged += (sender, prop) => AddMovie.RaiseCanExecuteChanged();
        }
Пример #6
0
 public EditMovieViewModel(Movie movie, Database database)
 {
     this._database   = database;
     this.Movie       = movie;
     this.Title       = movie.Title;
     this.ReleaseDate = movie.ReleaseDate;
     this.Actor       = movie.Actor;
     this.Genre       = movie.Genre;
     EditMovie        = new SimpleCommand <object>((object ignored) =>
     {
         Movie.Edit(Title, ReleaseDate, Actor, Genre);
         RaiseFinished();
     }, (object ignored) => !string.IsNullOrWhiteSpace(Title) &&
                                                   ReleaseDate != null &&
                                                   Actor != null &&
                                                   Genre != null);
     PropertyChanged += (object sender, PropertyChangedEventArgs args) => EditMovie.RaiseCanExecuteChanged();
 }