diff --git a/Directory.Packages.props b/Directory.Packages.props index b72d740..f5cd323 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -2,13 +2,16 @@ true true + + 11.0.9 - - - - - + + + + + + diff --git a/app/InkForge.Common/App.axaml b/app/InkForge.Common/App.axaml index 0104aff..84f7844 100644 --- a/app/InkForge.Common/App.axaml +++ b/app/InkForge.Common/App.axaml @@ -6,5 +6,6 @@ + \ No newline at end of file diff --git a/app/InkForge.Common/InkForge.Common.csproj b/app/InkForge.Common/InkForge.Common.csproj index 9847d58..2d0d625 100644 --- a/app/InkForge.Common/InkForge.Common.csproj +++ b/app/InkForge.Common/InkForge.Common.csproj @@ -8,6 +8,7 @@ + diff --git a/app/InkForge.Common/Microsoft/Extensions/DependencyInjection/InkForgeServiceCollection.cs b/app/InkForge.Common/Microsoft/Extensions/DependencyInjection/InkForgeServiceCollection.cs index 625ddd5..a30e906 100644 --- a/app/InkForge.Common/Microsoft/Extensions/DependencyInjection/InkForgeServiceCollection.cs +++ b/app/InkForge.Common/Microsoft/Extensions/DependencyInjection/InkForgeServiceCollection.cs @@ -2,11 +2,12 @@ using InkForge.Common.Controllers; using InkForge.Common.Data; using InkForge.Common.ViewModels; using InkForge.Common.ViewModels.Landing; -using InkForge.Common.Views; using InkForge.Data; using ReactiveUI; +using Splat; + namespace Microsoft.Extensions.DependencyInjection; public static class InkForgeServiceCollections @@ -21,7 +22,7 @@ public static class InkForgeServiceCollections services.AddSingleton(); services.AddSingleton(); - services.AddTransient, LandingView>(); + Locator.CurrentMutable.RegisterViewsForViewModels(typeof(InkForgeServiceCollections).Assembly); return services; } diff --git a/app/InkForge.Common/ViewModels/Landing/CreateWorkspaceViewModel.cs b/app/InkForge.Common/ViewModels/Landing/CreateWorkspaceViewModel.cs index e3165cd..edc9254 100644 --- a/app/InkForge.Common/ViewModels/Landing/CreateWorkspaceViewModel.cs +++ b/app/InkForge.Common/ViewModels/Landing/CreateWorkspaceViewModel.cs @@ -1,3 +1,4 @@ +using InkForge.Common.Controllers; using InkForge.Common.ReactiveUI; using ReactiveUI; @@ -8,7 +9,15 @@ public class CreateWorkspaceViewModel : LandingViewModelBase { public override string? UrlPathSegment => null; - public CreateWorkspaceViewModel(LandingViewModel landing) : base(landing) + private string workspaceName; + + public string WorkspaceName + { + get => workspaceName; + set => this.RaiseAndSetIfChanged(ref workspaceName, value); + } + + public CreateWorkspaceViewModel(LandingViewModel landing, WorkspaceController workspace) : base(landing) { } } diff --git a/app/InkForge.Common/ViewModels/Landing/OpenRecentViewModel.cs b/app/InkForge.Common/ViewModels/Landing/OpenRecentViewModel.cs index 39cc0bd..3d1464f 100644 --- a/app/InkForge.Common/ViewModels/Landing/OpenRecentViewModel.cs +++ b/app/InkForge.Common/ViewModels/Landing/OpenRecentViewModel.cs @@ -1,3 +1,5 @@ +using System.Collections.ObjectModel; + using InkForge.Common.ReactiveUI; namespace InkForge.Common.ViewModels.Landing; @@ -5,6 +7,9 @@ namespace InkForge.Common.ViewModels.Landing; public class OpenRecentViewModel : LandingViewModelBase { public override string? UrlPathSegment => null; + private readonly ReadOnlyObservableCollection recentItems; + + public ReadOnlyObservableCollection RecentItems => recentItems; public OpenRecentViewModel(LandingViewModel landing) : base(landing) { diff --git a/app/InkForge.Common/ViewModels/Landing/RecentItemViewModel.cs b/app/InkForge.Common/ViewModels/Landing/RecentItemViewModel.cs new file mode 100644 index 0000000..a15c938 --- /dev/null +++ b/app/InkForge.Common/ViewModels/Landing/RecentItemViewModel.cs @@ -0,0 +1,9 @@ +using ReactiveUI; + +namespace InkForge.Common.ViewModels.Landing; + +public record class RecentItemViewModel( + DateTimeOffset Created, + string Name, + DateTimeOffset LastUsed +) : ReactiveRecord; diff --git a/app/InkForge.Common/ViewModels/LandingViewModel.cs b/app/InkForge.Common/ViewModels/LandingViewModel.cs index ca40237..7a1154c 100644 --- a/app/InkForge.Common/ViewModels/LandingViewModel.cs +++ b/app/InkForge.Common/ViewModels/LandingViewModel.cs @@ -17,8 +17,9 @@ public class LandingViewModel : ReactiveObject, IScreen public LandingViewModel(LandingViewModelFactory factory) { _factory = factory; - + Router.CurrentViewModel.Where(x => x is null) + .SelectMany(Observable.Return(factory.Create(this))) .InvokeCommand(Router.NavigateAndReset); } diff --git a/app/InkForge.Common/Views/LandingView.axaml b/app/InkForge.Common/Views/LandingView.axaml index cae67b1..1f0d60c 100644 --- a/app/InkForge.Common/Views/LandingView.axaml +++ b/app/InkForge.Common/Views/LandingView.axaml @@ -13,6 +13,7 @@