views:

284

answers:

3

Looking at the C# project templates in VS2k8 and the offerings are WPF User Control Library, WPF Custom Control Library and Windows Forms Control Library. Which of these would you use if you wanted to move a legacy active control written in c++ into the world of C# and .NET?

+1  A: 

There is no project template that will do this for you. You might as well read up and start with a usercontrol.

Geoffrey Chetwood
A: 

You would have to consider the target application that will host the control. If it is a line of business application I've heard that WPF doesn't offer great advantages over Forms. According to this blog entry however, the author believes that the killer WPF is a LOB application that leverages the graphical power afforded by WPF for data visualisation.

In the end I guess it is a cost/benefit analysis. Do you go down the WPF route and pay the cost of the learning curve for the future benefit of graphical data visualisation or do you stick with the tried and true method and risk developing an outdated application.

tgeros
+2  A: 

It sounds like you are trying to do several different things all at once:
1. Migrate your code to building in a newer version of visual studio.
2. Migrate your use of technology to a newer technology (ActiveX to .net)
3. Migrate your language (c++ to c#).

If you have a small codebase you are probably as well to start from scratch and port functionality into the new codebase as required.

For a larger codebase you need to realise that this is an expensive task both in effort and defect rate.

An order might be:
1, Import your code into the newer version of visual studio. Get it compiling. Review the project settings for each project.
2. Refactor your code to isolate the mfc and activex code as much as possible. Follow good refactoring practices especially if don't have many unit tests before you start.
3. Consider replacing your ActiveX layer with .net.
4. Consider which GUI toolkit is best for replacing MFC.
5. Language - consider moving first to managed c++.
6. Consider moving from managed c++ to c#.

Most importantly be able to justify doing all of the above!

morechilli