Edit Function are available
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
46
Apollon.WPF/Stores/SelectedTournamentsStore.cs
Normal file
46
Apollon.WPF/Stores/SelectedTournamentsStore.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user