selectetTournament without DateTime
This commit is contained in:
@@ -8,21 +8,21 @@ namespace Apollon.WPF.Models
|
|||||||
{
|
{
|
||||||
public class Tournament
|
public class Tournament
|
||||||
{
|
{
|
||||||
public Tournament(string organisation, string tournamentname, string category, DateTime startdate, DateTime enddate, string location)
|
public Tournament(string organisation, string tournamentname, string category, string location)
|
||||||
{
|
{
|
||||||
Organisation = organisation;
|
Organisation = organisation;
|
||||||
Tournamentname = tournamentname;
|
Tournamentname = tournamentname;
|
||||||
Category = category;
|
Category = category;
|
||||||
Startdate = startdate;
|
//Startdate = startdate;
|
||||||
Enddate = enddate;
|
//Enddate = enddate;
|
||||||
Location = location;
|
Location = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Organisation { get; }
|
public string Organisation { get; }
|
||||||
public string Tournamentname { get; }
|
public string Tournamentname { get; }
|
||||||
public string Category { get; }
|
public string Category { get; }
|
||||||
public DateTime Startdate { get; }
|
//public DateTime Startdate { get; }
|
||||||
public DateTime Enddate { get; }
|
//public DateTime Enddate { get; }
|
||||||
public string Location { get; }
|
public string Location { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,30 @@ namespace Apollon.WPF.ViewModels
|
|||||||
public string Organisation => _selectedTournament?.Organisation ?? "keine Organisation";
|
public string Organisation => _selectedTournament?.Organisation ?? "keine Organisation";
|
||||||
public string Tournamentname => _selectedTournament?.Tournamentname ?? "kein Name";
|
public string Tournamentname => _selectedTournament?.Tournamentname ?? "kein Name";
|
||||||
public string Category => _selectedTournament?.Category ?? "keine Kategorie";
|
public string Category => _selectedTournament?.Category ?? "keine Kategorie";
|
||||||
public DateTime Startdate => _selectedTournament?.Startdate ?? DateTime.MinValue;
|
//public DateTime Startdate => _selectedTournament?.Startdate ?? DateTime.MinValue;
|
||||||
public DateTime Enddate => _selectedTournament?.Enddate ?? DateTime.MinValue;
|
//public DateTime Enddate => _selectedTournament?.Enddate ?? DateTime.MinValue;
|
||||||
public string Location => _selectedTournament?.Location ?? "kein Ort";
|
public string Location => _selectedTournament?.Location ?? "kein Ort";
|
||||||
|
|
||||||
public ApollonOverviewDetailsViewModel(SelectedTournamentStore selectedTournamentStore)
|
public ApollonOverviewDetailsViewModel(SelectedTournamentStore selectedTournamentStore)
|
||||||
{
|
{
|
||||||
_selectedTournamentStore = selectedTournamentStore;
|
_selectedTournamentStore = selectedTournamentStore;
|
||||||
|
|
||||||
|
_selectedTournamentStore.SelectedTournamentChanged += SelectedTournamentStore_SelectedTournamentChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose()
|
||||||
|
{
|
||||||
|
_selectedTournamentStore.SelectedTournamentChanged -= SelectedTournamentStore_SelectedTournamentChanged;
|
||||||
|
base.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectedTournamentStore_SelectedTournamentChanged()
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(hasSelectedTournament));
|
||||||
|
OnPropertyChanged(nameof(Organisation));
|
||||||
|
OnPropertyChanged(nameof(Tournamentname));
|
||||||
|
OnPropertyChanged(nameof(Category));
|
||||||
|
OnPropertyChanged(nameof(Location));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using Apollon.WPF.Models;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -9,13 +10,14 @@ namespace Apollon.WPF.ViewModels
|
|||||||
{
|
{
|
||||||
public class ApollonOverviewListingItemViewModel : ViewModelBase
|
public class ApollonOverviewListingItemViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
public string Tournamentname { get; }
|
public Tournament Tournament { get;}
|
||||||
public ICommand DeleteCommand { get; }
|
|
||||||
|
|
||||||
public ApollonOverviewListingItemViewModel(string tournamentname)
|
public string Tournamentname => Tournament.Tournamentname;
|
||||||
|
public ICommand DeleteCommand { get; }
|
||||||
|
|
||||||
|
public ApollonOverviewListingItemViewModel(Tournament tournament)
|
||||||
{
|
{
|
||||||
Tournamentname = tournamentname;
|
Tournament = tournament;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Apollon.WPF.Stores;
|
using Apollon.WPF.Models;
|
||||||
|
using Apollon.WPF.Stores;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
@@ -11,15 +12,37 @@ namespace Apollon.WPF.ViewModels
|
|||||||
public class ApollonOverviewListingViewModel : ViewModelBase
|
public class ApollonOverviewListingViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private readonly ObservableCollection<ApollonOverviewListingItemViewModel> _apollonOverviewListingItemViewModels;
|
private readonly ObservableCollection<ApollonOverviewListingItemViewModel> _apollonOverviewListingItemViewModels;
|
||||||
|
private readonly SelectedTournamentStore _selectedTournamentStore;
|
||||||
|
|
||||||
public IEnumerable<ApollonOverviewListingItemViewModel> ApollonOverviewListingItemViewModels => _apollonOverviewListingItemViewModels;
|
public IEnumerable<ApollonOverviewListingItemViewModel> ApollonOverviewListingItemViewModels => _apollonOverviewListingItemViewModels;
|
||||||
|
|
||||||
public ApollonOverviewListingViewModel(SelectedTournamentStore _selectedTournamentStore)
|
private ApollonOverviewListingItemViewModel _selectedOverviewListingItemViewModel;
|
||||||
|
|
||||||
|
public ApollonOverviewListingItemViewModel SelectedOverviewListingItemViewModel
|
||||||
{
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _selectedOverviewListingItemViewModel;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedOverviewListingItemViewModel = value;
|
||||||
|
OnPropertyChanged(nameof(SelectedOverviewListingItemViewModel));
|
||||||
|
|
||||||
|
_selectedTournamentStore.SelectedTournament = _selectedOverviewListingItemViewModel.Tournament;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApollonOverviewListingViewModel(SelectedTournamentStore selectedTournamentStore)
|
||||||
|
{
|
||||||
|
|
||||||
|
_selectedTournamentStore = selectedTournamentStore;
|
||||||
_apollonOverviewListingItemViewModels = new ObservableCollection<ApollonOverviewListingItemViewModel>();
|
_apollonOverviewListingItemViewModels = new ObservableCollection<ApollonOverviewListingItemViewModel>();
|
||||||
|
|
||||||
_apollonOverviewListingItemViewModels.Add(new ApollonOverviewListingItemViewModel("Testmeisterschaft1"));
|
_apollonOverviewListingItemViewModels.Add(new ApollonOverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft1", "Halle", "Wiesbaden")));
|
||||||
_apollonOverviewListingItemViewModels.Add(new ApollonOverviewListingItemViewModel("Testmeisterschaft2"));
|
_apollonOverviewListingItemViewModels.Add(new ApollonOverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft2", "im Freien", "Berlin")));
|
||||||
_apollonOverviewListingItemViewModels.Add(new ApollonOverviewListingItemViewModel("Testmeisterschaft3"));
|
_apollonOverviewListingItemViewModels.Add(new ApollonOverviewListingItemViewModel(new Tournament("DSB", "Deutschemeisterschaft3", "Halle", "Bruchsal")));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,5 +15,7 @@ namespace Apollon.WPF.ViewModels
|
|||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void Dispose() { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
BorderBrush="Transparent"
|
BorderBrush="Transparent"
|
||||||
Padding="20"
|
Padding="20"
|
||||||
ItemsSource="{Binding ApollonOverviewListingItemViewModels}">
|
ItemsSource="{Binding ApollonOverviewListingItemViewModels}"
|
||||||
|
SelectedItem="{Binding SelectedOverviewListingItemViewModel}">
|
||||||
<ListView.ItemContainerStyle>
|
<ListView.ItemContainerStyle>
|
||||||
<Style TargetType="ListViewItem">
|
<Style TargetType="ListViewItem">
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user