Skip to content

Commit

Permalink
Add MAUI
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed May 28, 2022
1 parent 9a83489 commit 15ad1a5
Show file tree
Hide file tree
Showing 35 changed files with 1,095 additions and 19 deletions.
46 changes: 45 additions & 1 deletion SteamToolsV2+.sln
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FDELauncher", "src\FDELaunc
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Net.Http.Headers", "src\Microsoft.Net.Http.Headers\Microsoft.Net.Http.Headers.csproj", "{C7F109B9-EA88-4B7E-ADB5-D6407686ADE0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ST.Client.Maui.App", "src\ST.Client.Maui.App\ST.Client.Maui.App.csproj", "{73A9AB65-AF95-4F27-98E2-B3296F9BC198}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -2192,6 +2194,48 @@ Global
{C7F109B9-EA88-4B7E-ADB5-D6407686ADE0}.Release|x64.Build.0 = Release|Any CPU
{C7F109B9-EA88-4B7E-ADB5-D6407686ADE0}.Release|x86.ActiveCfg = Release|Any CPU
{C7F109B9-EA88-4B7E-ADB5-D6407686ADE0}.Release|x86.Build.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|ARM.ActiveCfg = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|ARM.Build.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|ARM.Deploy.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|ARM64.Build.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|ARM64.Deploy.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|iPhone.Build.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|iPhone.Deploy.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|x64.ActiveCfg = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|x64.Build.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|x64.Deploy.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|x86.ActiveCfg = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|x86.Build.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Debug|x86.Deploy.0 = Debug|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|Any CPU.Build.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|Any CPU.Deploy.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|ARM.ActiveCfg = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|ARM.Build.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|ARM.Deploy.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|ARM64.ActiveCfg = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|ARM64.Build.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|ARM64.Deploy.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|iPhone.ActiveCfg = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|iPhone.Build.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|iPhone.Deploy.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|x64.ActiveCfg = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|x64.Build.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|x64.Deploy.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|x86.ActiveCfg = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|x86.Build.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|x86.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -2269,7 +2313,7 @@ Global
{C7F109B9-EA88-4B7E-ADB5-D6407686ADE0} = {673FF8CD-9E85-4FA1-ABFC-D1149675E138}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9313F2B4-10DA-43AA-A481-CAA7571C740C}
RESX_NeutralResourcesLanguage = zh-Hans
SolutionGuid = {9313F2B4-10DA-43AA-A481-CAA7571C740C}
EndGlobalSection
EndGlobal
50 changes: 32 additions & 18 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,50 @@
- Lib **类库**
- ST **业务通用类库**
- ST.Client **客户端通用类库**
- ST.Client.Desktop **桌面客户端通用类库**
- ST.Client.Desktop.Avalonia **使用 Avalonia 实现的 View 层**
- ~~ST.Client.Desktop.WPF **使用 WPF 实现的 View 层**~~
- ~~ST.Client.Desktop.WinUI **使用 WinUI 实现的 View 层**~~
- ST.Client.Desktop.Windows **用于 Windows 的实现**
- ST.Client.Desktop.Mac **用于 macOS 的实现**
- ST.Client.Desktop.Linux **用于 GNU/Linux 的实现**
- ST.Client.Mobile **移动客户端通用类库**
- ST.Client.Mobile.Droid **用于 Android 的实现**
- ST.Client.Mobile.iOS **用于 iOS 的实现**
- ST.Services.CloudService **客户端调用服务端 API 定义**
- Bindings **平台原生绑定库**
- Platforms
- ST.Client.Windows **用于 Windows 的实现**
- ST.Client.Mac **用于 macOS 的实现**
- ST.Client.Linux **用于 GNU/Linux 的实现**
- ST.Client.Android **用于 Android 的实现**
- ST.Client.iOS **用于 iOS 的实现**
- ResSecrets **使用资源存储的密钥**
- UI Framework
- ST.Client.Avalonia **使用 Avalonia 实现的 View 层**
- Avalonia.Ref **通过友元程序集调用内部函数或空程序集实现手动裁剪**
- ~~ST.Client.WPF~~ **使用 Avalonia 实现的 WPF 层**
- ~~ST.Client.WinUI~~ **使用 Avalonia 实现的 WinUI 层**
- ST.Client.XamarinForms **使用 Xamarin.Forms/MAUI 实现的 View 层**
- Web API
- ST.Services.CloudService **客户端调用服务端 API 定义**
- ST.Services.CloudService.Models **服务端 API 数据传输对象(DTO)定义**
- ST.Services.CloudService.ViewModels **客户端视图模型**
- Tool **工具**
- ST.Tools.AndroidResourceLink **将 Android Studio Project 中的 res 资源 Link 到 csproj 中(生成 XML)**
- ST.Tools.AreaImport **从高德城市编码表 Excel 文件中导入地区数据**
- ST.Tools.MinifyStaticSites **用于将静态 html 删除空行缩小体积的命令行工具**
- ~~ST.Tools.DesktopBridgeLink~~ **Link DesktopBridge 打包中的内容,例如 CEF**
- ~~ST.Tools.MinifyStaticSites~~ **用于将静态 html 删除空行缩小体积的命令行工具**
- ST.Tools.OpenSourceLibraryList **开源许可协议清单生成工具**
- 需要 [GitHub API Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
- ST.Tools.Packager **带进度的压缩与解压演示**
- ST.Tools.Packager.InstallerSetup **安装程序**
- ~~ST.Tools.Packager.InstallerSetup~~ **安装程序**
- ST.Tools.Publish **用于发布的控制台工具**
- ST.Tools.Translate **Resx自动翻译工具**
- 需要 [Azure Translation Key](https://azure.microsoft.com/zh-cn/services/cognitive-services/translator)
- ST.Tools.Win7Troubleshoot **适用于 Windwos 7 OS 的 疑难解答助手**
- ~~ST.Tools.Win7Troubleshoot~~ **适用于 Windwos 7 OS 的 疑难解答助手**
- 目标框架使用 .NET Framework 3.5 并通过 App.config 配置允许在 4.X 中运行 实现在 Windows 上兼容所有的运行库环境
- Launch **启动项**
- FDELauncher FDE(框架依赖) 启动器,判断运行时是否安装与提示,使用 .NET Framework 3.5

- ST.Client.Android.App **Android 客户端(Xamarin.Android)**
- ST.Client.Android.App.Modern **Android 客户端(.Net6+ Android)**

- ST.Client.Desktop.Avalonia.App **桌面客户端**
- ST.Client.Desktop.Avalonia.App.Bridge* **[Desktop Bridge](https://docs.microsoft.com/zh-cn/windows/msix/desktop/desktop-to-uwp-packaging-dot-net)**
- ST.Client.Desktop.Avalonia.Demo.App **桌面客户端(UI演示)**
- ST.Client.Mobile.Droid.App **Android 客户端**
- ST.Client.Mobile.iOS.App **iOS 客户端**
- 5_DesktopBridge\ST.Client.Avalonia.App.Bridge.Package **[Desktop Bridge](https://docs.microsoft.com/zh-cn/windows/msix/desktop/desktop-to-uwp-packaging-dot-net)**
- ST.Client.Avalonia.App.MsixPackage **桌面客户端单项目 MSIX 打包**
- ~~ST.Client.Desktop.Avalonia.Demo.App~~ **桌面客户端(UI演示)**

- ST.Client.Maui.App **MAUI 客户端**

## 🗂️ 命名空间/文件夹
- ~~中划线~~ 表示此文件夹下的命名空间使用上一级的值
Expand Down
14 changes: 14 additions & 0 deletions src/ST.Client.Maui.App/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ST.Client.Maui.App"
x:Class="ST.Client.Maui.App.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
12 changes: 12 additions & 0 deletions src/ST.Client.Maui.App/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace ST.Client.Maui.App
{
public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new AppShell();
}
}
}
14 changes: 14 additions & 0 deletions src/ST.Client.Maui.App/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="ST.Client.Maui.App.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ST.Client.Maui.App"
Shell.FlyoutBehavior="Disabled">

<ShellContent
Title="Home"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />

</Shell>
10 changes: 10 additions & 0 deletions src/ST.Client.Maui.App/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace ST.Client.Maui.App
{
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
}
}
}
41 changes: 41 additions & 0 deletions src/ST.Client.Maui.App/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ST.Client.Maui.App.MainPage">

