[Mono-list] Mono, Windows Forms, and Headless operation
George, Glover E ERDC-RDE-ITL-MS
Glover.E.George at erdc.dren.mil
Fri Jan 8 16:15:46 UTC 2016
Again, I agree with the separation of business logic from the GUI. In
fact, on mono, I never want to see the GUI. It¹s due to the fact that my
parallelism relies on multiple concurrent BackgroundWorkers. I¹m
restricted to .net 2.0 , nothing later. So I don¹t have the TPL
available. I have BackgroundWorkers, Threads, and Threadpool. As I
understand it, Threadpools don¹t have a way to know when they are finished
(at least, not directly). Perhaps I misunderstand. BackgroundWorkers are
simple, and are performing their function perfectly on Mono, so long as X
is there. The only option left is directly using Threads.
So to be clear, the only reason I wanted Windows Forms on Mono is to use
BackgroundWorker because it¹s simple and it works.
‹ ‹ ‹
Glover E. George
Information Technology Laboratory
US Army Engineer Research and Development Center
Vicksburg, MS 39180
On 1/8/16, 10:09 AM, "Edward Ned Harvey (mono)"
<edward.harvey.mono at clevertrove.com> wrote:
>I think the advice would generally be:
>1. Yes you can absolutely write a Console Application, which works
>perfectly cross-platform, and does not need any WinForms or X11. (Right
>click your solution, new project, Console Application). It's better to
>create a new project than to convert an existing WinForms project, unless
>you know all the details of what's different between the two types of
>projects. They launch differently, in different thread compartments, and
>some stuff like that - it's not as simple as merely removing the
>System.Windows.Forms reference. Which brings me to the second point...
>2. You really should separate your business logic from the GUI code.
>3. In general, you should not expect WinForms to work well on anything
>other than windows. If you need a GUI for other platforms, design a new
>one, or use a cross-platform GUI toolkit such as Eto.Forms. If you don't
>need a GUI... Then separate the WinForms GUI code from the non-GUI code,
>so you can build your non-windows project independently of WinForms.
>Really, the core logic should be moved to its own assembly, so the
>winforms project and console project can both reference it.
>There is *some* support for WinForms on non-windows platforms. Rarely
>does it ever work well - nobody on a mac or linux wants windows that look
>like WinForms - and that's if it works at all. (Lots of times it's
>straight up nonfunctional). Even if it works perfectly, nobody wants to
>be dependent on launching X11 on a mac, and it's only *sometimes*
>acceptable on linux.
More information about the Mono-list