Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web interface for Windows Forms Application

Tags:

c#

winforms

I need to add a web interface to a Windows Forms application. In fact the application just has one form containing some standard controls (buttons, trackbars, etc..) that are sending commands via the Serial Port to a microcontroller.

Now i need to have more or less the same form also available as Web interface. What is the best way to achieve this?

like image 271
nr1 Avatar asked Oct 09 '22 13:10

nr1


1 Answers

Decouple all business logic and objects from the UI and put that into a library assembly of its own (call it Domain, for example).

Do the same with all data access routines.

Use these libraries in your winforms application and develop a new web application against them.

This is a common pattern, when you separate the business rules and data access to their own assemblies to decouple them from your UI, allowing you to write different UI's that conform to the same set of business rules and data layer.

like image 142
Oded Avatar answered Oct 13 '22 10:10

Oded