Replace ReactiveUI
This commit is contained in:
parent
43b4d50e43
commit
5584ab4ec8
41 changed files with 472 additions and 1013 deletions
|
|
@ -0,0 +1,30 @@
|
|||
using System.Reactive.Linq;
|
||||
|
||||
using AvaloniaEdit.Document;
|
||||
|
||||
using Dock.Model.Mvvm.Controls;
|
||||
|
||||
using DynamicData.Binding;
|
||||
|
||||
using InkForge.Desktop.Models;
|
||||
|
||||
namespace InkForge.Desktop.ViewModels.Documents;
|
||||
|
||||
public class NoteEditDocumentViewModel : Document
|
||||
{
|
||||
public Note Note { get; }
|
||||
|
||||
public TextDocument Document { get; }
|
||||
|
||||
public NoteEditDocumentViewModel(Note note, TextDocument textDocument)
|
||||
{
|
||||
Note = note;
|
||||
Document = textDocument;
|
||||
|
||||
Observable.CombineLatest(
|
||||
this.WhenValueChanged(v => v.Note.Name),
|
||||
this.WhenValueChanged(v => v.Document.UndoStack.IsOriginalFile),
|
||||
(name, original) => original ? name : $"{name} *"
|
||||
).Subscribe(title => Title = title!);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,33 +2,28 @@ using System.Reactive;
|
|||
|
||||
using Avalonia.Platform.Storage;
|
||||
|
||||
using Dock.Model.ReactiveUI.Controls;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
|
||||
using Dock.Model.Mvvm.Controls;
|
||||
|
||||
using InkForge.Desktop.Managers;
|
||||
using InkForge.Desktop.Services;
|
||||
|
||||
using ReactiveUI;
|
||||
|
||||
namespace InkForge.Desktop.ViewModels.Documents;
|
||||
|
||||
public class WelcomePageDocumentViewModel : Document
|
||||
public partial class WelcomePageDocumentViewModel : Document
|
||||
{
|
||||
private readonly WorkspaceManager _workspaceController;
|
||||
|
||||
public ReactiveCommand<Unit, Unit> CreateNew { get; }
|
||||
|
||||
public ReactiveCommand<Unit, Unit> OpenNew { get; }
|
||||
|
||||
public WelcomePageDocumentViewModel(WorkspaceManager workspaceController)
|
||||
{
|
||||
CanClose = false;
|
||||
Title = "Welcome";
|
||||
|
||||
_workspaceController = workspaceController;
|
||||
CreateNew = ReactiveCommand.CreateFromTask(OnCreateNew);
|
||||
OpenNew = ReactiveCommand.CreateFromTask(OnOpenNew);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task OnCreateNew()
|
||||
{
|
||||
var storageProvider = this.GetStorageProvider()!;
|
||||
|
|
@ -56,6 +51,7 @@ public class WelcomePageDocumentViewModel : Document
|
|||
await _workspaceController.OpenWorkspace(filePath, true);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task OnOpenNew()
|
||||
{
|
||||
var storageProvider = this.GetStorageProvider()!;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue