Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Silverlight version of existing C# code that relies on System.Drawing namespace

We have pretty much C# 2.0 code that heavily relies on System.Drawing namespace. Also there is some WinGDI dependencies (via interop).

How would you recommend to tackle the problem of making functionally equivalent Silverlight version of the code? We want to reuse code as much as possible because we want to continue develop both versions of the code.

Maybe there is some articles/books you could recommend?

UPDATE: The code is a non-visual component. Not an application. There is no 3rd party dependencies.

like image 556
Bobrovsky Avatar asked Dec 09 '10 18:12

Bobrovsky


1 Answers

I have a great experience in creating wpf/silverlight versions of software that used to be built using winforms. It's sad, but in your case, when you use a lot of interop and System.Drawing things, it's practically impossible to do such a thing.

Of cource, you can always try (and really you always have to) to separate your business logic from interface, but in such situation (I hope a'm wrong!), your interface have to be completely redesigned, because of differences in architecture of winforms and wpf/silverlight.

In my experience, this problem solved in this way: all old winforms components stayed just the same, but all new features were built using wpf with help of injection of wpf controls into winforms application.

Yes, sometimes it's weird, but it's really more productive than just waste all your old code and spend huge amount of time and money into new, that does just the same.

like image 147
Andrey Neverov Avatar answered Oct 28 '22 20:10

Andrey Neverov