Skip to content

Instantly share code, notes, and snippets.

@slodge
Created July 17, 2013 10:29
Show Gist options
  • Save slodge/6019441 to your computer and use it in GitHub Desktop.
Save slodge/6019441 to your computer and use it in GitHub Desktop.
public class FirstViewModel
: MvxViewModel
{
public readonly INC<string> FirstName = new NC<string>("");
public readonly INC<string> LastName = new NC<string>("");
public readonly INC<TitleResponse> Title = new NC<TitleResponse>();
public readonly INC<bool> Accepted = new NC<bool>();
public readonly ObservableCollection<Person> People = new ObservableCollection<Person>();
public readonly List<TitleResponse> Titles = new List<TitleResponse>()
{
TitleResponse.None,
TitleResponse.Mr,
TitleResponse.Dr,
TitleResponse.Mrs,
TitleResponse.Ms,
TitleResponse.Miss,
};
public void Add()
{
if (!Accepted.Value)
return;
People.Add(new Person()
{
FirstName = FirstName.Value,
LastName = LastName.Value,
Title = Title.Value
});
Title.Value = TitleResponse.None;
FirstName.Value = "";
LastName.Value = "";
Accepted.Value = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment