当前位置:网站首页>Maui's way of learning -- Opening
Maui's way of learning -- Opening
2022-06-24 10:51:00 【Dotnet cross platform】
Maui The way of learning -- The opening
After thinking for a long time, I decided to send one Maui Introduction as the opening , Although this is an old topic , But we can't do without such discussion ( Please allow me an article ).
What is? .NET Maui
.NET Maui It is a Microsoft product based on .Net Multi-platform application UI (.NET MAUI) Cross platform framework for , Use C# and XAML Create native mobile and desktop apps , Use .NET MAUI, Can be developed from a single shared code base in Android、iOS、macOS and Windows Applications running on .
.NET Maui Born out of Xamarin.Forms, If there is Xamarin.Forms Using experience of , that Maui Will become very handy . Use .NET MAUI, You can use a single project to create multi platform applications , But if necessary , You can add platform specific source code and resources ..NET MAUI The main goal of is to achieve as much application logic and... As possible in a single code base UI Layout .

.NET Maui Supported platforms
Android 5.0Or later (API 21)iOS 10Or later (UIKit)macOS 10.13Or later (Mac CatalystUIKit)Windows 11andWindows 10(1809) Or later (WinUI3WindowsAppSdk)Tizen, Supported by Samsung ( It has been integrated into the project template )Linux, Supported by the community
.NET Maui How it works
.NET MAUI take Android、iOS、macOS and Windows API Unified into a single API in , The API Allow any developer experience to be written and run at once , It also provides in-depth access to all aspects of each native platform .
.NET 6 Provides a series of platform specific frameworks to create applications :.NET for Android、.NET for iOS、.NET for macOS as well as Windows UI 3 (WinUI 3) library . These frameworks all have access to the same .NET 6 Base class library (BCL) . This library abstracts the details of the underlying platform from the code .BCL Depend on .NET Runtime , Provide execution environment for code .
about Android、iOS and macOS, The environment consists of Mono Realization , This is a .NET Runtime implementation . stay Windows,Win32 Provide an execution environment .
although BCL Enable applications running on different platforms to share common business logic , But various platforms have different ways of defining user interfaces for applications , And they provide different models , Used to specify how user interface elements communicate and interoperate . Can be used for Android、iOS、macOS、WinUI 3 Of .Net Create separate for each platform UI, But this approach requires maintaining a code base for each individual equipment family ..NET MAUI Provides a framework , For building... For mobile and desktop applications UI.
The image below shows .NET MAUI Advanced view of Applied Architecture :

