Monodevelop use of Winforms - winforms

I was looking around the MonoDevelop projects and noticed a reference to the Windows.Forms namespace. I belive it was using the Openfile dialog. (I should say I was on a Windows machine.) I was wondering how this works when MD is run on a Mac or Linux box?
Is the project/module that reference the Windows.Forms namespace only load on Windows desktops? Does Mono support the Winforms namespace? It would seem to me that Winforms eventually resovles to native API calls which wouldn't work on other OSs.
The reason I'm asking is because I want to develop a cross-platform application and I was looking at MonoDevelop to see how it handles things. I know Gtk is the clear choice, so I was surprised to see the Windows.forms reference.

http://www.mono-project.com/WinForms
And from their FAQ (http://www.mono-project.com/FAQ:_Winforms):
What are you using to implement Windows.Forms?
Windows.Forms is implemented fully in C# managed code and uses System.Drawing to perform most of its tasks.
For more details see the Winforms Roadmap
A small driver is required for each operating system supported. Currently we have drivers for:
X Window System
Win32 Window System
Mac OSX Window System

Related

Is there any way to port a WPF application so it can run on mac-OS X?

I have a GUI which I created using WPF I not want to port this so it's available for use on mac OS X.
I heard mono can be used but it looks like they don't have any support for WPF's as of right now so any suggestions would be great Thanks.
.NET Core 3.0 has WPF but it works only for Windows platform, so there is no build-in support for multi-platform desktop GUI.
You could try port WPF application using Avalonia, but I never tried it. Avalonia works with .NET Core 2.0, .NET Standard 2.0.

Do any of the Windows system applications use WPF?

Context: I am looking for examples of popular applications that use WPF for their UI.
With Windows 8 and Windows 10, certain parts of the OS got a new 'look-and-feel', for example:
The system settings dialog
The taskbar and the start menu
The calculator app
The task manager
Do those or any other Windows system applications use WPF for their UI?
This question already provides a list of existing applications that use WPF: What real world WPF applications are out there?. However, I would like to know if there are any builtin Windows system applications that use WPF.
None of those applications use WPF. Instead they use UWP, which was inspired by WPF, but is quite a different framework underneath.
There are WPF applications in many default Windows installations, though. For example, the PowerShell ISE is one.
You could try Snooping them to find out - It's not been updated for several years but I tried it on a splinter new 4.6 app I'm developing and it's detecting it and works fine. Whatever it can detect is certainly a WPF app - the inverse is not true however.
That being said it did not detect calculator or task manager for me.

How to port C# applications from windows for linux?

Windows.Forms library contain many bugs which effectively prevent applications from working. WinForms Designer is unable to put WebBrowser control on form. NotifyIcon class doesn't work under LXDE (see the bugtracker of KeePass). Clipboard class is incompatible with default manager of Calculate Linux. Drag and Drop have problems in DockPanelSuite. WinForms Designer is not finished because of opacity problems. WPF was never implemented and no plans to do it.
And mono team says "we don't want to develop WinForms, because this is old technology."
How should one port desktop C# application from Windows to Linux? Rewriting it with Gtk# seems to be too hard...
What is easier - to fix mono WinForms, to implement WPF, or to rewrite all applications in the world to Gtk# ?
As you have already found out Mono WinForms implementation is suitable only for very simple applications. Take a look at "Cross-Platform Desktop UIs" blog post from Xamarin employee Mike James who summarizes available solutions:
Traditional approach
WPF or WinForms frontend on Windows, GTK# frontend on Linux and Xamarin.Mac on Mac OS X. IMO this is the best way to go and it may be easier than it looks if you have correctly separated business and presentation layers in your app.
XWT
XWT toolkit uses the same API and provides native look on all platforms but only a limited subset of components is implemented. Its usability for your projects depends on what components you really need.
HTML frontend
Create HTML frontend using simple WebView component or Awesomium HTML UI Engine. This may be a viable option in some cases but I am not sure whether it is possible to implement systray icons with this approach.
QTSHARP
Open source project which aims to implement .NET bindings for multiplatform QT toolkit. I have never tried it but according to project website it seems to be in early stage and currently tested only on Windows.
BTW I am currently using WinForms for Pkcs11Admin application but I plan to use traditional approach as soon as I hit a blocker bug on any of the supported platforms.

Desktop application for PC or MAC

I've had a quick look on the interweb and can't seem to easily find the answer to my question which is, what do I need to do differently to make a desktop application, WPF, function on both PC and MAC environments? I suppose I could buy a mac and try to run an app I've written but seems a bit expensive?
There are comments that WPF on mac is a no-go. I could convert to Silverlight with some effort but my question now is what would you develop a desktop app in for both PC and MAC, my guess is poor old WinForms? If so would the pitfalls simply be directory structure / accessing logged in user from WIN32 API commands, et cetera?
You can't run WPF on a mac.
The best you can get is Silverlight and its suitability depends on your needs.
Do you need OS level access?
As Scartag says, WPF is not compatible with OS X. However you might to consider Mono, which allows you to write cross-platform applications in C#. There are several GUI toolkits to choose from, but none are implementations of WPF. Further info on Mono/WPF can be found here.

What is the difference between GTK and Win32 Native API in C?

I'm a beginner in C programming. I read about some tutorials and forums about creating GUI application in C. I encountered some terms like GTK, Win32 native API. They say that GTK is one of the library to use in creating GUI application. I also tried the code that create a simple window using Win32 API. What are the difference between them?
Thanks.
GTK is multi-platform tool kit for creating graphical user interfaces(GUI).
In short they provide a framework which you can use as an library for developing your UI applications.
Win32 API is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. These are restricted only for windows platform.
The language rules for c/c++ are governed by ISO standards which define what functionality every standard c/c++ implementation has to provide.Note that both of above provide some functionality that is over and above what the standard libraries provide.Basically, they provide you boiler plate framework for easy usage instead of reinventing wheels for your project.
Win32 is the "native" API for Microsoft Windows. You can only run it on Microsoft Windows.
GTK+ is also a GUI library. You can run it on multiple different platforms.
Qt and SDL are other multi-platform libraries. Like GTK+, the same GUI can be recompiled to run on multiple different platforms: Windows, Linux, MacOS, etc etc.
Gtk+ = cross-platform and very powerfull. more simple than win32. more tools you will have.
win32 = just in windows. standard windows GUI framework.
and DUDE! Gtk+ in windows is a pain in the ass. but for any othe supported platforms I reccomend Gtk+ for a widget toolkit.

Resources