Use a webpage as the UI in a C# desktop application?
November 22, 2018
I am actually developing a C# personal computer app with an easy UI. Because of my familiarity with HTML/CSS, as well as a previous online iteration of a quite comparable application, it will be suitable if I could possibly re-use some existing HTML/CSS webpages I possess as the UI for this brand new desktop app.
Is actually that do-able with C#? Can anybody present a simple example of making use of an HTML/CSS page as the UI of a C# desktop computer use?
indeed because case it is a personal computer request; in C# you can generate a win types or even wpf treatment.
Electron-Edge – is actually the way to select a brand new Electron application that communicates to a.NET backend (a DLL). Largely made use of as well as assisted.
NET WPF apps that need a HTML UI. Needs using Vue.
You may use WebBrowser management to incorporate Internet web browser capability to your application.
You can easily develop your very own html( s) and specify your WebBrowser command to feature those pages. You can get through clicking on links or by utilizing key-board faster ways to move in reverse and also forward via navigating history. Through nonpayment, you may access additional internet browser functionality by means of the right-click faster way menu
You can easily even handle those webpages centrally (for e.g. on LAN) and all clients on LAN can connect to this core area. In this manner you can tweak webpages centrally.
You can attempt to use a Chromium-based management – DotNetBrowser. This command provides broad interactivity options, like DOM adjustment and also DOM events, which could be beneficial in your case.
Moreover, there is actually an article that demonstrates exactly how to use a websites as HTML User Interface in a C# pc application
Unfortunately neither WinForms or WPF is sufficiently like HTML/CSS to be actually of that kind of use. You’ll be capable to recycle the layout-concepts and craft certainly. And, along with WPF being the closest point to it, you could also keep a ton of the code-behind code.
You might make an effort incorporating an Internet Web browser management to a types document to show your page. This are going to need to have to be actually remotely thrown as the code will certainly not be actually capable to perform locally, except if you listen closely for the details web links in c# as well as then conduct the actions.
You might likewise try your hand at WPF which is a brand-new innovation to develop excellent looking gui’s along with mark-up similar to html, which you’ll grab pretty quickly with your html experience.
You are actually utilizing WebSockets on the client side as well as plain outlets on hosting server side. However, WebSockets are actually certainly not the like plain outlets and also to connect with a WebSockets client the server needs to have to speak the WebSockets use protocol.
See Composing a WebSocket server in C# just how this may be done and also see likewise Differences in between TCP outlets and also internet outlets, again to understand why one can easily certainly not utilize an easy TCP web server with a WebSockets client like you are making an effort to perform.