Open robertkraig opened 7 years ago
My objective is to host some simple binary image file for an IoT Node Application.
Just look at NowinSample/Program.cs it cannot be much easier than that.
If I understood your question correctly - you don't even need to use BackgroundWorker. Once you've created and started a server (see NowinSample/Program.cs as @Bobris mentioned) it will run until either stopped or disposed (so keep a reference alive, stop+dispose when no longer needed). Nowin uses external threads (simplified a bit, don't recall if there is an option to flow execution context) to handle requests. This however might require additional care when dealing with forms and controls - namely something like this:
if (control.InvokeRequired)
{
control.Invoke(()=>...action...);
}
else
{
...action...
}
I've written an application which is form-based, it does some interval updates, I wanted to know if it's possible to provide an example of what it would look like to configure this application to use a BackgroundWorker such that the webserver could run in background while in a WinForm application.