Last active
August 29, 2015 14:02
-
-
Save rid00z/7266fd6c98d7a25b4b41 to your computer and use it in GitHub Desktop.
A sample PageModel from a Xamain.Forms Mvvm
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
public class QuotePageModel : BasePageModel | |
{ | |
IDatabaseService _databaseService; | |
public Quote Quote { get; set; } | |
//The database service is automatically injected. | |
public QuotePageModel (IDatabaseService databaseService) | |
{ | |
_databaseService = databaseService; | |
} | |
//This is executed when the model is pushed | |
public void Init(object data) | |
{ | |
Quote = data as Quote; | |
if (Quote == null) | |
Quote = new Quote (); | |
} | |
public Command Done | |
{ | |
get { | |
return new Command (() => { | |
//This pops the current Page | |
PopPageModel(); | |
}); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment