Created
February 16, 2009 22:13
-
-
Save jcbozonier/65405 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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