From 9809ae9ca6fe028da05d1958dec3c73f214f66b0 Mon Sep 17 00:00:00 2001 From: "N.DZL" Date: Fri, 23 Feb 2024 19:38:30 +0100 Subject: [PATCH] WSC Config via SSM, tested on v2.x A11 --- OEMInfo-MAUI-Sample/MainPage.xaml.cs | 32 ----- .../Platforms/Android/AndroidManifest.xml | 11 -- .../Platforms/Android/MainActivity.cs | 78 ----------- README.md | 25 ---- ...nfo-MAUI-Sample.sln => WSC-MAUI-Sample.sln | 14 +- .../App.xaml | 0 .../App.xaml.cs | 0 .../AppShell.xaml | 0 .../AppShell.xaml.cs | 0 .../MainPage.xaml | 9 +- WSC-MAUI-Sample/MainPage.xaml.cs | 69 ++++++++++ .../MauiProgram.cs | 9 +- .../Platforms/Android/AndroidManifest.xml | 19 +++ .../Platforms/Android/MainActivity.cs | 121 ++++++++++++++++++ .../Platforms/Android/MainApplication.cs | 0 .../Android/Resources/values/colors.xml | 0 .../Platforms/MacCatalyst/AppDelegate.cs | 0 .../Platforms/MacCatalyst/Entitlements.plist | 0 .../Platforms/MacCatalyst/Info.plist | 0 .../Platforms/MacCatalyst/Program.cs | 0 .../Platforms/Tizen/Main.cs | 0 .../Platforms/Tizen/tizen-manifest.xml | 0 .../Platforms/Windows/App.xaml | 0 .../Platforms/Windows/App.xaml.cs | 0 .../Platforms/Windows/Package.appxmanifest | 0 .../Platforms/Windows/app.manifest | 0 .../Platforms/iOS/AppDelegate.cs | 0 .../Platforms/iOS/Info.plist | 0 .../Platforms/iOS/Program.cs | 0 .../Properties/launchSettings.json | 0 .../Resources/AppIcon/appicon.svg | 0 .../Resources/AppIcon/appiconfg.svg | 0 .../Resources/Fonts/OpenSans-Regular.ttf | Bin .../Resources/Fonts/OpenSans-Semibold.ttf | Bin .../Resources/Images/dotnet_bot.png | Bin .../Resources/Raw/AboutAssets.txt | 0 .../Resources/Raw/Config_MANAGER.json | 26 ++++ .../Resources/Splash/splash.svg | 0 .../Resources/Styles/Colors.xaml | 0 .../Resources/Styles/Styles.xaml | 0 .../WSC-MAUI-Sample.csproj | 23 +++- 41 files changed, 273 insertions(+), 163 deletions(-) delete mode 100644 OEMInfo-MAUI-Sample/MainPage.xaml.cs delete mode 100644 OEMInfo-MAUI-Sample/Platforms/Android/AndroidManifest.xml delete mode 100644 OEMInfo-MAUI-Sample/Platforms/Android/MainActivity.cs delete mode 100644 README.md rename OEMInfo-MAUI-Sample.sln => WSC-MAUI-Sample.sln (57%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/App.xaml (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/App.xaml.cs (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/AppShell.xaml (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/AppShell.xaml.cs (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/MainPage.xaml (80%) create mode 100644 WSC-MAUI-Sample/MainPage.xaml.cs rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/MauiProgram.cs (83%) create mode 100644 WSC-MAUI-Sample/Platforms/Android/AndroidManifest.xml create mode 100644 WSC-MAUI-Sample/Platforms/Android/MainActivity.cs rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/Android/MainApplication.cs (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/Android/Resources/values/colors.xml (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/MacCatalyst/AppDelegate.cs (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/MacCatalyst/Entitlements.plist (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/MacCatalyst/Info.plist (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/MacCatalyst/Program.cs (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/Tizen/Main.cs (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/Tizen/tizen-manifest.xml (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/Windows/App.xaml (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/Windows/App.xaml.cs (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/Windows/Package.appxmanifest (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/Windows/app.manifest (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/iOS/AppDelegate.cs (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/iOS/Info.plist (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Platforms/iOS/Program.cs (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Properties/launchSettings.json (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Resources/AppIcon/appicon.svg (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Resources/AppIcon/appiconfg.svg (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Resources/Fonts/OpenSans-Regular.ttf (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Resources/Fonts/OpenSans-Semibold.ttf (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Resources/Images/dotnet_bot.png (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Resources/Raw/AboutAssets.txt (100%) create mode 100644 WSC-MAUI-Sample/Resources/Raw/Config_MANAGER.json rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Resources/Splash/splash.svg (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Resources/Styles/Colors.xaml (100%) rename {OEMInfo-MAUI-Sample => WSC-MAUI-Sample}/Resources/Styles/Styles.xaml (100%) rename OEMInfo-MAUI-Sample/OEMInfo-MAUI-Sample.csproj => WSC-MAUI-Sample/WSC-MAUI-Sample.csproj (78%) diff --git a/OEMInfo-MAUI-Sample/MainPage.xaml.cs b/OEMInfo-MAUI-Sample/MainPage.xaml.cs deleted file mode 100644 index c831c70..0000000 --- a/OEMInfo-MAUI-Sample/MainPage.xaml.cs +++ /dev/null @@ -1,32 +0,0 @@ -using CommunityToolkit.Mvvm.Messaging; - -namespace OEMInfo_MAUI_Sample -{ - public partial class MainPage : ContentPage - { - int count = 0; - - public MainPage() - { - InitializeComponent(); - - WeakReferenceMessenger.Default.Register(this, (r, m) => - { - MainThread.BeginInvokeOnMainThread(() => { lbDisplayDeviceId.Text += "\n" + m; }); - }); - } - - 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); - } - } - -} diff --git a/OEMInfo-MAUI-Sample/Platforms/Android/AndroidManifest.xml b/OEMInfo-MAUI-Sample/Platforms/Android/AndroidManifest.xml deleted file mode 100644 index 96a1597..0000000 --- a/OEMInfo-MAUI-Sample/Platforms/Android/AndroidManifest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/OEMInfo-MAUI-Sample/Platforms/Android/MainActivity.cs b/OEMInfo-MAUI-Sample/Platforms/Android/MainActivity.cs deleted file mode 100644 index 1be0d09..0000000 --- a/OEMInfo-MAUI-Sample/Platforms/Android/MainActivity.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Android.App; -using Android.Content.PM; -using Android.Database; -using Android.Nfc; -using Android.OS; -using Android.Util; -using Android.Widget; - -using System; -using System.Data; -using Android.Database; -using Android.Net; -using Android.Util; -using Android.Widget; -using CommunityToolkit.Mvvm.Messaging; - - -namespace OEMInfo_MAUI_Sample -{ - [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] - public class MainActivity : MauiAppCompatActivity - { - private readonly string? TAG= "MainActivity"; - - private readonly string URI_SERIAL = "content://oem_info/oem.zebra.secure/build_serial"; - private readonly string URI_IMEI = "content://oem_info/wan/imei"; - private readonly string URI_BT_MAC = "content://oem_info/oem.zebra.secure/bt_mac"; - private readonly string URI_WIFI_MAC = "content://oem_info/oem.zebra.secure/wifi_mac"; - - protected override void OnPostCreate(Bundle savedInstanceState) - { - - base.OnPostCreate(savedInstanceState); - RetrieveOEMInfo(Android.Net.Uri.Parse(URI_SERIAL)); - } - - - private void RetrieveOEMInfo(Android.Net.Uri? uri) - { - ICursor? cursor = ContentResolver?.Query(uri!, null, null, null, null); - if (cursor == null || cursor.Count < 1) - { - string errorMsg = "Null cursor"; - WeakReferenceMessenger.Default.Send("#1-"+errorMsg); - - return; - } - while (cursor.MoveToNext()) - { - if (cursor.ColumnCount == 0) - { - string errorMsg = "Error: " + uri + " no data"; - - WeakReferenceMessenger.Default.Send("#2-" + errorMsg); - } - else - { - for (int i = 0; i < cursor.ColumnCount; i++) - { - Log.Verbose(TAG, "column " + i + "=" + cursor.GetColumnName(i)); - try - { - string? data = cursor.GetString(cursor.GetColumnIndex(cursor.GetColumnName(i))); - - WeakReferenceMessenger.Default.Send("Serial: " + data); - } - catch (Exception e) - { - Log.Info(TAG, "Exception column " + cursor.GetColumnName(i)); - } - } - } - } - cursor.Close(); - } - - } -} diff --git a/README.md b/README.md deleted file mode 100644 index 79c8e0e..0000000 --- a/README.md +++ /dev/null @@ -1,25 +0,0 @@ -### Please be aware that this application / sample is provided as-is for demonstration purposes without any guarantee of support - -## OEMInfo-MAUI-Sample - -- Refer to https://github.com/ZebraDevs/OEMINFO_WITH_STAGENOW for information about how to grant the needed permissions to this app to access OEMInfo using Stagenow - -- To create a APK: - - Switch to Release - - ![image](https://github.com/NDZL/OEMInfo-MAUI-Sample/assets/11386676/d58acf3a-5ce7-40bc-90cd-4b345528e09e) - - - Choose Deploy from the Build menu - - ![image](https://github.com/NDZL/OEMInfo-MAUI-Sample/assets/11386676/790adbb4-898c-4ee0-a59d-0e59f09d2851) - - - Pick the APK in the "OEMInfo-MAUI-Sample\bin\Release\net8.0-android" folder - - ![image](https://github.com/NDZL/OEMInfo-MAUI-Sample/assets/11386676/62f68370-7cc9-4c4e-a279-81bb9bc469f4) - - -### Screens - -![image](https://github.com/NDZL/OEMInfo-MAUI-Sample/assets/11386676/861d72fd-677c-4493-b662-2650c6a307b0) - - diff --git a/OEMInfo-MAUI-Sample.sln b/WSC-MAUI-Sample.sln similarity index 57% rename from OEMInfo-MAUI-Sample.sln rename to WSC-MAUI-Sample.sln index 758e6d0..7ba6898 100644 --- a/OEMInfo-MAUI-Sample.sln +++ b/WSC-MAUI-Sample.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34525.116 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OEMInfo-MAUI-Sample", "OEMInfo-MAUI-Sample\OEMInfo-MAUI-Sample.csproj", "{766C9153-0A0A-4942-8B9D-04F4251097B2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WSC-MAUI-Sample", "WSC-MAUI-Sample\WSC-MAUI-Sample.csproj", "{197E5EA9-4041-44C6-A1BB-3B4F520CCDDF}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,12 +11,12 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {766C9153-0A0A-4942-8B9D-04F4251097B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {766C9153-0A0A-4942-8B9D-04F4251097B2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {766C9153-0A0A-4942-8B9D-04F4251097B2}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {766C9153-0A0A-4942-8B9D-04F4251097B2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {766C9153-0A0A-4942-8B9D-04F4251097B2}.Release|Any CPU.Build.0 = Release|Any CPU - {766C9153-0A0A-4942-8B9D-04F4251097B2}.Release|Any CPU.Deploy.0 = Release|Any CPU + {197E5EA9-4041-44C6-A1BB-3B4F520CCDDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {197E5EA9-4041-44C6-A1BB-3B4F520CCDDF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {197E5EA9-4041-44C6-A1BB-3B4F520CCDDF}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {197E5EA9-4041-44C6-A1BB-3B4F520CCDDF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {197E5EA9-4041-44C6-A1BB-3B4F520CCDDF}.Release|Any CPU.Build.0 = Release|Any CPU + {197E5EA9-4041-44C6-A1BB-3B4F520CCDDF}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/OEMInfo-MAUI-Sample/App.xaml b/WSC-MAUI-Sample/App.xaml similarity index 100% rename from OEMInfo-MAUI-Sample/App.xaml rename to WSC-MAUI-Sample/App.xaml diff --git a/OEMInfo-MAUI-Sample/App.xaml.cs b/WSC-MAUI-Sample/App.xaml.cs similarity index 100% rename from OEMInfo-MAUI-Sample/App.xaml.cs rename to WSC-MAUI-Sample/App.xaml.cs diff --git a/OEMInfo-MAUI-Sample/AppShell.xaml b/WSC-MAUI-Sample/AppShell.xaml similarity index 100% rename from OEMInfo-MAUI-Sample/AppShell.xaml rename to WSC-MAUI-Sample/AppShell.xaml diff --git a/OEMInfo-MAUI-Sample/AppShell.xaml.cs b/WSC-MAUI-Sample/AppShell.xaml.cs similarity index 100% rename from OEMInfo-MAUI-Sample/AppShell.xaml.cs rename to WSC-MAUI-Sample/AppShell.xaml.cs diff --git a/OEMInfo-MAUI-Sample/MainPage.xaml b/WSC-MAUI-Sample/MainPage.xaml similarity index 80% rename from OEMInfo-MAUI-Sample/MainPage.xaml rename to WSC-MAUI-Sample/MainPage.xaml index 6a08421..6d01d43 100644 --- a/OEMInfo-MAUI-Sample/MainPage.xaml +++ b/WSC-MAUI-Sample/MainPage.xaml @@ -12,14 +12,11 @@ HeightRequest="185" Aspect="AspectFit" SemanticProperties.Description="dot net bot in a race car number eight" /> + -