简体   繁体   English

Windows窗体应用程序的Web界面

[英]Web interface for Windows Forms Application

I need to add a web interface to a Windows Forms application. 我需要为Windows窗体应用程序添加一个Web界面。 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. 现在我需要或多或少具有与Web界面相同的形式。 What is the best way to achieve this? 实现这一目标的最佳方法是什么?

Decouple all business logic and objects from the UI and put that into a library assembly of its own (call it Domain, for example). 从UI中分离所有业务逻辑和对象,并将其放入自己的库程序集中(例如,将其称为Domain)。

Do the same with all data access routines. 对所有数据访问例程执行相同操作。

Use these libraries in your winforms application and develop a new web application against them. 在winforms应用程序中使用这些库,并针对它们开发新的Web应用程序。

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. 当您将业务规则和数据访问权限分离到自己的程序集以将它们与UI分离时,这是一种常见模式,允许您编写符合同一组业务规则和数据层的不同UI。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows Forms应用程序中的Windows.Web.Http? - Windows.Web.Http in Windows Forms application? 从Windows窗体应用程序调用Web API - Calling a Web API from Windows Forms application 将Windows Forms .NET应用程序的UI移至Web - Move UI of Windows Forms .NET application to web 如何将Web Interface添加到C#Windows应用程序 - How to add Web Interface to C# Windows Application 使用system.windows.forms.browser将cookie发送到Web应用程序 - Send cookie to web application using system.windows.forms.browser 在Windows窗体应用程序中以编程方式单击网页的按钮 - Programmatically Clicking on a Web Page's Button in Windows Forms Application 如何在 Visual Studio 2019 Windows Forms 应用程序中显示 Web 浏览器? - How to show Web Browser in Visual Studio 2019 Windows Forms Application? .net Web应用程序是否可以在“表单”和“ Windows”中使用身份验证 - Can we use Authentication in 'Forms' and as well in 'Windows' for a .net web application 将Windows窗体应用程序连接到C#Web服务? - Connecting a windows forms application to a C# web service? 如何在Windows应用程序和Web窗体应用程序中使用dll,即使它引用Web内容(如nUnit)? - How to use a dll in both windows application and web forms application even if it references web stuff (like nUnit)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM