diff --git a/src/MauiSettings.Example/App.xaml b/src/MauiSettings.Example/App.xaml
new file mode 100644
index 0000000..c76d5b4
--- /dev/null
+++ b/src/MauiSettings.Example/App.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/MauiSettings.Example/App.xaml.cs b/src/MauiSettings.Example/App.xaml.cs
new file mode 100644
index 0000000..230ea50
--- /dev/null
+++ b/src/MauiSettings.Example/App.xaml.cs
@@ -0,0 +1,37 @@
+using AndreasReitberger.Shared.Core.Utilities;
+using MauiSettings.Example.Models.Settings;
+
+namespace MauiSettings.Example
+{
+ public partial class App : Application
+ {
+ public static string Hash = "96ug+F5VbYkQjqyolK8SO/R/HHeBZ2srDfMRR7uwrKA=";
+ public App()
+ {
+ InitializeComponent();
+ // Example of how to generate a new key
+ //string t = EncryptionManager.GenerateBase64Key();
+ SettingsApp.LoadSettings(Hash);
+ // Needed in order to load only the secure settings (for instance the license)
+ Dispatcher.DispatchAsync(async() => await SettingsApp.LoadSecureSettingsAsync(Hash));
+
+ MainPage = new AppShell();
+ }
+
+ protected override void OnSleep()
+ {
+ base.OnSleep();
+ if (SettingsApp.SettingsChanged)
+ {
+ try
+ {
+ SettingsApp.SaveSettings(Hash);
+ }
+ catch (Exception)
+ {
+
+ }
+ }
+ }
+ }
+}
diff --git a/src/MauiSettings.Example/AppShell.xaml b/src/MauiSettings.Example/AppShell.xaml
new file mode 100644
index 0000000..8515dd3
--- /dev/null
+++ b/src/MauiSettings.Example/AppShell.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/src/MauiSettings.Example/AppShell.xaml.cs b/src/MauiSettings.Example/AppShell.xaml.cs
new file mode 100644
index 0000000..48cc4a2
--- /dev/null
+++ b/src/MauiSettings.Example/AppShell.xaml.cs
@@ -0,0 +1,10 @@
+namespace MauiSettings.Example
+{
+ public partial class AppShell : Shell
+ {
+ public AppShell()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/MauiSettings.Example/MainPage.xaml b/src/MauiSettings.Example/MainPage.xaml
new file mode 100644
index 0000000..69f0ab8
--- /dev/null
+++ b/src/MauiSettings.Example/MainPage.xaml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/MauiSettings.Example/MainPage.xaml.cs b/src/MauiSettings.Example/MainPage.xaml.cs
new file mode 100644
index 0000000..81033c1
--- /dev/null
+++ b/src/MauiSettings.Example/MainPage.xaml.cs
@@ -0,0 +1,14 @@
+using MauiSettings.Example.ViewModels;
+
+namespace MauiSettings.Example
+{
+ public partial class MainPage : ContentPage
+ {
+ public MainPage()
+ {
+ InitializeComponent();
+ BindingContext = new MainPageViewModel();
+ }
+ }
+
+}
diff --git a/src/MauiSettings.Example/MauiProgram.cs b/src/MauiSettings.Example/MauiProgram.cs
new file mode 100644
index 0000000..e8d1e03
--- /dev/null
+++ b/src/MauiSettings.Example/MauiProgram.cs
@@ -0,0 +1,25 @@
+using Microsoft.Extensions.Logging;
+
+namespace MauiSettings.Example
+{
+ public static class MauiProgram
+ {
+ public static MauiApp CreateMauiApp()
+ {
+ var builder = MauiApp.CreateBuilder();
+ builder
+ .UseMauiApp()
+ .ConfigureFonts(fonts =>
+ {
+ fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
+ fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
+ });
+
+#if DEBUG
+ builder.Logging.AddDebug();
+#endif
+ builder.Services.AddSingleton(Dispatcher.GetForCurrentThread());
+ return builder.Build();
+ }
+ }
+}
diff --git a/src/MauiSettings.Example/MauiSettings.Example.csproj b/src/MauiSettings.Example/MauiSettings.Example.csproj
new file mode 100644
index 0000000..636105c
--- /dev/null
+++ b/src/MauiSettings.Example/MauiSettings.Example.csproj
@@ -0,0 +1,69 @@
+
+
+
+ net8.0-android;net8.0-ios;net8.0-maccatalyst
+ $(TargetFrameworks);net8.0-windows10.0.19041.0
+
+
+
+
+
+
+ Exe
+ MauiSettings.Example
+ true
+ true
+ enable
+ enable
+
+
+ MauiSettings Example
+
+
+ com.companyname.mauisettingsexample
+
+
+ 1.0
+ 1
+
+ 11.0
+ 13.1
+ 21.0
+ 10.0.17763.0
+ 10.0.17763.0
+ 6.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/MauiSettings.Example/Models/Settings/SettingsApp.cs b/src/MauiSettings.Example/Models/Settings/SettingsApp.cs
new file mode 100644
index 0000000..16af74e
--- /dev/null
+++ b/src/MauiSettings.Example/Models/Settings/SettingsApp.cs
@@ -0,0 +1,78 @@
+using AndreasReitberger.Maui;
+using AndreasReitberger.Maui.Attributes;
+using System.Runtime.CompilerServices;
+
+namespace MauiSettings.Example.Models.Settings
+{
+ ///
+ /// Holds the whole local application settings
+ ///
+ public partial class SettingsApp : MauiSettings
+ {
+ #region Properties
+ static bool _settingsChanged = false;
+ public static bool SettingsChanged
+ {
+ get => _settingsChanged;
+ set
+ {
+ if (_settingsChanged == value) return;
+ _settingsChanged = value;
+ }
+ }
+ #endregion
+
+ #region DeviceSettings
+ ///
+ /// Opens the settings UI on the current device
+ ///
+ public static void OpenDeviceSettings()
+ {
+ AppInfo.ShowSettingsUI();
+ }
+ #endregion
+
+ #region Settings
+
+ #region Version
+ [MauiSetting(Name = nameof(App_SettingsVersion), DefaultValue = "1.0.0", SkipForExport = true)]
+ public static Version App_SettingsVersion { get; set; }
+
+ #endregion
+
+ #region Default
+
+ [MauiSetting(Name = nameof(License_AcceptEndUserLicenseAgreement), DefaultValue = false)]
+ public static bool License_AcceptEndUserLicenseAgreement { get; set; }
+
+ [MauiSetting(Name = nameof(License_ProUpgradePurchased), DefaultValue = false)]
+ public static bool License_ProUpgradePurchased { get; set; }
+
+ [MauiSetting(Name = nameof(LicenseInfo), DefaultValue = "", Secure = true, Encrypt = true)]
+ public static string LicenseInfo { get; set; } = string.Empty;
+ #endregion
+
+ #region Privacy
+ [MauiSetting(Name = nameof(Privacy_AcceptPrivacyPolicy), DefaultValue = false, SkipForExport = true)]
+ public static bool Privacy_AcceptPrivacyPolicy { get; set; }
+
+ #endregion
+
+ #endregion
+
+ #region Methods
+
+ ///
+ /// Creates a copy of the current SettingsApp
+ ///
+ /// Copy of the current SettingsApp
+ public static SettingsApp Copy()
+ {
+ SettingsApp app = new();
+ app.LoadObjectSettings();
+ return app;
+ }
+
+ #endregion
+ }
+}
diff --git a/src/MauiSettings.Example/Platforms/Android/AndroidManifest.xml b/src/MauiSettings.Example/Platforms/Android/AndroidManifest.xml
new file mode 100644
index 0000000..e9937ad
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/Android/AndroidManifest.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/MauiSettings.Example/Platforms/Android/MainActivity.cs b/src/MauiSettings.Example/Platforms/Android/MainActivity.cs
new file mode 100644
index 0000000..3bc12c0
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/Android/MainActivity.cs
@@ -0,0 +1,11 @@
+using Android.App;
+using Android.Content.PM;
+using Android.OS;
+
+namespace MauiSettings.Example
+{
+ [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
+ public class MainActivity : MauiAppCompatActivity
+ {
+ }
+}
diff --git a/src/MauiSettings.Example/Platforms/Android/MainApplication.cs b/src/MauiSettings.Example/Platforms/Android/MainApplication.cs
new file mode 100644
index 0000000..f11b384
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/Android/MainApplication.cs
@@ -0,0 +1,16 @@
+using Android.App;
+using Android.Runtime;
+
+namespace MauiSettings.Example
+{
+ [Application]
+ public class MainApplication : MauiApplication
+ {
+ public MainApplication(IntPtr handle, JniHandleOwnership ownership)
+ : base(handle, ownership)
+ {
+ }
+
+ protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
+ }
+}
diff --git a/src/MauiSettings.Example/Platforms/Android/Resources/values/colors.xml b/src/MauiSettings.Example/Platforms/Android/Resources/values/colors.xml
new file mode 100644
index 0000000..c04d749
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/Android/Resources/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #512BD4
+ #2B0B98
+ #2B0B98
+
\ No newline at end of file
diff --git a/src/MauiSettings.Example/Platforms/MacCatalyst/AppDelegate.cs b/src/MauiSettings.Example/Platforms/MacCatalyst/AppDelegate.cs
new file mode 100644
index 0000000..b2265b2
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/MacCatalyst/AppDelegate.cs
@@ -0,0 +1,10 @@
+using Foundation;
+
+namespace MauiSettings.Example
+{
+ [Register("AppDelegate")]
+ public class AppDelegate : MauiUIApplicationDelegate
+ {
+ protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
+ }
+}
diff --git a/src/MauiSettings.Example/Platforms/MacCatalyst/Entitlements.plist b/src/MauiSettings.Example/Platforms/MacCatalyst/Entitlements.plist
new file mode 100644
index 0000000..de4adc9
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/MacCatalyst/Entitlements.plist
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ com.apple.security.app-sandbox
+
+
+ com.apple.security.network.client
+
+
+
+
diff --git a/src/MauiSettings.Example/Platforms/MacCatalyst/Info.plist b/src/MauiSettings.Example/Platforms/MacCatalyst/Info.plist
new file mode 100644
index 0000000..7268977
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/MacCatalyst/Info.plist
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UIDeviceFamily
+
+ 2
+
+ UIRequiredDeviceCapabilities
+
+ arm64
+
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ XSAppIconAssets
+ Assets.xcassets/appicon.appiconset
+
+
diff --git a/src/MauiSettings.Example/Platforms/MacCatalyst/Program.cs b/src/MauiSettings.Example/Platforms/MacCatalyst/Program.cs
new file mode 100644
index 0000000..6a2aab1
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/MacCatalyst/Program.cs
@@ -0,0 +1,16 @@
+using ObjCRuntime;
+using UIKit;
+
+namespace MauiSettings.Example
+{
+ 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));
+ }
+ }
+}
diff --git a/src/MauiSettings.Example/Platforms/Tizen/Main.cs b/src/MauiSettings.Example/Platforms/Tizen/Main.cs
new file mode 100644
index 0000000..74fc6b5
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/Tizen/Main.cs
@@ -0,0 +1,17 @@
+using Microsoft.Maui;
+using Microsoft.Maui.Hosting;
+using System;
+
+namespace MauiSettings.Example
+{
+ internal class Program : MauiApplication
+ {
+ protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
+
+ static void Main(string[] args)
+ {
+ var app = new Program();
+ app.Run(args);
+ }
+ }
+}
diff --git a/src/MauiSettings.Example/Platforms/Tizen/tizen-manifest.xml b/src/MauiSettings.Example/Platforms/Tizen/tizen-manifest.xml
new file mode 100644
index 0000000..572022d
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/Tizen/tizen-manifest.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+ maui-appicon-placeholder
+
+
+
+
+ http://tizen.org/privilege/internet
+
+
+
+
\ No newline at end of file
diff --git a/src/MauiSettings.Example/Platforms/Windows/App.xaml b/src/MauiSettings.Example/Platforms/Windows/App.xaml
new file mode 100644
index 0000000..d346dd2
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/Windows/App.xaml
@@ -0,0 +1,8 @@
+
+
+
diff --git a/src/MauiSettings.Example/Platforms/Windows/App.xaml.cs b/src/MauiSettings.Example/Platforms/Windows/App.xaml.cs
new file mode 100644
index 0000000..8e82195
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/Windows/App.xaml.cs
@@ -0,0 +1,25 @@
+using Microsoft.UI.Xaml;
+
+// To learn more about WinUI, the WinUI project structure,
+// and more about our project templates, see: http://aka.ms/winui-project-info.
+
+namespace MauiSettings.Example.WinUI
+{
+ ///
+ /// Provides application-specific behavior to supplement the default Application class.
+ ///
+ public partial class App : MauiWinUIApplication
+ {
+ ///
+ /// Initializes the singleton application object. This is the first line of authored code
+ /// executed, and as such is the logical equivalent of main() or WinMain().
+ ///
+ public App()
+ {
+ this.InitializeComponent();
+ }
+
+ protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
+ }
+
+}
diff --git a/src/MauiSettings.Example/Platforms/Windows/Package.appxmanifest b/src/MauiSettings.Example/Platforms/Windows/Package.appxmanifest
new file mode 100644
index 0000000..f8f8bac
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/Windows/Package.appxmanifest
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+ $placeholder$
+ User Name
+ $placeholder$.png
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/MauiSettings.Example/Platforms/Windows/app.manifest b/src/MauiSettings.Example/Platforms/Windows/app.manifest
new file mode 100644
index 0000000..d30536a
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/Windows/app.manifest
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+ true/PM
+ PerMonitorV2, PerMonitor
+
+
+
diff --git a/src/MauiSettings.Example/Platforms/iOS/AppDelegate.cs b/src/MauiSettings.Example/Platforms/iOS/AppDelegate.cs
new file mode 100644
index 0000000..b2265b2
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/iOS/AppDelegate.cs
@@ -0,0 +1,10 @@
+using Foundation;
+
+namespace MauiSettings.Example
+{
+ [Register("AppDelegate")]
+ public class AppDelegate : MauiUIApplicationDelegate
+ {
+ protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
+ }
+}
diff --git a/src/MauiSettings.Example/Platforms/iOS/Info.plist b/src/MauiSettings.Example/Platforms/iOS/Info.plist
new file mode 100644
index 0000000..0004a4f
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/iOS/Info.plist
@@ -0,0 +1,32 @@
+
+
+
+
+ LSRequiresIPhoneOS
+
+ UIDeviceFamily
+
+ 1
+ 2
+
+ UIRequiredDeviceCapabilities
+
+ arm64
+
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ XSAppIconAssets
+ Assets.xcassets/appicon.appiconset
+
+
diff --git a/src/MauiSettings.Example/Platforms/iOS/Program.cs b/src/MauiSettings.Example/Platforms/iOS/Program.cs
new file mode 100644
index 0000000..6a2aab1
--- /dev/null
+++ b/src/MauiSettings.Example/Platforms/iOS/Program.cs
@@ -0,0 +1,16 @@
+using ObjCRuntime;
+using UIKit;
+
+namespace MauiSettings.Example
+{
+ 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));
+ }
+ }
+}
diff --git a/src/MauiSettings.Example/Properties/launchSettings.json b/src/MauiSettings.Example/Properties/launchSettings.json
new file mode 100644
index 0000000..edf8aad
--- /dev/null
+++ b/src/MauiSettings.Example/Properties/launchSettings.json
@@ -0,0 +1,8 @@
+{
+ "profiles": {
+ "Windows Machine": {
+ "commandName": "MsixPackage",
+ "nativeDebugging": false
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/MauiSettings.Example/Resources/AppIcon/appicon.svg b/src/MauiSettings.Example/Resources/AppIcon/appicon.svg
new file mode 100644
index 0000000..9d63b65
--- /dev/null
+++ b/src/MauiSettings.Example/Resources/AppIcon/appicon.svg
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/src/MauiSettings.Example/Resources/AppIcon/appiconfg.svg b/src/MauiSettings.Example/Resources/AppIcon/appiconfg.svg
new file mode 100644
index 0000000..21dfb25
--- /dev/null
+++ b/src/MauiSettings.Example/Resources/AppIcon/appiconfg.svg
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/src/MauiSettings.Example/Resources/Fonts/OpenSans-Regular.ttf b/src/MauiSettings.Example/Resources/Fonts/OpenSans-Regular.ttf
new file mode 100644
index 0000000..2d1edf0
Binary files /dev/null and b/src/MauiSettings.Example/Resources/Fonts/OpenSans-Regular.ttf differ
diff --git a/src/MauiSettings.Example/Resources/Fonts/OpenSans-Semibold.ttf b/src/MauiSettings.Example/Resources/Fonts/OpenSans-Semibold.ttf
new file mode 100644
index 0000000..fe13d06
Binary files /dev/null and b/src/MauiSettings.Example/Resources/Fonts/OpenSans-Semibold.ttf differ
diff --git a/src/MauiSettings.Example/Resources/Images/dotnet_bot.png b/src/MauiSettings.Example/Resources/Images/dotnet_bot.png
new file mode 100644
index 0000000..f93ce02
Binary files /dev/null and b/src/MauiSettings.Example/Resources/Images/dotnet_bot.png differ
diff --git a/src/MauiSettings.Example/Resources/Raw/AboutAssets.txt b/src/MauiSettings.Example/Resources/Raw/AboutAssets.txt
new file mode 100644
index 0000000..15d6244
--- /dev/null
+++ b/src/MauiSettings.Example/Resources/Raw/AboutAssets.txt
@@ -0,0 +1,15 @@
+Any raw assets you want to be deployed with your application can be placed in
+this directory (and child directories). Deployment of the asset to your application
+is automatically handled by the following `MauiAsset` Build Action within your `.csproj`.
+
+
+
+These files will be deployed with you package and will be accessible using Essentials:
+
+ async Task LoadMauiAsset()
+ {
+ using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
+ using var reader = new StreamReader(stream);
+
+ var contents = reader.ReadToEnd();
+ }
diff --git a/src/MauiSettings.Example/Resources/Splash/splash.svg b/src/MauiSettings.Example/Resources/Splash/splash.svg
new file mode 100644
index 0000000..21dfb25
--- /dev/null
+++ b/src/MauiSettings.Example/Resources/Splash/splash.svg
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/src/MauiSettings.Example/Resources/Styles/Colors.xaml b/src/MauiSettings.Example/Resources/Styles/Colors.xaml
new file mode 100644
index 0000000..30307a5
--- /dev/null
+++ b/src/MauiSettings.Example/Resources/Styles/Colors.xaml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+ #512BD4
+ #ac99ea
+ #242424
+ #DFD8F7
+ #9880e5
+ #2B0B98
+
+ White
+ Black
+ #D600AA
+ #190649
+ #1f1f1f
+
+ #E1E1E1
+ #C8C8C8
+ #ACACAC
+ #919191
+ #6E6E6E
+ #404040
+ #212121
+ #141414
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/MauiSettings.Example/Resources/Styles/Styles.xaml b/src/MauiSettings.Example/Resources/Styles/Styles.xaml
new file mode 100644
index 0000000..e0d36bb
--- /dev/null
+++ b/src/MauiSettings.Example/Resources/Styles/Styles.xaml
@@ -0,0 +1,426 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/MauiSettings.Example/ViewModels/MainPageViewModel.cs b/src/MauiSettings.Example/ViewModels/MainPageViewModel.cs
new file mode 100644
index 0000000..c9a897b
--- /dev/null
+++ b/src/MauiSettings.Example/ViewModels/MainPageViewModel.cs
@@ -0,0 +1,59 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using MauiSettings.Example.Models.Settings;
+
+namespace MauiSettings.Example.ViewModels
+{
+ public partial class MainPageViewModel : ObservableObject
+ {
+ #region Settings
+ [ObservableProperty]
+ bool isLoading = false;
+
+ [ObservableProperty]
+ string licenseInfo = string.Empty;
+ partial void OnLicenseInfoChanged(string value)
+ {
+ if (!IsLoading)
+ {
+ SettingsApp.LicenseInfo = value;
+ SettingsApp.SettingsChanged = true;
+ }
+ }
+
+ #endregion
+
+ #region Ctor
+ public MainPageViewModel()
+ {
+ LoadSettings();
+ }
+ #endregion
+
+ #region Methods
+ void LoadSettings()
+ {
+ IsLoading = true;
+
+ LicenseInfo = SettingsApp.LicenseInfo;
+
+ IsLoading = false;
+ }
+ #endregion
+
+ #region Commands
+ [RelayCommand]
+ void SaveSettings()
+ {
+ SettingsApp.SaveSettings(App.Hash);
+ }
+
+ [RelayCommand]
+ void ToDictionary()
+ {
+ // All "SkipForExport" should be missing here.
+ var dict = SettingsApp.ToDictionaryAsync();
+ }
+ #endregion
+ }
+}
diff --git a/src/MauiSettings.sln b/src/MauiSettings.sln
index d7cb1a4..4fddb2e 100644
--- a/src/MauiSettings.sln
+++ b/src/MauiSettings.sln
@@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Projektmappenelemente", "Pr
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharedNetCoreLibrary", "..\..\SharedMauiCoreLibrary\src\SharedNetCoreLibrary\SharedNetCoreLibrary.csproj", "{CA7C2653-5783-4A4C-960A-97CA4038748F}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MauiSettings.Example", "MauiSettings.Example\MauiSettings.Example.csproj", "{343E7298-7A56-4737-A1A2-312835BCB98C}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -26,6 +28,12 @@ Global
{CA7C2653-5783-4A4C-960A-97CA4038748F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA7C2653-5783-4A4C-960A-97CA4038748F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA7C2653-5783-4A4C-960A-97CA4038748F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {343E7298-7A56-4737-A1A2-312835BCB98C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {343E7298-7A56-4737-A1A2-312835BCB98C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {343E7298-7A56-4737-A1A2-312835BCB98C}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {343E7298-7A56-4737-A1A2-312835BCB98C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {343E7298-7A56-4737-A1A2-312835BCB98C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {343E7298-7A56-4737-A1A2-312835BCB98C}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/MauiSettings/MauiSettings.cs b/src/MauiSettings/MauiSettings.cs
index 9a138fa..8629fac 100644
--- a/src/MauiSettings/MauiSettings.cs
+++ b/src/MauiSettings/MauiSettings.cs
@@ -12,6 +12,7 @@
public class MauiSettings : MauiSettingsGeneric where T : new()
{
public MauiSettings() { }
- public MauiSettings(T settingsObject, string key) : base(settingsObject, key) { }
+ //public MauiSettings(string key) : base(key) { }
+ //public MauiSettings(T settingsObject, string key) : base(settingsObject, key) { }
}
}
\ No newline at end of file
diff --git a/src/MauiSettings/MauiSettings.csproj b/src/MauiSettings/MauiSettings.csproj
index 922e221..f2d2473 100644
--- a/src/MauiSettings/MauiSettings.csproj
+++ b/src/MauiSettings/MauiSettings.csproj
@@ -9,6 +9,7 @@
true
enable
false
+ enable
14.2
14.0
@@ -28,7 +29,7 @@
README.md
True
Settings.Maui
- 1.0.5
+ 1.0.6
Settings.Maui
SettingsMaui
diff --git a/src/MauiSettings/MauiSettingsGeneric.cs b/src/MauiSettings/MauiSettingsGeneric.cs
index d5205eb..708ef32 100644
--- a/src/MauiSettings/MauiSettingsGeneric.cs
+++ b/src/MauiSettings/MauiSettingsGeneric.cs
@@ -41,7 +41,7 @@ public static SO SettingsObject
#endregion
#region Variables
- static string _passPhrase = string.Empty;
+ //static string _passPhrase = string.Empty;
static readonly object lockObject = new();
#endregion
@@ -51,212 +51,175 @@ public MauiSettingsGeneric(SO settingsObject)
{
_settingsObject = settingsObject;
}
+ /*
+ public MauiSettingsGeneric(string key)
+ {
+ _passPhrase = key;
+ }
public MauiSettingsGeneric(SO settingsObject, string key)
{
_settingsObject = settingsObject;
_passPhrase = key;
}
+ */
#endregion
#region Methods
#region LoadSettings
- public static void LoadSettings()
- {
- LoadSettings(settings: SettingsObject);
- }
- public static void LoadSetting(Expression> value)
- {
- LoadObjectSetting(SettingsObject, value);
- }
- public static async Task LoadSettingAsync(Expression> value)
+ public static void LoadSettings(string? key = null) => LoadSettings(settings: SettingsObject, key: key);
+
+ public static void LoadSetting(Expression> value, string? key = null) => LoadObjectSetting(SettingsObject, value, key: key);
+
+ public static async Task LoadSettingAsync(Expression> value, string? key = null)
{
await Task.Run(async delegate
{
- await LoadObjectSettingAsync(SettingsObject, value);
+ await LoadObjectSettingAsync(SettingsObject, value, key: key);
});
}
- public void LoadObjectSettings()
- {
- LoadSettings(this);
- }
- public static void LoadObjectSetting(object settingsObject, Expression> value)
- {
- GetExpressionMeta(settings: settingsObject, value, MauiSettingsActions.Load);
- }
- public static async Task LoadObjectSettingAsync(object settingsObject, Expression> value)
+ public void LoadObjectSettings(string? key = null) => LoadSettings(this, key: key);
+
+ public static void LoadObjectSetting(object settingsObject, Expression> value, string? key = null)
+ => GetExpressionMeta(settings: settingsObject, value, MauiSettingsActions.Load, key: key);
+
+ public static async Task LoadObjectSettingAsync(object settingsObject, Expression> value, string? key = null)
{
await Task.Run(async delegate
{
- await GetExpressionMetaAsync(settings: settingsObject, value, MauiSettingsActions.Load);
+ await GetExpressionMetaAsync(settings: settingsObject, value, MauiSettingsActions.Load, key: key);
});
}
- public static void LoadSettings(object settings)
- {
- GetClassMeta(settings: settings, mode: MauiSettingsActions.Load);
- }
- public static async Task LoadSettingsAsync()
+ public static void LoadSettings(object settings, string? key = null) => GetClassMeta(settings: settings, mode: MauiSettingsActions.Load, key: key);
+
+ public static async Task LoadSettingsAsync(string? key = null)
{
await Task.Run(async delegate
{
- await LoadSettingsAsync(settings: SettingsObject);
+ await LoadSettingsAsync(settings: SettingsObject, key: key);
});
}
- public static async Task LoadSettingsAsync(object settings)
+ public static async Task LoadSettingsAsync(object settings, string? key = null)
{
await Task.Run(async delegate
{
- await GetClassMetaAsync(settings: settings, mode: MauiSettingsActions.Load);
+ await GetClassMetaAsync(settings: settings, mode: MauiSettingsActions.Load, key: key);
});
}
- public static async Task LoadSecureSettingsAsync()
+ public static async Task LoadSecureSettingsAsync(string? key = null)
{
await Task.Run(async delegate
{
- await LoadSecureSettingsAsync(settings: SettingsObject);
+ await LoadSecureSettingsAsync(settings: SettingsObject, key: key);
});
}
- public static async Task LoadSecureSettingsAsync(object settings)
+ public static async Task LoadSecureSettingsAsync(object settings, string? key = null)
{
await Task.Run(async delegate
{
- await GetClassMetaAsync(settings: settings, mode: MauiSettingsActions.Load, secureOnly: true);
+ await GetClassMetaAsync(settings: settings, mode: MauiSettingsActions.Load, secureOnly: true, key: key);
});
}
- public static async Task LoadSettingsAsync(Dictionary> dictionary, bool save = true)
+ public static async Task LoadSettingsAsync(Dictionary> dictionary, bool save = true, string? key = null)
{
await Task.Run(async delegate
{
- await LoadSettingsAsync(settings: SettingsObject, dictionary: dictionary, save: save);
+ await LoadSettingsAsync(settings: SettingsObject, dictionary: dictionary, save: save, key: key);
});
}
- public static async Task LoadSettingsAsync(string key, Tuple