diff --git a/src/PostIt/PostIt/ViewModels/MainViewModel.cs b/src/PostIt/PostIt/ViewModels/MainPageViewModel.cs
similarity index 95%
rename from src/PostIt/PostIt/ViewModels/MainViewModel.cs
rename to src/PostIt/PostIt/ViewModels/MainPageViewModel.cs
index e34d753c..69742832 100644
--- a/src/PostIt/PostIt/ViewModels/MainViewModel.cs
+++ b/src/PostIt/PostIt/ViewModels/MainPageViewModel.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.ObjectModel;
+using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using Avalonia.Styling;
@@ -50,17 +51,20 @@ public partial class MainPageViewModel : ViewModelBase
/// App.axaml.cs so the same client (and its token store)
/// is shared with the login flow.
///
- public BlogApiClient BlogClient { get; }
+ public BlogApiClient? BlogClient { get; }
public override bool CanNavigateNext { get => throw new NotImplementedException(); protected set => throw new NotImplementedException(); }
public override bool CanNavigatePrevious { get => throw new NotImplementedException(); protected set => throw new NotImplementedException(); }
- ///
- /// Test-friendly constructor: caller supplies a pre-built
- /// . Production code uses the
- /// (Settings, BlogApiClient) overload below.
- ///
- public MainPageViewModel(BlogApiClient blogClient, Settings? settings = null)
+
+ public MainPageViewModel()
+ {
+ Init(null);
+ SettingsModel = new SettingsPageViewModel();
+ BlogClient = null;
+ }
+
+ private void Init(Settings? settings)
{
SearchText = string.Empty;
Posts = new ObservableCollection();
@@ -71,10 +75,21 @@ public partial class MainPageViewModel : ViewModelBase
Settings = settings ?? new Settings();
Title = "PostIt";
CurrentViewModel = this;
- SettingsModel = new SettingsPageViewModel();
- BlogClient = blogClient ?? throw new ArgumentNullException(nameof(blogClient));
}
+ ///
+ /// Test-friendly constructor: caller supplies a pre-built
+ /// . Production code uses the
+ /// (Settings, BlogApiClient) overload below.
+ ///
+ public MainPageViewModel(BlogApiClient blogClient, Settings? settings = null)
+ {
+ SettingsModel = new SettingsPageViewModel();
+ BlogClient = blogClient ?? throw new ArgumentNullException(nameof(blogClient));;
+
+ Init(settings);
+ }
+
partial void OnSearchTextChanged(string value) => ApplyFilter();
partial void OnSelectedPostChanged(BlogPost? value) => UpdateCommandStates();
diff --git a/src/PostIt/PostIt/Views/LoginPage.axaml b/src/PostIt/PostIt/Views/LoginPage.axaml
index df8d86e3..7969c98a 100644
--- a/src/PostIt/PostIt/Views/LoginPage.axaml
+++ b/src/PostIt/PostIt/Views/LoginPage.axaml
@@ -5,10 +5,10 @@
x:DataType="vm:LoginPageViewModel"
Header="Login">
-
+
-
@@ -27,18 +27,7 @@
FontSize="24"
HorizontalAlignment="Center"/>
-
-
-
-
-
-
-
-