mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
[Refactor] Update commands to use asynchronous patterns with ReactiveCommand
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Reactive;
|
||||
using System.Threading.Tasks;
|
||||
using ReactiveUI;
|
||||
using RomRepoMgr.Core.EventArgs;
|
||||
using RomRepoMgr.Core.Models;
|
||||
@@ -61,7 +62,7 @@ public class EditDatViewModel : ViewModelBase
|
||||
_date = romSet.Date;
|
||||
_description = romSet.Description;
|
||||
_homepage = romSet.Homepage;
|
||||
SaveCommand = ReactiveCommand.Create(ExecuteSaveCommand);
|
||||
SaveCommand = ReactiveCommand.CreateFromTask(ExecuteSaveCommandAsync);
|
||||
CancelCommand = ReactiveCommand.Create(ExecuteCloseCommand);
|
||||
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand);
|
||||
}
|
||||
@@ -193,9 +194,9 @@ public class EditDatViewModel : ViewModelBase
|
||||
|
||||
void ExecuteCloseCommand() => _view.Close();
|
||||
|
||||
async void ExecuteSaveCommand()
|
||||
async Task ExecuteSaveCommandAsync()
|
||||
{
|
||||
using var ctx = Context.Create(Settings.Settings.Current.DatabasePath);
|
||||
await using var ctx = Context.Create(Settings.Settings.Current.DatabasePath);
|
||||
|
||||
RomSet romSetDb = await ctx.RomSets.FindAsync(_romSet.Id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user