before adding LoadingSpinner

This commit is contained in:
Natlinux81
2022-08-27 19:06:39 +02:00
parent fa278fc245
commit 7fe2fd08ea
7 changed files with 52 additions and 24 deletions

View File

@@ -1,4 +1,5 @@
using Apollon.WPF.Stores;
using Apollon.WPF.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -9,15 +10,19 @@ namespace Apollon.WPF.Commands
{
public class LoadTournamentsCommand : AsyncCommandBase
{
private readonly OverviewViewModel _overviewViewModel;
private readonly TournamentsStore _tournamentStore;
public LoadTournamentsCommand(TournamentsStore tournamentStore)
public LoadTournamentsCommand(OverviewViewModel overviewViewModel, TournamentsStore tournamentStore)
{
_overviewViewModel = overviewViewModel;
_tournamentStore = tournamentStore;
}
public override async Task ExecuteAsync(object parameter)
{
_overviewViewModel.IsLoading = true;
try
{
await _tournamentStore.Load();
@@ -26,6 +31,10 @@ namespace Apollon.WPF.Commands
{
throw;
}
finally
{
_overviewViewModel.IsLoading = false;
}
}
}
}