Showing posts with label codesnippit. Show all posts
Showing posts with label codesnippit. Show all posts

Apr 4, 2012

MEF 2 Preview - Making tabs or windows share parts and scope

comment on this

I love MEF, but it isn't without its shortcomings. In previous versions, a big shortcoming was it's lack of anything other than shared or non-shared parts. Either it returned a new instance each time a given type was needed, or everybody got the same one. There was no [simple] way to define scope.

Mar 27, 2012

MEF 2 Preview - Discovering exports from previous versions of MEF

comment on this

Anybody that's felt adventurous enough to try out a preview of the next version of MEF might have run into a problem: it only discovers exports built with the same version of MEF! This might not be a problem for you if you only have one or two projects in your solution. But what about external assembly dependencies? Even if you technically have the source for them in other projects/solutions, it can be a pain to go through them all and rebuild them against the new MEF assemblies. Plus, anybody wanting to use them against the built-in 4.0 MEF will be screwed, which necessitates forking the projects or something else. And what about those assemblies for which you can't build yourself?

Oct 17, 2011

Converting an image byte array into a usable WPF BitmapSource

1 comments

In a couple of our systems at work we store file attachments. The data gets put in a database table as a varbinary column. When we pull this down into our .NET apps, it’s represented as a byte[]. This is convenient to do image processing on it, as well as writing it to a file to be viewed, etc., but what about previewing straight in the application?

Jan 4, 2011

Converting an image to grayscale in WinForms

comment on this

A simple little helper static method to easily convert any image to its grayscale counterpart using older WinForms classes (System.Drawing namespace stuff).