Skip to content

Instantly share code, notes, and snippets.

@jcbozonier
Created February 16, 2009 22:13
Show Gist options
  • Save jcbozonier/65405 to your computer and use it in GitHub Desktop.
Save jcbozonier/65405 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using FantasyNewApp.Models;
using FantasyNewApp.Utilities;
namespace FantasyNewApp.ViewModels
{
public class PersonViewModel : INotifyPropertyChanged
{
private Person _MyPerson;
public Click_Command Clicky { get; set; }
public string FirstName
{
get
{
return _MyPerson.FirstName;
}
set
{
_MyPerson.FirstName = value;
}
}
public string MiddleName
{
get
{
return _MyPerson.MiddleName;
}
set
{
_MyPerson.MiddleName = value;
}
}
public string LastName
{
get
{
return _MyPerson.LastName;
}
set
{
_MyPerson.LastName = value;
}
}
public string DisplayName
{
get
{
return _MyPerson.DisplayName;
}
}
public PersonViewModel()
{
var person = new Person()
{
FirstName = "Justin",
MiddleName = "Charles",
LastName = "Bozonier"
};
_MyPerson = person;
_MyPerson.SubscribeToChange(() => _MyPerson.FirstName, (s, e) =>PropertyChanged.Notify(() => FirstName));
_MyPerson.SubscribeToChange(() => _MyPerson.MiddleName, (s, e) => PropertyChanged.Notify(() => MiddleName));
_MyPerson.SubscribeToChange(() => _MyPerson.LastName, (s, e) => PropertyChanged.Notify(() => LastName));
_MyPerson.SubscribeToChange(() => _MyPerson.DisplayName, (s, e) => PropertyChanged.Notify(() => DisplayName));
Clicky = new Click_Command();
}
public event PropertyChangedEventHandler PropertyChanged;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment