Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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# ?

like image 736
R2D4 Avatar asked Feb 08 '15 02:02

R2D4


People also ask

What is porting in C?

Portability refers to how easily- if at all- code can move from one system architecture to another. We know that Linux is a portable because it has already been ported to various implementations. To view which implementations Linux has ported to, type in the following command. vim /usr/src/kernels/2.6.43.8-1. fc15.

What is the function of port C?

Port C is an 8-bit bi-directional I/O port with individually selectable internal pull-up resistors. The PORT C output buffers can sink 20mA and thus drive LED displays directly. Configuring Port C for input or output. Port C has the alternate functions as shown below.

What is Port C in a microcontroller?

PORTC is composed of pin labelled RC0 to RC7. PORTD is composed of pins labelled RD0 to RD7. PORTE is composed of pins labelled RE0 to RE3. When running a program on a microcontroller that uses inputs and outputs, the port(s) being used must be set in code.

How will you configure port as input and output?

8051 microcontrollers have 4 I/O ports each of 8-bit, which can be configured as input or output. Hence, total 32 input/output pins allow the microcontroller to be connected with the peripheral devices. Pin configuration, i.e. the pin can be configured as 1 for input and 0 for output as per the logic state.


1 Answers

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.

like image 68
jariq Avatar answered Oct 21 '22 05:10

jariq