Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switching from Windows Form to Web Form

Tags:

c#

.net

activex

I created a Windows Form executable in .NET 3.5 that uses a dll to communicate with a machine that scans checks. I'm eventually going to need to move from an executable to a Web Form that can do the same thing. This will be months from now, but I wanted to start doing the research now as I have not done this before. I'm going to need to use ActiveX in order to communicate with the device via a Web Form. I've also not done this before.

I'd like to keep the functionality of my existing executable without having to rewrite most of it, although I do understand that some of it will need to be rewritten. I've done research on ActiveX and how to use it, but I wanted to know if someone has had a similar situation as this. What did you do to convert an exe to a web program? Are there good, specific sources out there that I'm overlooking that can point me in the right direction for this situation? Is there any advice that you can give from your experiences that can help me to reduce mistakes? The company that I work for does not have anyone else here that has done this before, so I've got to teach myself everything needed to do this.

Thanks in advance.

like image 382
Aaron Avatar asked Mar 03 '10 15:03

Aaron


People also ask

How do I convert WinForms to Webforms?

If you have designed the application well enough it should be relatively easy to convert a Win Forms application to a web forms application by just swapping out the UI layer and replacing it. You are re-using the logic and data layers (which is where all the functionality would be).

What is the difference between Windows Forms and Web Forms?

However asp.net added unique features to it like view state, postback etc., Webforms are platform independent i.e works on a thin client like web browser, stateless client server architecture. Windows forms are used in desktop based applications which heavily rely on the GDI.

Should you still use Windows Forms?

Thanks to the utility, easy code, simple drag, and drop design interface, … Win Form has been used to develop many applications. Because of its high age (born in 2003), WinForm was officially declared dead by Microsoft in 2014. However, Win Form is still alive and well.


2 Answers

This is where separation of concerns and n-tier design shine through. Hopefully your UI layer is loosely coupled from your domain model. If this is the case, you can code a second IU layer for the web. And not have to change your domain model at all. Then you can compile for each scenario.

*note - In practical use I have always had to extend my business domain to account for some issues with the second UI, but those modifications have usually been minor, and have pointed out places where I had coupled too tightly anyway.


Another option you may consider is creating a web services layer over your business domain code. And then coding a web application that communicates with your domain model via those web services calls. This may have performance implications, and would not be my preferred method of accomplishing this. Though you may find it more manageable if you don't have a well designed application to start with.

like image 143
Matthew Vines Avatar answered Sep 25 '22 10:09

Matthew Vines


"I'd like to keep the functionality of my existing executable without having to rewrite most of it"

In general if you extract as much logic as possible into its own assembly/dll, you can reuse that from whatever UI framework you want. Just make sure you're not doing anything UI specific in there (throwing up dialog boxes, etc).

like image 33
heisenberg Avatar answered Sep 23 '22 10:09

heisenberg