Edit Function are available

This commit is contained in:
Natlinux81
2022-08-18 17:49:23 +02:00
parent 99c3bd58e1
commit 44e2e17c15
17 changed files with 203 additions and 100 deletions

View File

@@ -1,29 +0,0 @@
using Apollon.WPF.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Apollon.WPF.Stores
{
public class SelectedTournamentStore
{
private Tournament _selectedTournament;
public Tournament SelectedTournament
{
get
{
return _selectedTournament;
}
set
{
_selectedTournament = value;
SelectedTournamentChanged?.Invoke();
}
}
public event Action SelectedTournamentChanged;
}
}

View File

@@ -0,0 +1,46 @@
using Apollon.WPF.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Apollon.WPF.Stores
{
public class SelectedTournamentsStore
{
private readonly TournamentsStore _tournamentStore;
private Tournament _selectedTournament;
public Tournament SelectedTournament
{
get
{
return _selectedTournament;
}
set
{
_selectedTournament = value;
SelectedTournamentChanged?.Invoke();
}
}
public event Action SelectedTournamentChanged;
public SelectedTournamentsStore(TournamentsStore tournamentstore)
{
_tournamentStore = tournamentstore;
_tournamentStore.TournamentUpdated += TournamentStore_TournamentUpdated;
}
private void TournamentStore_TournamentUpdated(Tournament tournament)
{
if(tournament.Id == SelectedTournament?.Id)
{
SelectedTournament = tournament;
}
}
}
}

View File

@@ -7,13 +7,19 @@ using System.Threading.Tasks;
namespace Apollon.WPF.Stores
{
public class TournamentStore
public class TournamentsStore
{
public event Action<Tournament> TournamentAdded;
public event Action<Tournament> TournamentUpdated;
public async Task Add(Tournament tournament)
{
TournamentAdded?.Invoke(tournament);
}
public async Task Update (Tournament tournament)
{
TournamentUpdated?.Invoke(tournament);
}
}
}