<ScrollView>
<VerticalStackLayout
Spacing="25"
Padding="30,0"
VerticalOptions="Center">

<Image
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
HeightRequest="200"
HorizontalOptions="Center" />

<Label
Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />

<Label
Text="Welcome to .NET Multi-platform App UI"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
FontSize="18"
HorizontalOptions="Center" />

<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Center" />

</VerticalStackLayout>
</ScrollView>

</ContentPage>
24 changes: 24 additions & 0 deletions src/ST.Client.Maui.App/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace ST.Client.Maui.App
{
public partial class MainPage : ContentPage
{
int count = 0;

public MainPage()
{
InitializeComponent();
}

private void OnCounterClicked(object sender, EventArgs e)
{
count++;

if (count == 1)
CounterBtn.Text = $"Clicked {count} time";
else
CounterBtn.Text = $"Clicked {count} times";

SemanticScreenReader.Announce(CounterBtn.Text);
}
}
}
19 changes: 19 additions & 0 deletions src/ST.Client.Maui.App/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace ST.Client.Maui.App
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});

return builder.Build();
}
}
}
6 changes: 6 additions & 0 deletions src/ST.Client.Maui.App/Platforms/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
11 changes: 11 additions & 0 deletions src/ST.Client.Maui.App/Platforms/Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Android.App;
using Android.Content.PM;
using Android.OS;

namespace ST.Client.Maui.App
{
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
}
}
16 changes: 16 additions & 0 deletions src/ST.Client.Maui.App/Platforms/Android/MainApplication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Android.App;
using Android.Runtime;

namespace ST.Client.Maui.App
{
[Application]
public class MainApplication : MauiApplication
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}

protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
</resources>
10 changes: 10 additions & 0 deletions src/ST.Client.Maui.App/Platforms/MacCatalyst/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Foundation;

namespace ST.Client.Maui.App
{
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
30 changes: 30 additions & 0 deletions src/ST.Client.Maui.App/Platforms/MacCatalyst/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
</dict>
</plist>
16 changes: 16 additions & 0 deletions src/ST.Client.Maui.App/Platforms/MacCatalyst/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using ObjCRuntime;
using UIKit;

namespace ST.Client.Maui.App
{
public class Program
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
}
Loading

0 comments on commit 15ad1a5

Please sign in to comment.