before adding LoadingSpinner

This commit is contained in:
Natlinux81
2022-08-27 19:06:39 +02:00
parent fa278fc245
commit 7fe2fd08ea
7 changed files with 52 additions and 24 deletions

View File

@@ -17,16 +17,14 @@ namespace Apollon.WPF.ViewModels
public string TournamentName => Tournament.TournamentName;
public string Location => Tournament.Location;
public ICommand EditCommand { get; }
//public ICommand DeleteCommand { get; }
public ICommand EditCommand { get; }
public ICommand WarningDeleteCommand { get; }
public OverviewListingItemViewModel(Tournament tournament, TournamentsStore tournamentStore, ModalNavigationStore modalNavigationStore)
{
Tournament = tournament;
EditCommand = new OpenEditTournamentCommand(this, tournamentStore, modalNavigationStore);
//DeleteCommand = new DeleteTournamentCommand(this, tournamentStore);
EditCommand = new OpenEditTournamentCommand(this, tournamentStore, modalNavigationStore);
WarningDeleteCommand = new OpenWarningDeleteCommand(this, modalNavigationStore, tournamentStore);
}

View File

@@ -33,16 +33,13 @@ namespace Apollon.WPF.ViewModels
}
}
public ICommand LoadTournamentsCommand { get;}
public OverviewListingViewModel(SelectedTournamentsStore selectedTournamentStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentStore)
{
_tournamentStore = tournamentStore;
_selectedTournamentStore = selectedTournamentStore;
_modalNavigationStore = modalNavigationStore;
_overviewListingItemViewModels = new ObservableCollection<OverviewListingItemViewModel>();
LoadTournamentsCommand = new LoadTournamentsCommand(tournamentStore);
_overviewListingItemViewModels = new ObservableCollection<OverviewListingItemViewModel>();
_selectedTournamentStore.SelectedTournamentChanged += SelectedTournamentStore_SelectedTournamentChanged;
@@ -52,16 +49,7 @@ namespace Apollon.WPF.ViewModels
_tournamentStore.TournamentDeleted += TournamentStore_TournamentDeleted;
_overviewListingItemViewModels.CollectionChanged += OverviewListingItemViewModels_CollectionChanged;
}
public static OverviewListingViewModel LoadViewModel(SelectedTournamentsStore selectedTournamentStore, ModalNavigationStore modalNavigationStore, TournamentsStore tournamentStore)
{
OverviewListingViewModel viewModel = new OverviewListingViewModel(selectedTournamentStore, modalNavigationStore, tournamentStore);
viewModel.LoadTournamentsCommand.Execute(null);
return viewModel;
}
}
protected override void Dispose()
{

View File

@@ -15,17 +15,46 @@ namespace Apollon.WPF.ViewModels
public OverviewListingViewModel OverviewListingViewModel { get; }
public OverviewDetailsViewModel OverviewDetailsViewModel{ get; }
private bool _isLoading;
public bool IsLoading
{
get
{
return IsLoading;
}
set
{
_isLoading = value;
OnPropertyChanged(nameof(IsLoading));
}
}
public ICommand AddTournamentCommand { get; }
public ICommand LoadTournamentsCommand { get; }
public ICommand NavigateNavBarCommand { get; }
public OverviewViewModel(TournamentsStore tournamentStore, SelectedTournamentsStore selectedTournamentStore, ModalNavigationStore modalNavigationStore, NavigationStore navigationStore)
public OverviewViewModel(TournamentsStore tournamentStore, SelectedTournamentsStore selectedTournamentStore,
ModalNavigationStore modalNavigationStore, NavigationStore navigationStore)
{
OverviewListingViewModel = OverviewListingViewModel.LoadViewModel(selectedTournamentStore, modalNavigationStore, tournamentStore);
OverviewListingViewModel = new OverviewListingViewModel(selectedTournamentStore, modalNavigationStore, tournamentStore);
OverviewDetailsViewModel = new OverviewDetailsViewModel(selectedTournamentStore);
LoadTournamentsCommand = new LoadTournamentsCommand(this, tournamentStore);
AddTournamentCommand = new OpenAddTournamentCommand(tournamentStore, modalNavigationStore);
NavigateNavBarCommand = new NavigatCommand<NavBarViewModel>(navigationStore, () => new NavBarViewModel(navigationStore));
}
public static OverviewViewModel LoadViewModel(SelectedTournamentsStore selectedTournamentStore,
ModalNavigationStore modalNavigationStore,
TournamentsStore tournamentStore,
NavigationStore navigationStore)
{
OverviewViewModel viewModel = new OverviewViewModel(tournamentStore, selectedTournamentStore, modalNavigationStore, navigationStore);
viewModel.LoadTournamentsCommand.Execute(null);
return viewModel;
}
}
}