ready for display Modal

This commit is contained in:
Natlinux81
2022-08-13 03:55:31 +02:00
parent 29013ae275
commit 13f70e8c4b
9 changed files with 186 additions and 14 deletions

View File

@@ -3,10 +3,102 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace Apollon.WPF.ViewModels
{
internal class AddEditDetailsViewModel
public class AddEditDetailsViewModel : ViewModelBase
{
private string _organisation;
public string Organisation
{
get
{
return _organisation;
}
set
{
_organisation = value;
OnPropertyChanged(nameof(Organisation));
}
}
private string _tournamentname;
public string Tounamentname
{
get
{
return _tournamentname;
}
set
{
_tournamentname = value;
OnPropertyChanged(nameof(Tounamentname));
OnPropertyChanged(nameof(CanSubmit));
}
}
private string _category;
public string Category
{
get
{
return _category;
}
set
{
_category = value;
OnPropertyChanged(nameof(Category));
}
}
private string _startdate;
public string Startdate
{
get
{
return _startdate;
}
set
{
_startdate = value;
OnPropertyChanged(nameof(Startdate));
}
}
private string _enddate;
public string Enddate
{
get
{
return _enddate;
}
set
{
_enddate = value;
OnPropertyChanged(nameof(Enddate));
}
}
private string _location;
public string Location
{
get
{
return _location;
}
set
{
_location = value;
OnPropertyChanged(nameof(Location));
}
}
public bool CanSubmit => !string.IsNullOrEmpty(Tounamentname);
public ICommand SubmitCommand { get; }
public ICommand CancleCommand { get; }
}
}

View File

@@ -6,7 +6,14 @@ using System.Threading.Tasks;
namespace Apollon.WPF.ViewModels
{
internal class AddTournametViewModel
public class AddTournametViewModel : ViewModelBase
{
public AddEditDetailsViewModel AddEditDetailsViewModel { get; }
public AddTournametViewModel()
{
AddEditDetailsViewModel = new AddEditDetailsViewModel();
}
}
}

View File

@@ -0,0 +1,38 @@
using Apollon.WPF.Stores;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Apollon.WPF.ViewModels
{
public class MainViewModel : ViewModelBase
{
private readonly ModalNavigationStore _modalNavigationStore;
public ViewModelBase CurrentModalViewModel => _modalNavigationStore.CurrentViewModel;
public bool IsModalOpen => _modalNavigationStore.IsOpen;
public OverviewViewModel OverviewViewModel { get; }
public MainViewModel(ModalNavigationStore modalNavigationStore, OverviewViewModel overviewViewModel)
{
_modalNavigationStore = modalNavigationStore;
OverviewViewModel = overviewViewModel;
_modalNavigationStore.CurrentViewModelChanged += ModalNavigationStore_CurrentViewModelChanged;
}
protected override void Dispose()
{
_modalNavigationStore.CurrentViewModelChanged -= ModalNavigationStore_CurrentViewModelChanged;
base.Dispose();
}
private void ModalNavigationStore_CurrentViewModelChanged()
{
OnPropertyChanged(nameof(CurrentModalViewModel));
OnPropertyChanged(nameof(IsModalOpen));
}
}
}

View File

@@ -10,14 +10,14 @@ namespace Apollon.WPF.ViewModels
{
public class OverviewViewModel : ViewModelBase
{
public OverviewListingViewModel ApollonOverviewListingViewModel { get; }
public OverviewDetailsViewModel ApollonOverviewDetailsViewModel{ get; }
public OverviewListingViewModel OverviewListingViewModel { get; }
public OverviewDetailsViewModel OverviewDetailsViewModel{ get; }
public ICommand AddTournamentCommand { get; }
public OverviewViewModel(SelectedTournamentStore _selectedTournamentStore)
{
ApollonOverviewListingViewModel = new OverviewListingViewModel(_selectedTournamentStore);
ApollonOverviewDetailsViewModel = new OverviewDetailsViewModel(_selectedTournamentStore);
OverviewListingViewModel = new OverviewListingViewModel(_selectedTournamentStore);
OverviewDetailsViewModel = new OverviewDetailsViewModel(_selectedTournamentStore);
}
}
}