示例#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();
 }