From 0e85af6990ac41b8925722d4aee990909421a729 Mon Sep 17 00:00:00 2001 From: Scott McKay Date: Fri, 29 Jul 2022 07:22:36 +1000 Subject: [PATCH] Add MAUI csharp\sample\InferenceSample\ project (#12356) Add csharp\sample\InferenceSample\Microsoft.ML.OnnxRuntime.InferenceSample.Maui so we have an equivalent setup for MAUI as for the other platforms. This provides a setup to do some basic local testing of using an InferenceSession in a MAUI app. --- .../App.xaml | 14 + .../App.xaml.cs | 11 + .../AppShell.xaml | 14 + .../AppShell.xaml.cs | 9 + .../MainPage.xaml | 15 + .../MainPage.xaml.cs | 84 ++++ .../MauiProgram.cs | 18 + ...ML.OnnxRuntime.InferenceSample.Maui.csproj | 75 ++++ ...ft.ML.OnnxRuntime.InferenceSample.Maui.sln | 27 ++ .../Platforms/Android/AndroidManifest.xml | 6 + .../Platforms/Android/MainActivity.cs | 10 + .../Platforms/Android/MainApplication.cs | 15 + .../Android/Resources/values/colors.xml | 6 + .../Platforms/MacCatalyst/AppDelegate.cs | 9 + .../Platforms/MacCatalyst/Info.plist | 30 ++ .../Platforms/MacCatalyst/Program.cs | 15 + .../Platforms/Windows/App.xaml | 8 + .../Platforms/Windows/App.xaml.cs | 24 ++ .../Platforms/Windows/Package.appxmanifest | 43 ++ .../Platforms/Windows/app.manifest | 15 + .../Platforms/iOS/AppDelegate.cs | 9 + .../Platforms/iOS/Info.plist | 32 ++ .../Platforms/iOS/Program.cs | 15 + .../Properties/launchSettings.json | 8 + .../ReadMe.md | 17 + .../Resources/AppIcon/appicon.svg | 4 + .../Resources/AppIcon/appiconfg.svg | 8 + .../Resources/Fonts/OpenSans-Regular.ttf | Bin 0 -> 107140 bytes .../Resources/Fonts/OpenSans-Semibold.ttf | Bin 0 -> 111028 bytes .../Resources/Raw/AboutAssets.txt | 15 + .../Resources/Splash/splash.svg | 8 + .../Resources/Styles/Colors.xaml | 44 ++ .../Resources/Styles/Styles.xaml | 384 ++++++++++++++++++ 33 files changed, 992 insertions(+) create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/App.xaml create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/App.xaml.cs create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/AppShell.xaml create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/AppShell.xaml.cs create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/MainPage.xaml create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/MainPage.xaml.cs create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/MauiProgram.cs create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Microsoft.ML.OnnxRuntime.InferenceSample.Maui.csproj create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Microsoft.ML.OnnxRuntime.InferenceSample.Maui.sln create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/Android/AndroidManifest.xml create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/Android/MainActivity.cs create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/Android/MainApplication.cs create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/Android/Resources/values/colors.xml create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/MacCatalyst/AppDelegate.cs create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/MacCatalyst/Info.plist create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/MacCatalyst/Program.cs create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/Windows/App.xaml create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/Windows/App.xaml.cs create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/Windows/Package.appxmanifest create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/Windows/app.manifest create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/iOS/AppDelegate.cs create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/iOS/Info.plist create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Platforms/iOS/Program.cs create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Properties/launchSettings.json create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/ReadMe.md create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Resources/AppIcon/appicon.svg create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Resources/AppIcon/appiconfg.svg create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Resources/Fonts/OpenSans-Regular.ttf create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Resources/Fonts/OpenSans-Semibold.ttf create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Resources/Raw/AboutAssets.txt create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Resources/Splash/splash.svg create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Resources/Styles/Colors.xaml create mode 100644 csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/Resources/Styles/Styles.xaml diff --git a/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/App.xaml b/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/App.xaml new file mode 100644 index 0000000000..4c3710ea40 --- /dev/null +++ b/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/App.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/App.xaml.cs b/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/App.xaml.cs new file mode 100644 index 0000000000..513e4717de --- /dev/null +++ b/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/App.xaml.cs @@ -0,0 +1,11 @@ +namespace Microsoft.ML.OnnxRuntime.InferenceSample.Maui; + +public partial class App : Application +{ + public App() + { + InitializeComponent(); + + MainPage = new AppShell(); + } +} diff --git a/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/AppShell.xaml b/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/AppShell.xaml new file mode 100644 index 0000000000..277222966a --- /dev/null +++ b/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/AppShell.xaml @@ -0,0 +1,14 @@ + + + + + + diff --git a/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/AppShell.xaml.cs b/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/AppShell.xaml.cs new file mode 100644 index 0000000000..9e004e3f82 --- /dev/null +++ b/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/AppShell.xaml.cs @@ -0,0 +1,9 @@ +namespace Microsoft.ML.OnnxRuntime.InferenceSample.Maui; + +public partial class AppShell : Shell +{ + public AppShell() + { + InitializeComponent(); + } +} diff --git a/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/MainPage.xaml b/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/MainPage.xaml new file mode 100644 index 0000000000..84fb808754 --- /dev/null +++ b/csharp/sample/InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.Maui/MainPage.xaml @@ -0,0 +1,15 @@ + + + + + +