Created
May 19, 2012 21:51
-
-
Save anaisbetts/2732489 to your computer and use it in GitHub Desktop.
Using Mustache to generate C# code
This file contains hidden or 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 ReactiveUI; | |
| using ReactiveUI.Xaml; | |
| using ReactiveUI.Routing; | |
| namespace {{projectName}}.ViewModels | |
| { | |
| {{#interfaces}} | |
| {{definition}} | |
| {{/interfaces}} | |
| {{#interfaces}} | |
| public void {{implClassName}} : ReactiveObject, {{interfaceName}} | |
| { | |
| {{#properties}} | |
| {{#outputProp}} | |
| ObservableAsPropertyHelper<{{type}}> _{{name}}; | |
| public {{type}} {{name}} { | |
| get { return _{{name}}; } | |
| } | |
| {{/outputProp}} | |
| {{#readWriteProp}} | |
| {{type}} _{{name}}; | |
| public {{type}} {{name}} { | |
| get { return _{{name}}; } | |
| set { this.RaiseAndSetIfChanged(x => x.{{name}}, value); } | |
| } | |
| {{/readWriteProp}} | |
| {{#onceProp}} | |
| {{type}} {{name}} { get; protected set; } | |
| {{/onceProp}} | |
| {{/properties}} | |
| {{#isRoutableViewmodel}} | |
| public IScreen HostScreen { get; protected set; } | |
| public string UrlPathSegment { | |
| get { return "TODO: Implement Me"; } | |
| } | |
| public {{implClassName}}(IScreen hostScreen) | |
| { | |
| HostScreen = hostScreen; | |
| // TODO: Wire up your properties here! | |
| } | |
| {{^isRoutableViewmodel}} | |
| public {{implClassName}}() | |
| { | |
| // TODO: Wire up your properties here! | |
| } | |
| {{/isRoutableViewmodel}} | |
| } | |
| {{/interfaces}} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment