Recent Items
This commit is contained in:
parent
2529b728ba
commit
f703567aed
10 changed files with 62 additions and 12 deletions
|
|
@ -2,13 +2,16 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||||
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
|
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
|
||||||
|
|
||||||
|
<AvaloniaVersion>11.0.9</AvaloniaVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageVersion Include="Avalonia" Version="11.0.7" />
|
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)" />
|
||||||
<PackageVersion Include="Avalonia.Desktop" Version="11.0.7" />
|
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(AvaloniaVersion)" />
|
||||||
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.0.7" />
|
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
|
||||||
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.0.7" />
|
<PackageVersion Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)" />
|
||||||
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.0.7" />
|
<PackageVersion Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)" />
|
||||||
|
<PackageVersion Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
|
||||||
<PackageVersion Include="Dock.Avalonia" Version="11.0.0.5" />
|
<PackageVersion Include="Dock.Avalonia" Version="11.0.0.5" />
|
||||||
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.1" />
|
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.1" />
|
||||||
<PackageVersion Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.1" />
|
<PackageVersion Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.1" />
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,6 @@
|
||||||
|
|
||||||
<Application.Styles>
|
<Application.Styles>
|
||||||
<FluentTheme />
|
<FluentTheme />
|
||||||
|
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
|
||||||
</Application.Styles>
|
</Application.Styles>
|
||||||
</Application>
|
</Application>
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Avalonia.Controls.DataGrid" />
|
||||||
<PackageReference Include="Avalonia.Fonts.Inter" />
|
<PackageReference Include="Avalonia.Fonts.Inter" />
|
||||||
<PackageReference Include="Avalonia.ReactiveUI" />
|
<PackageReference Include="Avalonia.ReactiveUI" />
|
||||||
<PackageReference Include="Avalonia.Themes.Fluent" />
|
<PackageReference Include="Avalonia.Themes.Fluent" />
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,12 @@ using InkForge.Common.Controllers;
|
||||||
using InkForge.Common.Data;
|
using InkForge.Common.Data;
|
||||||
using InkForge.Common.ViewModels;
|
using InkForge.Common.ViewModels;
|
||||||
using InkForge.Common.ViewModels.Landing;
|
using InkForge.Common.ViewModels.Landing;
|
||||||
using InkForge.Common.Views;
|
|
||||||
using InkForge.Data;
|
using InkForge.Data;
|
||||||
|
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
|
|
||||||
|
using Splat;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.DependencyInjection;
|
namespace Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
public static class InkForgeServiceCollections
|
public static class InkForgeServiceCollections
|
||||||
|
|
@ -21,7 +22,7 @@ public static class InkForgeServiceCollections
|
||||||
services.AddSingleton<LandingViewModelFactory>();
|
services.AddSingleton<LandingViewModelFactory>();
|
||||||
services.AddSingleton<WorkspaceController>();
|
services.AddSingleton<WorkspaceController>();
|
||||||
|
|
||||||
services.AddTransient<IViewFor<LandingViewModel>, LandingView>();
|
Locator.CurrentMutable.RegisterViewsForViewModels(typeof(InkForgeServiceCollections).Assembly);
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using InkForge.Common.Controllers;
|
||||||
using InkForge.Common.ReactiveUI;
|
using InkForge.Common.ReactiveUI;
|
||||||
|
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
|
|
@ -8,7 +9,15 @@ public class CreateWorkspaceViewModel : LandingViewModelBase
|
||||||
{
|
{
|
||||||
public override string? UrlPathSegment => null;
|
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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
using InkForge.Common.ReactiveUI;
|
using InkForge.Common.ReactiveUI;
|
||||||
|
|
||||||
namespace InkForge.Common.ViewModels.Landing;
|
namespace InkForge.Common.ViewModels.Landing;
|
||||||
|
|
@ -5,6 +7,9 @@ namespace InkForge.Common.ViewModels.Landing;
|
||||||
public class OpenRecentViewModel : LandingViewModelBase
|
public class OpenRecentViewModel : LandingViewModelBase
|
||||||
{
|
{
|
||||||
public override string? UrlPathSegment => null;
|
public override string? UrlPathSegment => null;
|
||||||
|
private readonly ReadOnlyObservableCollection<RecentItemViewModel> recentItems;
|
||||||
|
|
||||||
|
public ReadOnlyObservableCollection<RecentItemViewModel> RecentItems => recentItems;
|
||||||
|
|
||||||
public OpenRecentViewModel(LandingViewModel landing) : base(landing)
|
public OpenRecentViewModel(LandingViewModel landing) : base(landing)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
using ReactiveUI;
|
||||||
|
|
||||||
|
namespace InkForge.Common.ViewModels.Landing;
|
||||||
|
|
||||||
|
public record class RecentItemViewModel(
|
||||||
|
DateTimeOffset Created,
|
||||||
|
string Name,
|
||||||
|
DateTimeOffset LastUsed
|
||||||
|
) : ReactiveRecord;
|
||||||
|
|
@ -17,8 +17,9 @@ public class LandingViewModel : ReactiveObject, IScreen
|
||||||
public LandingViewModel(LandingViewModelFactory factory)
|
public LandingViewModel(LandingViewModelFactory factory)
|
||||||
{
|
{
|
||||||
_factory = factory;
|
_factory = factory;
|
||||||
|
|
||||||
Router.CurrentViewModel.Where(x => x is null)
|
Router.CurrentViewModel.Where(x => x is null)
|
||||||
|
.SelectMany(Observable.Return(factory.Create<OpenRecentViewModel>(this)))
|
||||||
.InvokeCommand<IRoutableViewModel>(Router.NavigateAndReset);
|
.InvokeCommand<IRoutableViewModel>(Router.NavigateAndReset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
<Label Content="InkForge"
|
<Label Content="InkForge"
|
||||||
Grid.Row="0" />
|
Grid.Row="0" />
|
||||||
|
|
||||||
<reactiveui:RoutedViewHost Router="{CompiledBinding Router}" />
|
<reactiveui:RoutedViewHost Router="{CompiledBinding Router}"
|
||||||
|
Grid.Row="1" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
@ -2,9 +2,28 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:vm="using:InkForge.Common.ViewModels.Landing"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
x:Class="InkForge.Common.Views.LandingViews.OpenRecentView">
|
x:Class="InkForge.Common.Views.LandingViews.OpenRecentView"
|
||||||
Welcome to Avalonia!
|
x:DataType="vm:OpenRecentViewModel">
|
||||||
|
<Grid RowDefinitions="Auto, *">
|
||||||
|
<Label Content="Open Recent"
|
||||||
|
Grid.Row="0" />
|
||||||
|
|
||||||
|
<DataGrid IsReadOnly="true"
|
||||||
|
ItemsSource="{CompiledBinding RecentItems}"
|
||||||
|
Grid.Row="1">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="Created"
|
||||||
|
Binding="{CompiledBinding Created, StringFormat={}{0:d}}" />
|
||||||
|
<DataGridTextColumn Header="Name"
|
||||||
|
Width="*"
|
||||||
|
Binding="{CompiledBinding Name}" />
|
||||||
|
<DataGridTextColumn Header="Last Used"
|
||||||
|
Binding="{CompiledBinding LastUsed, StringFormat={}{0:d}}" />
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue