From 37e003f0e476b754447208e353dd83cee35ba463 Mon Sep 17 00:00:00 2001 From: Darkstack <1835601+darkstack@users.noreply.github.com> Date: Thu, 30 May 2019 01:03:42 +0200 Subject: [PATCH] Quick tournament points viewer --- .../ViewModels/TournamentResultViewModel.cs | 20 ++++++++++++++++--- .../Views/TournamentResultView.xaml | 16 +++++++++++++-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/LaDOSE.Src/LaDOSE.DesktopApp/ViewModels/TournamentResultViewModel.cs b/LaDOSE.Src/LaDOSE.DesktopApp/ViewModels/TournamentResultViewModel.cs index 7671aff..ed44a9d 100644 --- a/LaDOSE.Src/LaDOSE.DesktopApp/ViewModels/TournamentResultViewModel.cs +++ b/LaDOSE.Src/LaDOSE.DesktopApp/ViewModels/TournamentResultViewModel.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using Caliburn.Micro; +using LaDOSE.DesktopApp.Utils; using LaDOSE.DTO; using LaDOSE.REST; @@ -23,7 +24,7 @@ namespace LaDOSE.DesktopApp.ViewModels Tournaments = new List(); } - private ObservableCollection _selectedTournaments; + private TournamentsResultDTO _results; public List Tournaments { get; set; } @@ -36,7 +37,7 @@ namespace LaDOSE.DesktopApp.ViewModels NotifyOfPropertyChange(() => Results); } } - + private ObservableCollection _selectedTournaments; public ObservableCollection SelectedTournaments { get { return _selectedTournaments; } @@ -49,6 +50,7 @@ namespace LaDOSE.DesktopApp.ViewModels private GameDTO _selectedGame; + public GameDTO SelectedGame { get { return _selectedGame; } @@ -56,11 +58,23 @@ namespace LaDOSE.DesktopApp.ViewModels { _selectedGame = value; //TODO: QUICK AND DIRTY - var resultForGame = this.Results.Results.Where(e => e.GameId == SelectedGame.Id).ToList(); + List resultForGame = this.Results.Results.Where(e => e.GameId == SelectedGame.Id).ToList(); First = resultForGame.OrderByDescending(e=>e.Point).First().Player; + SelectedGameResult = new ObservableCollection(resultForGame); NotifyOfPropertyChange(() => SelectedGame); } } + private ObservableCollection _selectedGameResult; + public ObservableCollection SelectedGameResult + { + get { return _selectedGameResult; } + set + { + _selectedGameResult = value; + NotifyOfPropertyChange(() => SelectedGameResult); + } + } + private String _first; public String First { diff --git a/LaDOSE.Src/LaDOSE.DesktopApp/Views/TournamentResultView.xaml b/LaDOSE.Src/LaDOSE.DesktopApp/Views/TournamentResultView.xaml index fac08d9..b08f652 100644 --- a/LaDOSE.Src/LaDOSE.DesktopApp/Views/TournamentResultView.xaml +++ b/LaDOSE.Src/LaDOSE.DesktopApp/Views/TournamentResultView.xaml @@ -89,8 +89,20 @@ First : - - Second : + + Result : + + + + + + + + + + +