. NET Cross-platform interface framework and why you first have to think twice

Source: Internet
Author: User
Tags gtk

??? Original address

Now developed in C #? Cross-platform applications already have a very mature solution, that is, sharing non-interface code, each operating system with specific user interface code. The benefit of this scenario is that the operating system's native controls and third-party controls can be used directly, and can be deeply integrated with the operating system.

The deep integration here is mainly about some of the Windows proprietary system features:

    • Windows Tray
    • Windows Jump List
    • Windows System Topics

Also includes features of some mobile platforms, such as native swipe of IOS.

? Because native controls are generally used by other programs on the operating system, they are well aligned only if your program uses the same technology. This is a general adherence to the interface development conventions. Apple has detailed interface design guidelines for developers to refer to.

game programs are generally full screen, and do not need to abide by this Convention. Other programs, such as RealPlayer and QQ, also violate this agreement. As a personal point of view, try not to specialize.

So if you decide to use this scheme, you need to learn different interface frameworks on different operating systems:

    • Windows:windows Forms *
    • MACOS:XAMARIN.MAC (Package Cocoa) * *
    • linux:gtk# (Package GTK +) * * *
    • IOS:Xamarin.iOS (Package Cocoatouch)
    • Android:Xamarin.Android (packaged Android UI)

It is worth noting that:

* The Windows platform is undergoing a change in the overall interface design, and the future standard interface framework should be the UWP. Although WPF is also the official Microsoft support technology, but compared with WinForms, it is still drawing itself, not the native interface framework.

* * * MonoMac for various reasons have been discarded see.

Qtsharp and other frameworks are not very mature.

Many successful projects on the market are the beneficiaries of this programme. Here are a few examples:

    • The National Instrument of LabView official website uses the Xamarin.ios mobile address on the IOS platform, using Windows Forms on the Windows platform (this is not specifically determined).
    • Plastic SCM official website uses gtk# on the Linux platform, uses Xamarin.mac on MacOS, and uses Windows Forms on Windows.
    • Icircuit official website in MacOS uses Xamarin.mac, using Xamarin.ios on IOS, using xamarin.android on Android, using Microsoft technology on Windows and Windows Phone.

But there are always programmers who want to be able to use cross-platform interface frameworks to simplify their work. So this article also introduces some existing cross-platform interface frameworks for reference. Although they are different, they generally use one of the following three design ideas:

    • Controls are drawn entirely on their own, simulating the effects of system controls on different operating systems.
    • On one operating system is the native framework, which is displayed on other operating systems through simulation.
    • Design-time abstraction, which is mapped to native controls at run time.

Unity/monogame

Design idea: Draw completely yourself (but there is no standard control concept)

Operating system: Desktop and mobile devices (also including game consoles, etc.)

Show effect: It doesn't matter with the operating system

Three-party controls: not to mention

These are both game engines. It is feasible to use them to design cross-platform applications, but because there are no operating system controls and things like that, it is entirely up to you to draw them, so it is difficult to develop non-gaming applications. As for deep integration with the operating system, it is more cumbersome.

gtk#

Design idea: It is a native framework on Linux and can be emulated on other operating systems.

Operating system: Desktop

Display effect: deep integration on Linux

Three-party controls: There are some, but not very active providers

GTK was originally a cross-platform interface framework for desktop applications, so it was also very useful after the gtk# package. However, it is poorly displayed on non-Linux operating systems (such as Windows and system themes).

MonoDevelop is an IDE that uses gtk#. When Microsoft/xamarin transformed it into Visual Studio for Mac, many of the interface parts had been replaced with the system's native Xamarin.mac.

? Windows Forms

Design idea: A native framework on Windows that can simulate running on other operating systems.

Operating system: Desktop

Display effect: deep integration on Windows

This is the interface framework that most of the C # programmers learn when they get started, enabling quick integration of various Windows controls. Although the Windows CE mobile platform is also supported, it is largely useless. Mono began migrating it to operating systems such as Linux from version 2.0. Plastic SCM initially also uses Mono Windows Forms to migrate its own Windows clients to other operating systems. But the realization of Mono is imperfect in many details and requires a lot of effort to improve it. Plastic SCM later abandoned the cross-platform Windows Forms this way.

? Windows Forms has a large number of third-party controls on the Windows platform, and these controls do not basically support operating systems such as Linux. Although Microsoft has recently begun to turn System.Drawing into a cross-platform technology, it also makes it possible for official Windows Forms to become a cross-platform interface, but it is not yet known how the non-Windows platform will look or whether the three-party market would follow.

The most important thing is that Windows Forms is designed for the desktop, and it doesn't support mobile platforms very well. As early as the MonoTouch initial development phase, the Mono team had thought about the interface framework related to turning Windows Forms into an IOS platform. In the end, of course, they gave up the idea wisely, instead adopting a native scheme that encapsulates Cocoa Touch.

Wpf/avalonia/uwp

Design idea: Draw completely by yourself.

Operating system: Desktop (UWP supports Windows Mobile, Avalonia has mobile support)

Display effect: deep integration on Windows

Three-party controls: many Windows platforms

Both WPF and the UWP are official Microsoft technologies, and Avalonia's official website attempts to turn similar designs into a cross-platform technology.

Delphi has a very much like WPF interface Framework Firemonkey, which is fully cross-platform (desktop and mobile), so WPF-related technologies are technically feasible to cross-platform, but there are many challenges.

Although Microsoft has thought of many ways to improve the integration of WPF and systems (including multiple sets of topics), it is not always as native as Windows Forms. Of course, starting with Windows 10, Microsoft simply uses the UWP? To develop the system's own program, so that the UWP will eventually become the native framework.

Xamarin.Forms

Design ideas: Native control mappings.

Operating system: Mobile platform (starting to try desktop support)

Display effect: Always in-depth integration with native systems

Three-party controls: fast growing

Xamarin developed this technology, initially for cross-platform mobile applications, but recently it has started to move to desktop scenarios, such as MacOS (WPF and gtk# integration is also in development).

Unlike a completely self-drawing technique, the Xamarin.Forms program uses an abstract control when it is designed. Controls such as buttons, lists, and so on at design time are mapped to controls on the operating system's native buttons, lists, and so on. So from the display effect, this is the best technology.

More importantly, the new version of Xamarin.Forms has supported direct embedding of native controls, as well as native programs embedded in the Xamarin.Forms interface, giving developers more flexibility.

But the technology is limited for the time being, and its controls are still designed for mobile applications. If your goal is to design a standard desktop application, such as Office or Visual Studio, you will encounter difficulties. Fortunately not all the scenes we all need so complex interface.

There are now a number of third parties providing controls for Xamarin.Forms:

    • ComponentOne
    • Telerik
    • Synfusion
    • Infragistics
    • DevExpress

More and more tripartite participation has also made the technology more active.

Xwt/eto.forms

Design ideas: Native control mappings.

Operating system: Desktop (start trying to move support)

Display effect: Always in-depth integration with native systems

Three-party controls: Not much at the moment

Both techniques are similar to xamarin.forms, but they all start from the desktop platform.

XWT Official website is part of the Mono project. Personally, I think it inspired the design of xamarin.forms. Eto.forms official website is relatively new, and began to enter the mobile platform.

It remains to be seen whether the two frames will eventually reach the xamarin.forms heat.

Translate original

. NET Cross-platform interface framework and why you first have to think twice

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.