diff --git a/examples/QuickJournal/AppShell.xaml b/examples/QuickJournal/AppShell.xaml index 776310cf1d..5842ff3721 100644 --- a/examples/QuickJournal/AppShell.xaml +++ b/examples/QuickJournal/AppShell.xaml @@ -8,7 +8,7 @@ diff --git a/examples/QuickJournal/AppShell.xaml.cs b/examples/QuickJournal/AppShell.xaml.cs index 4496fc862e..d9359eb8f3 100644 --- a/examples/QuickJournal/AppShell.xaml.cs +++ b/examples/QuickJournal/AppShell.xaml.cs @@ -8,7 +8,6 @@ public AppShell() { InitializeComponent(); - Routing.RegisterRoute("entryDetail", typeof(JournalEntryDetailPage)); + Routing.RegisterRoute("entryDetail", typeof(EntryDetailPage)); } -} - +} \ No newline at end of file diff --git a/examples/QuickJournal/MauiProgram.cs b/examples/QuickJournal/MauiProgram.cs index 4e0effe783..9f42b17a2a 100644 --- a/examples/QuickJournal/MauiProgram.cs +++ b/examples/QuickJournal/MauiProgram.cs @@ -10,12 +10,7 @@ public static MauiApp CreateMauiApp() var builder = MauiApp.CreateBuilder(); builder .UseMauiApp() - .UseMauiCommunityToolkit() - .ConfigureFonts(fonts => - { - fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); - fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); - }); + .UseMauiCommunityToolkit(); #if DEBUG builder.Logging.AddDebug(); @@ -23,5 +18,4 @@ public static MauiApp CreateMauiApp() return builder.Build(); } -} - +} \ No newline at end of file diff --git a/examples/QuickJournal/Models/EntryMetadata.cs b/examples/QuickJournal/Models/EntryMetadata.cs index fbf7019efe..d2bd103752 100644 --- a/examples/QuickJournal/Models/EntryMetadata.cs +++ b/examples/QuickJournal/Models/EntryMetadata.cs @@ -1,5 +1,4 @@ -using System; -using Realms; +using Realms; namespace QuickJournal.Models { diff --git a/examples/QuickJournal/Models/JournalEntry.cs b/examples/QuickJournal/Models/JournalEntry.cs index 1e52500420..b8ae244605 100644 --- a/examples/QuickJournal/Models/JournalEntry.cs +++ b/examples/QuickJournal/Models/JournalEntry.cs @@ -1,14 +1,13 @@ -using System; -using Realms; +using Realms; namespace QuickJournal.Models { public partial class JournalEntry : IRealmObject { - public string Title { get; set; } + public string? Title { get; set; } - public string Body { get; set; } + public string? Body { get; set; } - public EntryMetadata Metadata { get; set; } + public EntryMetadata? Metadata { get; set; } } } diff --git a/examples/QuickJournal/Platforms/Android/MainActivity.cs b/examples/QuickJournal/Platforms/Android/MainActivity.cs index f623ea3840..880d44f83b 100644 --- a/examples/QuickJournal/Platforms/Android/MainActivity.cs +++ b/examples/QuickJournal/Platforms/Android/MainActivity.cs @@ -7,5 +7,4 @@ namespace QuickJournal; [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] public class MainActivity : MauiAppCompatActivity { -} - +} \ No newline at end of file diff --git a/examples/QuickJournal/Platforms/Android/MainApplication.cs b/examples/QuickJournal/Platforms/Android/MainApplication.cs index d891a8eb63..6dfbe9a2d8 100644 --- a/examples/QuickJournal/Platforms/Android/MainApplication.cs +++ b/examples/QuickJournal/Platforms/Android/MainApplication.cs @@ -12,5 +12,4 @@ public MainApplication(IntPtr handle, JniHandleOwnership ownership) } protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); -} - +} \ No newline at end of file diff --git a/examples/QuickJournal/Platforms/MacCatalyst/AppDelegate.cs b/examples/QuickJournal/Platforms/MacCatalyst/AppDelegate.cs index 0516958a28..0cf71f976f 100644 --- a/examples/QuickJournal/Platforms/MacCatalyst/AppDelegate.cs +++ b/examples/QuickJournal/Platforms/MacCatalyst/AppDelegate.cs @@ -6,5 +6,4 @@ namespace QuickJournal; public class AppDelegate : MauiUIApplicationDelegate { protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); -} - +} \ No newline at end of file diff --git a/examples/QuickJournal/Platforms/MacCatalyst/Program.cs b/examples/QuickJournal/Platforms/MacCatalyst/Program.cs index 9917ba6af2..5d4e8cbf0b 100644 --- a/examples/QuickJournal/Platforms/MacCatalyst/Program.cs +++ b/examples/QuickJournal/Platforms/MacCatalyst/Program.cs @@ -6,11 +6,10 @@ namespace QuickJournal; public class Program { // This is the main entry point of the application. - static void Main(string[] args) + public 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)); } -} - +} \ No newline at end of file diff --git a/examples/QuickJournal/Platforms/iOS/AppDelegate.cs b/examples/QuickJournal/Platforms/iOS/AppDelegate.cs index 0516958a28..0cf71f976f 100644 --- a/examples/QuickJournal/Platforms/iOS/AppDelegate.cs +++ b/examples/QuickJournal/Platforms/iOS/AppDelegate.cs @@ -6,5 +6,4 @@ namespace QuickJournal; public class AppDelegate : MauiUIApplicationDelegate { protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); -} - +} \ No newline at end of file diff --git a/examples/QuickJournal/Platforms/iOS/Program.cs b/examples/QuickJournal/Platforms/iOS/Program.cs index 9917ba6af2..5d4e8cbf0b 100644 --- a/examples/QuickJournal/Platforms/iOS/Program.cs +++ b/examples/QuickJournal/Platforms/iOS/Program.cs @@ -6,11 +6,10 @@ namespace QuickJournal; public class Program { // This is the main entry point of the application. - static void Main(string[] args) + public 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)); } -} - +} \ No newline at end of file diff --git a/examples/QuickJournal/QuickJournal.csproj b/examples/QuickJournal/QuickJournal.csproj index ce3828e0d0..a3e4d12485 100644 --- a/examples/QuickJournal/QuickJournal.csproj +++ b/examples/QuickJournal/QuickJournal.csproj @@ -8,6 +8,9 @@ true true enable + stylecop.ruleset + enable + None QuickJournal @@ -25,7 +28,6 @@ 21.0 10.0.17763.0 10.0.17763.0 - 6.5 @@ -33,27 +35,24 @@ - - + - - - - - - - - + - - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + diff --git a/examples/QuickJournal/README.md b/examples/QuickJournal/README.md index 0fbd406f1b..46fe31310b 100644 --- a/examples/QuickJournal/README.md +++ b/examples/QuickJournal/README.md @@ -1,4 +1,11 @@ # QuickJournal **QuickJournal** is a simple MAUI application that shows how Realm can be used effectively in conjunction with MVVM and data binding. -The app allows the user to keep a very minimal journal, where each entry is made up of a title and a body. Every time a new journal entry is added or modified it gets persisted to a realm, and thanks to the bindings the UI gets updated immediately, with no additional code required. \ No newline at end of file +The app allows the user to keep a very minimal journal, where each entry is made up of a title and a body. Every time a new journal entry is added or modified it gets persisted to a realm, and thanks to the bindings the UI gets updated immediately, with no additional code required. + +--- +**NOTE** + +Due to a [bug in MAUI](https://github.com/dotnet/maui/issues/14065), the rows of the `ListView` on `EntriesPage` don't appear on Windows, even though they are still clickable. + +--- \ No newline at end of file diff --git a/examples/QuickJournal/Resources/AppIcon/appicon.png b/examples/QuickJournal/Resources/AppIcon/appicon.png new file mode 100644 index 0000000000..d324472cf0 Binary files /dev/null and b/examples/QuickJournal/Resources/AppIcon/appicon.png differ diff --git a/examples/QuickJournal/Resources/AppIcon/appicon.svg b/examples/QuickJournal/Resources/AppIcon/appicon.svg deleted file mode 100644 index 49f980057e..0000000000 --- a/examples/QuickJournal/Resources/AppIcon/appicon.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/examples/QuickJournal/Resources/AppIcon/appiconfg.svg b/examples/QuickJournal/Resources/AppIcon/appiconfg.svg deleted file mode 100644 index e9b7139de2..0000000000 --- a/examples/QuickJournal/Resources/AppIcon/appiconfg.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/examples/QuickJournal/Resources/Fonts/OpenSans-Regular.ttf b/examples/QuickJournal/Resources/Fonts/OpenSans-Regular.ttf deleted file mode 100644 index f6669c2838..0000000000 Binary files a/examples/QuickJournal/Resources/Fonts/OpenSans-Regular.ttf and /dev/null differ diff --git a/examples/QuickJournal/Resources/Fonts/OpenSans-Semibold.ttf b/examples/QuickJournal/Resources/Fonts/OpenSans-Semibold.ttf deleted file mode 100644 index a4658e20df..0000000000 Binary files a/examples/QuickJournal/Resources/Fonts/OpenSans-Semibold.ttf and /dev/null differ diff --git a/examples/QuickJournal/Resources/Images/dotnet_bot.svg b/examples/QuickJournal/Resources/Images/dotnet_bot.svg deleted file mode 100644 index e19b012717..0000000000 --- a/examples/QuickJournal/Resources/Images/dotnet_bot.svg +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/QuickJournal/Resources/Raw/AboutAssets.txt b/examples/QuickJournal/Resources/Raw/AboutAssets.txt deleted file mode 100644 index 808d6d3b3e..0000000000 --- a/examples/QuickJournal/Resources/Raw/AboutAssets.txt +++ /dev/null @@ -1,17 +0,0 @@ -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/examples/QuickJournal/Resources/Splash/mongodb.png b/examples/QuickJournal/Resources/Splash/mongodb.png new file mode 100644 index 0000000000..0652d572d5 Binary files /dev/null and b/examples/QuickJournal/Resources/Splash/mongodb.png differ diff --git a/examples/QuickJournal/Resources/Splash/splash.svg b/examples/QuickJournal/Resources/Splash/splash.svg deleted file mode 100644 index 4b713836f9..0000000000 --- a/examples/QuickJournal/Resources/Splash/splash.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/examples/QuickJournal/Resources/Styles/Colors.xaml b/examples/QuickJournal/Resources/Styles/Colors.xaml index e4a7a434d8..28deca8eb2 100644 --- a/examples/QuickJournal/Resources/Styles/Colors.xaml +++ b/examples/QuickJournal/Resources/Styles/Colors.xaml @@ -4,9 +4,9 @@ xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"> - #512BD4 - #DFD8F7 - #2B0B98 + #00684A + #023430 + #00ED64 White Black #E1E1E1 diff --git a/examples/QuickJournal/ViewModels/JournalEntriesViewModel.cs b/examples/QuickJournal/ViewModels/EntriesViewModel.cs similarity index 89% rename from examples/QuickJournal/ViewModels/JournalEntriesViewModel.cs rename to examples/QuickJournal/ViewModels/EntriesViewModel.cs index b20cc9e29f..a57f41e90f 100644 --- a/examples/QuickJournal/ViewModels/JournalEntriesViewModel.cs +++ b/examples/QuickJournal/ViewModels/EntriesViewModel.cs @@ -8,17 +8,14 @@ namespace QuickJournal.ViewModels { - public partial class JournalEntriesViewModel : ObservableObject + public partial class EntriesViewModel : ObservableObject { private readonly Realm realm; [ObservableProperty] private IQueryable? entries; - [ObservableProperty] - private string test; - - public JournalEntriesViewModel() + public EntriesViewModel() { realm = Realm.GetInstance(); Entries = realm.All(); @@ -27,7 +24,7 @@ public JournalEntriesViewModel() // This could have been implemeted hooking up on the back button behaviour // (with Shell.BackButtonBehaviour), but there is a current bug in MAUI // that would make the application crash (https://github.com/dotnet/maui/pull/11438) - WeakReferenceMessenger.Default.Register< EntryModifiedMessage>(this, EntryModifiedHandler); + WeakReferenceMessenger.Default.Register(this, EntryModifiedHandler); } [RelayCommand] @@ -81,5 +78,4 @@ private async void EntryModifiedHandler(object recipient, EntryModifiedMessage m } } } -} - +} \ No newline at end of file diff --git a/examples/QuickJournal/ViewModels/JournalEntryDetailViewModel.cs b/examples/QuickJournal/ViewModels/EntryDetailViewModel.cs similarity index 71% rename from examples/QuickJournal/ViewModels/JournalEntryDetailViewModel.cs rename to examples/QuickJournal/ViewModels/EntryDetailViewModel.cs index 111bccfb0c..292133da49 100644 --- a/examples/QuickJournal/ViewModels/JournalEntryDetailViewModel.cs +++ b/examples/QuickJournal/ViewModels/EntryDetailViewModel.cs @@ -1,23 +1,21 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; -using CommunityToolkit.Mvvm.Messaging.Messages; using QuickJournal.Messages; using QuickJournal.Models; namespace QuickJournal.ViewModels { [QueryProperty("Entry", nameof(Entry))] - public partial class JournalEntryDetailViewModel : ObservableObject + public partial class EntryDetailViewModel : ObservableObject { [ObservableProperty] - private JournalEntry entry; + private JournalEntry entry = null!; [RelayCommand] public void OnPageClosed() { - WeakReferenceMessenger.Default.Send(new EntryModifiedMessage(entry)); + WeakReferenceMessenger.Default.Send(new EntryModifiedMessage(Entry)); } } -} - +} \ No newline at end of file diff --git a/examples/QuickJournal/Views/JournalEntriesPage.xaml b/examples/QuickJournal/Views/EntriesPage.xaml similarity index 95% rename from examples/QuickJournal/Views/JournalEntriesPage.xaml rename to examples/QuickJournal/Views/EntriesPage.xaml index c415748391..784aa9de23 100644 --- a/examples/QuickJournal/Views/JournalEntriesPage.xaml +++ b/examples/QuickJournal/Views/EntriesPage.xaml @@ -1,7 +1,7 @@  - + diff --git a/examples/QuickJournal/Views/EntriesPage.xaml.cs b/examples/QuickJournal/Views/EntriesPage.xaml.cs new file mode 100644 index 0000000000..e53756c658 --- /dev/null +++ b/examples/QuickJournal/Views/EntriesPage.xaml.cs @@ -0,0 +1,9 @@ +namespace QuickJournal.Views; + +public partial class EntriesPage : ContentPage +{ + public EntriesPage() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/examples/QuickJournal/Views/JournalEntryDetailPage.xaml b/examples/QuickJournal/Views/EntryDetailPage.xaml similarity index 89% rename from examples/QuickJournal/Views/JournalEntryDetailPage.xaml rename to examples/QuickJournal/Views/EntryDetailPage.xaml index 1abffdd84a..5f8d0e91cc 100644 --- a/examples/QuickJournal/Views/JournalEntryDetailPage.xaml +++ b/examples/QuickJournal/Views/EntryDetailPage.xaml @@ -1,7 +1,7 @@  @@ -11,7 +11,7 @@ Command="{Binding PageClosedCommand}" /> - + diff --git a/examples/QuickJournal/Views/EntryDetailPage.xaml.cs b/examples/QuickJournal/Views/EntryDetailPage.xaml.cs new file mode 100644 index 0000000000..14c4e0643a --- /dev/null +++ b/examples/QuickJournal/Views/EntryDetailPage.xaml.cs @@ -0,0 +1,9 @@ +namespace QuickJournal.Views; + +public partial class EntryDetailPage : ContentPage +{ + public EntryDetailPage() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/examples/QuickJournal/Views/JournalEntriesPage.xaml.cs b/examples/QuickJournal/Views/JournalEntriesPage.xaml.cs deleted file mode 100644 index de68d90bb6..0000000000 --- a/examples/QuickJournal/Views/JournalEntriesPage.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace QuickJournal.Views; - -public partial class JournalEntriesPage : ContentPage -{ - public JournalEntriesPage() - { - InitializeComponent(); - } -} - diff --git a/examples/QuickJournal/Views/JournalEntryDetailPage.xaml.cs b/examples/QuickJournal/Views/JournalEntryDetailPage.xaml.cs deleted file mode 100644 index d0d666c22e..0000000000 --- a/examples/QuickJournal/Views/JournalEntryDetailPage.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace QuickJournal.Views; - -public partial class JournalEntryDetailPage : ContentPage -{ - public JournalEntryDetailPage() - { - InitializeComponent(); - } -} - diff --git a/examples/QuickJournal/stylecop.json b/examples/QuickJournal/stylecop.json new file mode 100644 index 0000000000..27f41d42c9 --- /dev/null +++ b/examples/QuickJournal/stylecop.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + "orderingRules": { + "usingDirectivesPlacement": "outsideNamespace", + "elementOrder": [ + "kind", + "constant", + "static", + "accessibility", + "readonly" + ] + }, + "documentationRules": { + "documentInternalElements": false + } + } +} \ No newline at end of file diff --git a/examples/QuickJournal/stylecop.ruleset b/examples/QuickJournal/stylecop.ruleset new file mode 100644 index 0000000000..39cbc8ccc6 --- /dev/null +++ b/examples/QuickJournal/stylecop.ruleset @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file