stay .NET MAUI Application , The compilation is mainly related to .NET MAUI API Interactive code ,NET MAUI Use the native platform directly API. In addition, the application code can directly use the platform as required API.
.NET MAUI Applications can be found in Window PC or Mac Write on ( At present, we need to use vs2022 preview), And compile it into a native application package :
AndroidUse.NET MAUICompiled application fromC#Compile to intermediate language (IL), And then when the app starts (JIT) Compile to native assembly .iOSUse.NET MAUIThe compiled application is completely native compiled ( fromC#Compile as nativeARMAssembly codeAOT) .macOSUse.NET MAUICompiled applications useMac Catalyst, This is aAppleA solution provided , It will useUIKitGeneratediOSThe application is introduced into the desktop , And use other... As neededAppKitAnd the platformAPIExpand it .WindowsUse.NET MAUIThe generated application usesWindows UI 3(WinUI 3) Library to createWindowsDesktop native applications .
.NET Maui Other applications of
although .NET Maui Encapsulation of controls native to each platform has been provided , But you can still use Maui The provided self drawing engine draws controls that meet your own needs (
Microsoft.Maui.Graphics)You can also create
.NET MAUI Blazorapplication , To achieve the same experience as the web page ,.NET MAUI BlazorApplications also need to be updated for platform specificWebViewControl , The current support platforms are as follows :Android 7.0(API 24) Or later (Chrome)iOS 14Or later (Safari)Mac Catalyst macOS 11Or later (Safari)indows 11、Windows 10(1809) Or later (Edge webview2)Tizen( Unknown )Linux( Unknown )
.NET Maui Develop the technical knowledge that needs to be learned :
Basics :
.NETC#XamlMaui
Expand :
Winui3 apias well asWindowsplatformApi(Windows)Android api(Android)( Usually you don't need , If you need to call some hardware )UIKit,iOSplatformapi(iOS)( Usually you don't need , If you need to call some hardware )UIKit,Appkit,MacOS api(Mac)Blazor( It's not necessary )
.NET Maui Advantages and disadvantages
advantage :
Use
C#+.NetDevelopment , Easy to get started , It's easy to upgrade , Cooperate with the universe first IDE Work efficiency is not the sameMicrosoft's technologies basically have something in common ( You can easily switch to
WPF)Big factory guarantee
Use platform controls on different platforms , Ensure native performance
coordination
BlazorIt can realize the consistent experience with the web side
shortcoming :
I won't support it
win7, Even pickwin10Version ofAlthough officially released, it is still not stable
the reason being that
C#So maybe not as good asjavaIt is so easy to find a satisfying job in the system or front-end ( Big factories are generallyjava)Microsoft likes hacking
Although guaranteed to be native , But that means you need to adapt to different platforms ( Non self drawing )
Although guaranteed to be native , This also means that you need to learn about the platform ( Controls also behave differently )( Of course, this is what all cross platform applications need to learn )
Similar cross platform development framework :
QT( UseC++, Personally, I think it is cross platform in the real sense , It even supports embedded systems )( owner-draw )Flutter( Google's cross platform framework , UseDartLanguage )( owner-draw )Uno platform(C#The implementation is similar toMaui)Avalonia(C#classWPF)( owner-draw )CPF(C#Domestic cross platformUIDevelopment framework , Support Loongson )( owner-draw )Electron( Web technology stack direction )
Related learning Links :
Maui:.NET Multi-platform application UI file - .NET MAUI | Microsoft Docs [1]C# Platform call: Platform call (P/Invoke) | Microsoft Docs[2]Windows Api: pinvoke.net: memcpy (msvcrt)[3]WinUI3: Create the first one WinUI 3(Windows application SDK) project - Windows apps | Microsoft Docs[4]UIKIT:UIKit Namespace | Microsoft Docs [5]AppKit: AppKit Namespace | Microsoft Docs[6]Community ToolKit: Use .NET Multi-platform application UI (.NET MAUI) Community Toolkit introduction - .NET Community Toolkit | Microsoft Docs [7]
Reference material
[1]
.NET Multi-platform application UI file - .NET MAUI | Microsoft Docs : https://docs.microsoft.com/zh-cn/dotnet/maui/
[2]Platform call (P/Invoke) | Microsoft Docs: https://docs.microsoft.com/zh-cn/dotnet/standard/native-interop/pinvoke
[3]pinvoke.net: memcpy (msvcrt): https://www.pinvoke.net/default.aspx/msvcrt/memcpy.html
[4]Create the first one WinUI 3(Windows application SDK) project - Windows apps | Microsoft Docs: https://docs.microsoft.com/zh-cn/windows/apps/winui/winui3/create-your-first-winui3-app
[5]UIKit Namespace | Microsoft Docs : https://docs.microsoft.com/zh-cn/dotnet/api/uikit?view=xamarin-ios-sdk-12
[6]AppKit Namespace | Microsoft Docs: https://docs.microsoft.com/zh-cn/dotnet/api/appkit?view=xamarin-mac-sdk-14
[7]Use .NET Multi-platform application UI (.NET MAUI) Community Toolkit introduction - .NET Community Toolkit | Microsoft Docs : https://docs.microsoft.com/zh-cn/dotnet/communitytoolkit/maui/get-started
边栏推荐
- Act as you like
- Outils de capture de paquets
- 機械臂速成小指南(二):機械臂的應用
- What characteristics should a good design website have?
- Charles packet capturing tool tutorial
- 今日睡眠质量记录76分
- Functions of document management what functions does the document management software have
- 机械臂速成小指南(三):机械臂的机械结构
- Four methods of object merging and four methods of object merging in JS
- JMeter interface test tool foundation - sampler (II)
猜你喜欢

线程运行原理

Flink cluster construction and enterprise level yarn cluster construction

A group of skeletons flying canvas animation JS special effect

23. opencv - image mosaic project

Practice sharing of packet capturing tool Charles

Flink集群搭建以及企业级yarn集群搭建

88.合并有序数组

【本周六活动】.NET Day in China

进程与多线程

Outils de capture de paquets
随机推荐
【JS逆向分享】某个网站社区信息
栈题目:括号的分数
How to convert an array to an object, and how to convert an object to an array
今日睡眠质量记录76分
什么是递归?
splice()方法的使用介绍
23. opencv - image mosaic project
Svg+js drag slider round progress bar
Cool interactive animation JS special effects implemented by p5.js
[IEEE publication] International Conference on natural language processing and information retrieval in 2022 (ecnlpir 2022)
26.删除有序数组的重复项
Pycharm shortcut keys
线程运行原理
Quick completion guide for mechanical arm (II): application of mechanical arm
Leetcode-1823: find the winner of the game
2022年智能机器人与系统国际研讨会(ISoIRS 2022)
Canvas falling ball gravity JS special effect animation
Cross domain overview, simple accumulation
Caching mechanism for wrapper types
283. move zero