WPF : Some Good Cinch News

I have now included some code snippets (C# only sorry) to help you develop ViewModels using my Cinch MVVM Framework.

I did not write these code snippets myself, one of the Cinch MVVM Framework users, a chap called Manuvdp uploaded them as a patch to the Cinch MVVM Framework codeplex site.

I have checked that I am happy with them before I included them, and I am. So what I have done is included Manuvdp original code snippets and also created a VSI Installer for them.

So after you have installed the snippets using the VSI, and you are doing a Cinch MVVM Framework app and type in “Cinch”, here is what you get:

snips

Neato.

In case any of you are wondering how to create a VSI installer for the code snippets here is a step by step guide.

Step1

Store your snippets in a folder somewhere (I called this CodeSnippets)

Step2

Create a new XML File in Visual Studio in the same folder as all your code snippets. I name this file CinchSnippets.xml. This xml file will be the manifest file.

Step3

Rename CinchSnippets.xml to CinchSnippets.vscontent

Step4

I edited the CinchSnippets.vscontent to include each of the snippets I wanted to be part of the VSI installer. Shown below is an example of what this xxxxx.vscontent manifest file should look like:

<?xml version="1.0" encoding="UTF-8"?>
<VSContent
  xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
  <Content>
    <FileName>Cinch0.snippet</FileName>
    <DisplayName>Cinch : Code snippet for a 
    EditableValidatingObject overrides</DisplayName>
    <Description>Code snippet for a 
    EditableValidatingObject overrides
    </Description>
    <FileContentType>Code Snippet</FileContentType>
    <ContentVersion>1.0</ContentVersion>
    <Attributes>
      <Attribute name="lang" value="csharp"></Attribute>
    </Attributes>
  </Content>
  <Content>
    <FileName>CinchBGWorker.snippet</FileName>
    <DisplayName>Cinch : Code snippet for a 
    Background worker</DisplayName>
    <Description>
      Code snippet for a Background worker
    </Description>
    <FileContentType>Code Snippet</FileContentType>
    <ContentVersion>1.0</ContentVersion>
    <Attributes>
      <Attribute name="lang" value="csharp"></Attribute>
    </Attributes>
  </Content>
</VSContent>

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

This is for 2 snippets, which you can see in the Content elements. If you need more, just add more Content elements.

Step5

I then zipped all the xxxx.snippet files and the xxxxx.vscontent file (CinchSnippets.vscontent in my case) into a new zip file, say CinchCodeSnippets.zip

Step6

I then renamed the zip file CinchCodeSnippets.zip –> CinchCodeSnippets.vsi

Step7

You can then run  the VSI installer by double clicking on the newly created CinchCodeSnippets.vsi

 

NOTE :I Would not download the entire Cinch MVVM Framework again, as I am still working on one improvement which I hope to have resolved very soon. You should however be able to grab all the items new CodeSnippets folder, and I will make an announcement on this blog when I have made the improvement or not. Depends on how hairy it gets, either way I will let you all know.

Enjoy

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: