A while ago I released my Cinch MVVM Library out there into the wild, and the reception it was got has been pretty good, so I thank you all for that. When I wrote Cinch, I was aware that there was a bit of code that I was still asking people to write, al be it they would gain a lot too, such as support for ViewModel controlled data editability/editable object support etc etc.
But there was still a bit of code that users had to write on their own, even if once they inherited from the correct Cinch base class ViewModel (there are 3 choices for that by the way). So I thought how easy it would be to create a code generator to simplify this process. I am pleased to say I am practically done with this and it should be available from the main Cinch site (which has had the source code moved to codeplex for obvious reasons) within a week.
For now here are some earlier preview screen shots:
Creating a new ViewModel
To create a ViewModel all you will need to do is pick your base class, and then pick some properties. Where if the property type you want isn’t present, just go and add it, and it will then be saved and will then become available now and in future.
Creating a new property
Editing the list of globally available property types
Like I said if the property you want is not, you can edit the list of available properties (which are backed up to file), and then use them straight away
Saving a ViewModel so you can edit and generate the code later, or edit an existing ViewModels generated code
You can save a ViewModel configuration, so you can come back and re-edit or modify the code that will get generated.
Generating The Code
This part is clever, the Cinch Code Generator, will actually attempt to compile your code, and providing all the Types you used are available in the assumed standard Assemblies, It will give you a green or red light. A red light may occur as you picked a property type that is not known about, that may be a custom business object class that you plan to add later. You could fix this to be part of the expected assemblies by editing the Cinch Code generator code. If I have time I may add this feature.
Anyway shown below is a red light that comes out of the compile process, but you WILL always be able to override this and choose to generate the final code anyway. It’s YOUR choice.
If All Goes Well, Preview The Code
If everything goes fine, 2 new tabs are shown with the generated code, I decided to split this over a g.cs which is a totally generated code file and should never be hand edited and a .cs file which you can edit. However if you run the Cinch code generator and copy the files it produces, you should be careful not to overwrite your custom part, that would be bad.
So there you go that’ a taster of what’s coming. Hope you like it. It is not far off believe me, 1 – 2 weeks tops.