Replace ReactiveUI
This commit is contained in:
parent
43b4d50e43
commit
5584ab4ec8
41 changed files with 472 additions and 1013 deletions
|
|
@ -1,3 +1,7 @@
|
|||
using Avalonia;
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
using InkForge.Data;
|
||||
using InkForge.Desktop.Data.Options;
|
||||
using InkForge.Desktop.Models;
|
||||
|
|
@ -5,24 +9,16 @@ using InkForge.Desktop.Models;
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
using ReactiveUI;
|
||||
|
||||
namespace InkForge.Desktop.Managers;
|
||||
|
||||
public class WorkspaceManager(IServiceProvider serviceProvider) : ReactiveObject
|
||||
public partial class WorkspaceManager(IServiceProvider serviceProvider) : ObservableObject
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider = serviceProvider;
|
||||
private Workspace? _workspace;
|
||||
|
||||
public Workspace? Workspace
|
||||
{
|
||||
get => _workspace;
|
||||
private set => this.RaiseAndSetIfChanged(ref _workspace, value);
|
||||
}
|
||||
[ObservableProperty] private Workspace? _workspace;
|
||||
|
||||
public ValueTask CloseWorkspace()
|
||||
{
|
||||
_workspace?.Dispose();
|
||||
Workspace?.Dispose();
|
||||
Workspace = null;
|
||||
return ValueTask.CompletedTask;
|
||||
}
|
||||
|
|
@ -66,7 +62,7 @@ public class WorkspaceManager(IServiceProvider serviceProvider) : ReactiveObject
|
|||
var db = dbContext.Database;
|
||||
if ((await db.GetPendingMigrationsAsync().ConfigureAwait(false)).Any())
|
||||
{
|
||||
if (file.Exists)
|
||||
if ((await db.GetAppliedMigrationsAsync().ConfigureAwait(false)).Any())
|
||||
{
|
||||
file.CopyTo(Path.ChangeExtension(file.FullName, $"{DateTime.Now:s}{file.Extension}"));
|
||||
}
|
||||
|
|
@ -74,6 +70,8 @@ public class WorkspaceManager(IServiceProvider serviceProvider) : ReactiveObject
|
|||
await db.MigrateAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
await serviceProvider.GetRequiredService<NoteStore>().Load().ConfigureAwait(false);
|
||||
|
||||
scope = null;
|
||||
}
|
||||
catch (Exception)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue