Ready built Tournament Tracker
This commit is contained in:
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TrackerLibrary;
|
||||
using TrackerLibrary.Models;
|
||||
|
||||
namespace TrackerWPFUI.ViewModels
|
||||
@ -12,6 +13,7 @@ namespace TrackerWPFUI.ViewModels
|
||||
{
|
||||
public TournamentModel Tournament { get; set; }
|
||||
|
||||
private string _tournamentName;
|
||||
private BindableCollection<int> _rounds = new BindableCollection<int>();
|
||||
private BindableCollection<MatchupModel> _matchups = new BindableCollection<MatchupModel>();
|
||||
private bool _unplayedOnly;
|
||||
@ -22,16 +24,24 @@ namespace TrackerWPFUI.ViewModels
|
||||
private MatchupModel _selectedMatchup;
|
||||
private int _selectedRound = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public TournamentViewerViewModel(TournamentModel model)
|
||||
{
|
||||
Tournament = model;
|
||||
TournamentName = model.TournamentName;
|
||||
LoadRounds();
|
||||
}
|
||||
|
||||
public string TournamentName
|
||||
{
|
||||
get {
|
||||
return $"Tournament: {_tournamentName}" ;
|
||||
}
|
||||
set { _tournamentName = value;
|
||||
NotifyOfPropertyChange(() => TournamentName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int SelectedRound
|
||||
{
|
||||
get { return _selectedRound; }
|
||||
@ -103,15 +113,12 @@ namespace TrackerWPFUI.ViewModels
|
||||
set { _matchups = value; }
|
||||
}
|
||||
|
||||
|
||||
public BindableCollection<int> Rounds
|
||||
{
|
||||
get { return _rounds; }
|
||||
set { _rounds = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void LoadRounds()
|
||||
{
|
||||
Rounds.Clear();
|
||||
@ -201,6 +208,42 @@ namespace TrackerWPFUI.ViewModels
|
||||
//}
|
||||
}
|
||||
|
||||
public void ScoreMatch()
|
||||
{
|
||||
|
||||
for (int i = 0; i < SelectedMatchup.Entries.Count; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
if (SelectedMatchup.Entries[0].TeamCompeting != null)
|
||||
{
|
||||
SelectedMatchup.Entries[0].Score = TeamOneScore;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
if (SelectedMatchup.Entries[1].TeamCompeting != null)
|
||||
{
|
||||
|
||||
SelectedMatchup.Entries[1].Score = TeamTwoScore;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
TournamentLogic.UpdateTournamentResults(Tournament);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Windows.MessageBox.Show($"The application had the following error :{ex.Message}");
|
||||
return;
|
||||
}
|
||||
|
||||
LoadMatchups();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user