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