From 1e0ab563d32be63ce4ee2aaefdcb61fc93960fa2 Mon Sep 17 00:00:00 2001 From: Chris Pulman Date: Sun, 28 Jul 2024 17:34:38 -0700 Subject: [PATCH] Updated to use Source Generators (#102) --- .../ReactiveMvvm.Avalonia.csproj | 2 +- .../ReactiveMvvm.Blazor.Wasm.csproj | 4 +-- .../ReactiveMvvm.Blazor.csproj | 2 +- .../ReactiveMvvm.Terminal.csproj | 5 ++- src/ReactiveMvvm/FodyWeavers.xml | 4 --- src/ReactiveMvvm/ReactiveMvvm.csproj | 16 +++++---- .../ViewModels/FeedbackViewModel.cs | 34 ++++++++++++------- 7 files changed, 36 insertions(+), 31 deletions(-) delete mode 100644 src/ReactiveMvvm/FodyWeavers.xml diff --git a/src/ReactiveMvvm.Avalonia/ReactiveMvvm.Avalonia.csproj b/src/ReactiveMvvm.Avalonia/ReactiveMvvm.Avalonia.csproj index 88b8399..9e1d4e1 100644 --- a/src/ReactiveMvvm.Avalonia/ReactiveMvvm.Avalonia.csproj +++ b/src/ReactiveMvvm.Avalonia/ReactiveMvvm.Avalonia.csproj @@ -2,7 +2,7 @@ WinExe net8.0 - 11.0.7 + 11.1.1 diff --git a/src/ReactiveMvvm.Blazor.Wasm/ReactiveMvvm.Blazor.Wasm.csproj b/src/ReactiveMvvm.Blazor.Wasm/ReactiveMvvm.Blazor.Wasm.csproj index 67cc9f9..35d40e8 100644 --- a/src/ReactiveMvvm.Blazor.Wasm/ReactiveMvvm.Blazor.Wasm.csproj +++ b/src/ReactiveMvvm.Blazor.Wasm/ReactiveMvvm.Blazor.Wasm.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/ReactiveMvvm.Blazor/ReactiveMvvm.Blazor.csproj b/src/ReactiveMvvm.Blazor/ReactiveMvvm.Blazor.csproj index abfc7c8..37f851b 100644 --- a/src/ReactiveMvvm.Blazor/ReactiveMvvm.Blazor.csproj +++ b/src/ReactiveMvvm.Blazor/ReactiveMvvm.Blazor.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/ReactiveMvvm.Terminal/ReactiveMvvm.Terminal.csproj b/src/ReactiveMvvm.Terminal/ReactiveMvvm.Terminal.csproj index 044a450..8eca8fc 100644 --- a/src/ReactiveMvvm.Terminal/ReactiveMvvm.Terminal.csproj +++ b/src/ReactiveMvvm.Terminal/ReactiveMvvm.Terminal.csproj @@ -4,11 +4,10 @@ net8.0 - + - - + diff --git a/src/ReactiveMvvm/FodyWeavers.xml b/src/ReactiveMvvm/FodyWeavers.xml deleted file mode 100644 index e12df67..0000000 --- a/src/ReactiveMvvm/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/ReactiveMvvm/ReactiveMvvm.csproj b/src/ReactiveMvvm/ReactiveMvvm.csproj index eb5c6b0..4bc4313 100644 --- a/src/ReactiveMvvm/ReactiveMvvm.csproj +++ b/src/ReactiveMvvm/ReactiveMvvm.csproj @@ -1,9 +1,11 @@  - - netstandard2.0 - - - - - + + netstandard2.0 + latest + + + + + + diff --git a/src/ReactiveMvvm/ViewModels/FeedbackViewModel.cs b/src/ReactiveMvvm/ViewModels/FeedbackViewModel.cs index efac929..5cdb38e 100644 --- a/src/ReactiveMvvm/ViewModels/FeedbackViewModel.cs +++ b/src/ReactiveMvvm/ViewModels/FeedbackViewModel.cs @@ -3,30 +3,38 @@ using System.Reactive.Linq; using System.Reactive.Disposables; using ReactiveMvvm.Interfaces; -using ReactiveUI.Fody.Helpers; +using ReactiveUI.SourceGenerators; using ReactiveUI; namespace ReactiveMvvm.ViewModels { - public sealed class FeedbackViewModel : ReactiveObject, IActivatableViewModel + public partial class FeedbackViewModel : ReactiveObject, IActivatableViewModel { + [Reactive] + private bool _hasErrors; + [Reactive] + private string _elapsed = string.Empty; + [Reactive] + private string _title = string.Empty; + [Reactive] + private int _titleLength; + [Reactive] + private string _message = string.Empty; + [Reactive] + private int _messageLength; + [Reactive] + private int _section; + [Reactive] + private bool _issue = true; + [Reactive] + private bool _idea; + public ViewModelActivator Activator { get; } = new ViewModelActivator(); public ReactiveCommand Submit { get; } - - [Reactive] public bool HasErrors { get; private set; } - [Reactive] public string Elapsed { get; private set; } = string.Empty; - [Reactive] public string Title { get; set; } = string.Empty; - [Reactive] public int TitleLength { get; private set; } public int TitleLengthMax { get; } = 15; - [Reactive] public string Message { get; set; } = string.Empty; - [Reactive] public int MessageLength { get; private set; } public int MessageLengthMax { get; } = 30; - - [Reactive] public int Section { get; set; } - [Reactive] public bool Issue { get; set; } = true; - [Reactive] public bool Idea { get; set; } public FeedbackViewModel(ISender sender, IClock clock) {