throw exeption
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Apollon.WPF.Stores;
|
||||
using Apollon.WPF.Models;
|
||||
using Apollon.WPF.Stores;
|
||||
using Apollon.WPF.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -17,6 +18,7 @@ namespace Apollon.WPF
|
||||
{
|
||||
private readonly ModalNavigationStore _modalNavigationStore;
|
||||
private readonly SelectedTournamentStore _selectedTournamentStore;
|
||||
private readonly Tournament _tournament;
|
||||
|
||||
public App()
|
||||
{
|
||||
@@ -25,7 +27,7 @@ namespace Apollon.WPF
|
||||
}
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
OverviewViewModel overviewViewModel = new OverviewViewModel(_selectedTournamentStore, _modalNavigationStore);
|
||||
OverviewViewModel overviewViewModel = new OverviewViewModel(_selectedTournamentStore, _modalNavigationStore, _tournament);
|
||||
|
||||
MainWindow = new MainWindow()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Apollon.WPF.Stores;
|
||||
using Apollon.WPF.Models;
|
||||
using Apollon.WPF.Stores;
|
||||
using Apollon.WPF.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,15 +12,17 @@ namespace Apollon.WPF.Commands
|
||||
public class OpenEditTournamentCommand : CommandBase
|
||||
{
|
||||
private readonly ModalNavigationStore _modalNavigationStore;
|
||||
private readonly Tournament _tournament;
|
||||
|
||||
public OpenEditTournamentCommand(ModalNavigationStore modalNavigationStore)
|
||||
public OpenEditTournamentCommand(ModalNavigationStore modalNavigationStore, Tournament tournament)
|
||||
{
|
||||
_modalNavigationStore = modalNavigationStore;
|
||||
_tournament = tournament;
|
||||
}
|
||||
|
||||
public override void Execute(object parameter)
|
||||
{
|
||||
EditTournamentViewModel editTournamentViewModel = new EditTournamentViewModel(_modalNavigationStore);
|
||||
EditTournamentViewModel editTournamentViewModel = new EditTournamentViewModel(_tournament,_modalNavigationStore);
|
||||
_modalNavigationStore.CurrentViewModel = editTournamentViewModel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Apollon.WPF.Commands;
|
||||
using Apollon.WPF.Models;
|
||||
using Apollon.WPF.Stores;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -13,10 +14,19 @@ namespace Apollon.WPF.ViewModels
|
||||
{
|
||||
public AddEditDetailsViewModel AddEditDetailsViewModel { get; }
|
||||
|
||||
public EditTournamentViewModel(ModalNavigationStore modalNavigationStore)
|
||||
public EditTournamentViewModel(Tournament tournament, ModalNavigationStore modalNavigationStore)
|
||||
{
|
||||
ICommand cancelCommand = new CloseModalCommand(modalNavigationStore);
|
||||
AddEditDetailsViewModel = new AddEditDetailsViewModel(null, cancelCommand); ;
|
||||
AddEditDetailsViewModel = new AddEditDetailsViewModel(null, cancelCommand)
|
||||
{
|
||||
Organisation = tournament.Organisation,
|
||||
Tournamentname = tournament.Tournamentname,
|
||||
Category = tournament.Category,
|
||||
Startdate = tournament.Startdate,
|
||||
Enddate = tournament.Enddate,
|
||||
Location = tournament.Location,
|
||||
Rounds = tournament.Rounds,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Apollon.WPF.Models;
|
||||
using Apollon.WPF.Commands;
|
||||
using Apollon.WPF.Models;
|
||||
using Apollon.WPF.Stores;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -6,15 +7,16 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Apollon.WPF.ViewModels
|
||||
{
|
||||
public class OverviewListingViewModel : ViewModelBase
|
||||
{
|
||||
private readonly ObservableCollection<OverviewListingItemViewModel> _OverviewListingItemViewModels;
|
||||
private readonly ObservableCollection<OverviewListingItemViewModel> _overviewListingItemViewModels;
|
||||
private readonly SelectedTournamentStore _selectedTournamentStore;
|
||||
|
||||
public IEnumerable<OverviewListingItemViewModel> OverviewListingItemViewModels => _OverviewListingItemViewModels;
|
||||
public IEnumerable<OverviewListingItemViewModel> OverviewListingItemViewModels => _overviewListingItemViewModels;
|
||||
|
||||
private OverviewListingItemViewModel _selectedOverviewListingItemViewModel;
|
||||
|
||||
@@ -33,16 +35,22 @@ namespace Apollon.WPF.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public OverviewListingViewModel(SelectedTournamentStore selectedTournamentStore)
|
||||
public OverviewListingViewModel(SelectedTournamentStore selectedTournamentStore, ModalNavigationStore modalNavigationStore)
|
||||
{
|
||||
|
||||
_selectedTournamentStore = selectedTournamentStore;
|
||||
_OverviewListingItemViewModels = new ObservableCollection<OverviewListingItemViewModel>();
|
||||
_overviewListingItemViewModels = new ObservableCollection<OverviewListingItemViewModel>();
|
||||
|
||||
_OverviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft1", "Halle", "01.01.2021", "05.01.2021", "Wiesbaden",3)));
|
||||
_OverviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft2", "im Freien", "01.01.2021", "05.01.2021", "Berlin",5)));
|
||||
_OverviewListingItemViewModels.Add(new OverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft3", "Halle", "01.01.2021", "05.01.2021", "Bruchsal", 6)));
|
||||
AddTournament(new Tournament("DSB", "Deutschemeisterschaft1", "Halle", "01.01.2021", "05.01.2021", "Wiesbaden",3),modalNavigationStore);
|
||||
AddTournament(new Tournament("DSB", "Deutschemeisterschaft2", "im Freien", "01.01.2021", "05.01.2021", "Berlin",5),modalNavigationStore);
|
||||
AddTournament(new Tournament("DSB", "Deutschemeisterschaft3", "Halle", "01.01.2021", "05.01.2021", "Bruchsal", 6),modalNavigationStore);
|
||||
|
||||
}
|
||||
private void AddTournament(Tournament tournament, ModalNavigationStore modalNavigationStore)
|
||||
{
|
||||
_overviewListingItemViewModels.Add(new OverviewListingItemViewModel(tournament));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Apollon.WPF.Commands;
|
||||
using Apollon.WPF.Models;
|
||||
using Apollon.WPF.Stores;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -17,13 +18,15 @@ namespace Apollon.WPF.ViewModels
|
||||
public ICommand AddTournamentCommand { get; }
|
||||
public ICommand EditTournamentCommand { get; }
|
||||
|
||||
public OverviewViewModel(SelectedTournamentStore _selectedTournamentStore, ModalNavigationStore modalNavigationStore)
|
||||
|
||||
|
||||
public OverviewViewModel(SelectedTournamentStore selectedTournamentStore, ModalNavigationStore modalNavigationStore, Tournament tournament)
|
||||
{
|
||||
OverviewListingViewModel = new OverviewListingViewModel(_selectedTournamentStore);
|
||||
OverviewDetailsViewModel = new OverviewDetailsViewModel(_selectedTournamentStore);
|
||||
OverviewListingViewModel = new OverviewListingViewModel(selectedTournamentStore, modalNavigationStore);
|
||||
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore);
|
||||
|
||||
AddTournamentCommand = new OpenAddTournamentCommand(modalNavigationStore);
|
||||
EditTournamentCommand = new OpenEditTournamentCommand(modalNavigationStore);
|
||||
EditTournamentCommand = new OpenEditTournamentCommand(modalNavigationStore, tournament);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user