public MainMenu()
        {
            InitializeComponent();
            TeamDataParser   td = new TeamDataParser();
            LeagueDataParser ld;
            DateTime         CurrentDate = DateTime.Today;

            DateString.Text = "Today's Date: " + CurrentDate.Month + "-" + CurrentDate.Day + "-" + CurrentDate.Year;
            int WeekNum = 0;

            if (File.Exists("leaguerules.xml"))
            {
                leagueButton.Content = "Manage League";

                ld               = new LeagueDataParser("leaguerules.xml");
                WeekNum          = ld.GetWeekNumber(CurrentDate);
                DateString.Text += "\nWeek " + WeekNum + " of current League";
            }
            else
            {
                leagueButton.Content = "Setup League";
            }

            teamString.Text = td.GetTeams()[0].ToString();
        }
        public LeagueRules()
        {
            LeagueDataParser ldp = new LeagueDataParser("leaguerules.xml");
            League game = ldp.StoredRules;
            InitializeComponent();

            String teamR = "error reading rules";
            String seasonR = "seriously, there's a problem";

            String mm;
            if (game.MutualMatching)
                mm = "Yes";
            else mm = "No";

            //team size, extras, x teams player is on, mutual match
            teamR = "Team Size: " + game.MembersPerTeam +
                    "\nExtras on team: " + game.ExtrasPerTeam +
                    "\nMutual Matching: " + mm +
                    "\nPlayer Recurrence: " + game.SimultaneousTeams;

            String gd;
            if (game.GameNight == 0)
                gd = "Thursday";
            else if (game.GameNight == 1)
                gd = "Sunday";
            else gd = "Monday";

            String tsb;
            if (game.TeamSuperbowl)
                tsb = "Yes";
            else tsb = "No";

            //game night, playoff size, bowl project, season duration, break duration
            //Season End needs work, -does start date mean first game that night or not?
            seasonR = "Game Night: " + gd +
                        "\nDraft Day: " + game.DraftTime.Date.ToString("d") +
                        "\nSeason Start: " + game.SeasonStart.Date.ToString("d") +
                        "\nSeason End: " + game.SeasonStart.AddDays((game.SeasonWeeks-1) * 7).Date.ToString("d") +
                        "\nTeams in Playoffs: " + game.PlayoffTeams +
                        "\nPlayoff Start: " + game.PlayoffStart.Date.ToString("d") +
                        "\nSuperbowl Project: " + tsb;

            teamRules.Text = teamR;
            seasonRules.Text = seasonR;

            //IMPLEMENT CALENDAR STUFF
            //draft day, season play, game days, playoffs, playoff break
     
            calendar.SelectedDates.Add(game.SeasonStart);
            for(int i = 1; i < game.SeasonWeeks; i++)
            {
                calendar.SelectedDates.Add(game.SeasonStart.AddDays(i * 7));
            }
            for(int i = 0; i < game.PlayoffWeeks; i++)
            {
                calendar.SelectedDates.Add(game.PlayoffStart.AddDays(i * 7));
            }
        }
        public MainMenu()
        {
            InitializeComponent();
            TeamDataParser td = new TeamDataParser();
            LeagueDataParser ld;
            DateTime CurrentDate = DateTime.Today;
            DateString.Text = "Today's Date: " + CurrentDate.Month + "-" + CurrentDate.Day + "-" + CurrentDate.Year;
            int WeekNum = 0;

            if (File.Exists("leaguerules.xml"))
            {
                leagueButton.Content = "Manage League";

                ld = new LeagueDataParser("leaguerules.xml");
                WeekNum = ld.GetWeekNumber(CurrentDate);
                DateString.Text += "\nWeek " + WeekNum + " of current League";
            }
            else
            {
                leagueButton.Content = "Setup League";
            }

            teamString.Text = td.GetTeams()[0].ToString();
        }
        public SetupScreen()
        {
            ldp = new LeagueDataParser("leaguerules.xml");
            //lg = ldp.StoredRules;
            InitializeComponent();

            if (ldp.initialized)
                done.Content = "Apply Changes";
            else
                done.Content = "Start League";
				
			//done.Content = "Start League";

           
			cb_teamSize.Items.Add(1);
			cb_teamSize.Items.Add(2);
			cb_teamSize.Items.Add(3);
			cb_teamSize.Items.Add(4);
			cb_teamSize.Items.Add(5);
			cb_teamSize.Items.Add(6);
            cb_teamSize.SelectedValue = ldp.StoredRules.MembersPerTeam;
			cb_teamSize.SelectionChanged +=  TeamSize_SelectionChanged;
			
			cb_teamExtra.Items.Add(0);
			cb_teamExtra.Items.Add(1);
			cb_teamExtra.Items.Add(2);
            cb_teamExtra.SelectedValue = ldp.StoredRules.ExtrasPerTeam;
			cb_teamExtra.SelectionChanged += TeamExtras_SelectionChanged;
			
			cb_gameNight.Items.Add("Sunday");
			cb_gameNight.Items.Add("Monday");
			cb_gameNight.Items.Add("Tuesday");
			cb_gameNight.Items.Add("Wednesday");
			cb_gameNight.Items.Add("Thursday");
			cb_gameNight.Items.Add("Friday");
			cb_gameNight.Items.Add("Saturday");
            byte gnight = ldp.StoredRules.GameNight;
            switch(gnight)
            {
                case 0:
                    cb_gameNight.SelectedValue = "Thursday";
                    break;
                case 1:
                    cb_gameNight.SelectedValue = "Sunday";
                    break;
                case 2:
                    cb_gameNight.SelectedValue = "Monday";
                    break;
                case 3:
                    cb_gameNight.SelectedValue = "Tuesday";
                    break;
                case 4:
                    cb_gameNight.SelectedValue = "Wednesday";
                    break;
                case 5:
                    cb_gameNight.SelectedValue = "Friday";
                    break;
                case 6:
                    cb_gameNight.SelectedValue = "Saturday";
                    break;
            }
			cb_gameNight.SelectionChanged += GameNight_SelectionChanged;
			
			cb_playerExclusive.Items.Add(1);
			cb_playerExclusive.Items.Add(2);
			cb_playerExclusive.Items.Add(3);
            cb_playerExclusive.SelectedValue = (int)ldp.StoredRules.SimultaneousTeams;
			cb_playerExclusive.SelectionChanged += PlayerExclusivity_SelectionChanged;
			
			cb_playoffSize.Items.Add(4);
			cb_playoffSize.Items.Add(8);
			cb_playoffSize.Items.Add(16);
            cb_playoffSize.SelectedValue = (int)ldp.StoredRules.PlayoffTeams;
			cb_playoffSize.SelectionChanged += PlayoffSize_SelectionChanged;
			
			for(int n = 1; n<=52; n++)
			{	
				cb_seasonDuration.Items.Add(n);
			}
            TimeSpan t = ldp.StoredRules.SeasonEnd - ldp.StoredRules.SeasonStart;
            cb_seasonDuration.SelectedValue = (int)(t.TotalDays/7);
			cb_seasonDuration.SelectionChanged += SeasonDuration_SelectionChanged;
			
			cb_playoffBreak.Items.Add(0);
			cb_playoffBreak.Items.Add(1);
			cb_playoffBreak.Items.Add(2);
			cb_playoffBreak.Items.Add(3);
			cb_playoffBreak.Items.Add(4);
			cb_playoffBreak.Items.Add(5);

            t = ldp.StoredRules.SeasonEnd - ldp.StoredRules.PlayoffStart;
            cb_playoffBreak.SelectedValue = (int)(t.TotalDays / 7);
			cb_playoffBreak.SelectionChanged += PlayoffBreak_SelectionChanged;
            breakSelected = true;

            dp_seasonStartDate.SelectedDate = ldp.StoredRules.SeasonStart;
			dp_seasonStartDate.SelectedDateChanged += StartDate_SelectionChanged;
            startSelected = true;

            dp_draftDate.SelectedDate = ldp.StoredRules.DraftTime;
			dp_draftDate.SelectedDateChanged += DraftDay_SelectionChanged;

            rb_mutualMatchYes.IsChecked = ldp.StoredRules.MutualMatching;
            rb_mutualMatchNo.IsChecked = !ldp.StoredRules.MutualMatching;
			rb_mutualMatchYes.Checked += MutualMatching_SelectionChanged;

            rb_superbowlYes.IsChecked = ldp.StoredRules.TeamSuperbowl;
            rb_superbowlNo.IsChecked = !ldp.StoredRules.TeamSuperbowl;
			rb_superbowlYes.Checked += Superbowl_SelectionChanged;
        }
        public TournamentBracket()
        {
            teamParser = new TeamDataParser();
            teamList   = teamParser.GetTeams();

            leagueParser = new LeagueDataParser("leaguerules.xml");
            NumTeams     = leagueParser.StoredRules.PlayoffTeams;

            CurrentDate = DateTime.Today;
            WeekNum     = leagueParser.GetWeekNumber(CurrentDate);

            DetermineTeams();   //Determines which teams made playoffs, takes top 4/8/16 teams at the start of the playoffs and puts them in playoffTeamList

            InitializeComponent();

//Fill in initial playoff standings (week 1)
            DataGridTextColumn round1 = new DataGridTextColumn();

            round1.Header = "Round 1";
            bracketGrid1.Columns.Add(round1);

            TimeSincePlayoffStart = CurrentDate - leagueParser.StoredRules.PlayoffStart;
            DaysSincePlayoffStart = TimeSincePlayoffStart.Days;

            //int row = 0;
            for (int t = 0; t < playoffTeamList.Count; t++)
            {
                bracketGrid1.Items.Add(playoffTeamList[t].TeamName);

                if (t % 2 == 0) //every even indexed team should be versus someone and every odd indexed team should have a blank spot between it and the next matchup
                {
                    bracketGrid1.Items.Add("vs");
                }
                else
                {
                    bracketGrid1.Items.Add("");
                }
            }

//Fill in playoff standings after 1 week (week2)
            if (DaysSincePlayoffStart >= 7 && DaysSincePlayoffStart < 14)
            {
                DataGridTextColumn round2 = new DataGridTextColumn();
                round2.Header = "Round 2";
                bracketGrid2.Columns.Add(round2);

                //List<Team> tempList = playoffTeamList;
                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        //tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid2.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum))
                    {
                        //tempList.Remove(playoffTeamList[t]);

                        bracketGrid2.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                }
            }

//Fill in playoff standings after 2 weeks (up to week 3)
            else if (DaysSincePlayoffStart >= 14 && DaysSincePlayoffStart < 21)
            {
                DataGridTextColumn round2 = new DataGridTextColumn();
                round2.Header = "Round 2";
                bracketGrid2.Columns.Add(round2);

                List <Team> tempList = playoffTeamList;

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum - 1) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 1)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid2.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum - 1) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 1))
                    {
                        tempList.Remove(playoffTeamList[t]);

                        bracketGrid2.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                }
                playoffTeamList = tempList;

                DataGridTextColumn round3 = new DataGridTextColumn();
                round3.Header = "Round 3";
                bracketGrid3.Columns.Add(round3);

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        //tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid3.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid3.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid3.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum))
                    {
                        //tempList.Remove(playoffTeamList[t]);

                        bracketGrid3.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid3.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid3.Items.Add("");
                        }
                    }
                }
            }
//Fill in playoff standings after 3 weeks (up to week 4) (should only display if there are 8 or more teams)
            else if (DaysSincePlayoffStart >= 21 && DaysSincePlayoffStart < 28 && NumTeams >= 8)
            {
                DataGridTextColumn round2 = new DataGridTextColumn();
                round2.Header = "Round 2";
                bracketGrid2.Columns.Add(round2);

                List <Team> tempList = playoffTeamList;

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum - 2) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 2)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid2.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum - 2) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 2))
                    {
                        tempList.Remove(playoffTeamList[t]);

                        bracketGrid2.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                }
                playoffTeamList = tempList;

                DataGridTextColumn round3 = new DataGridTextColumn();
                round3.Header = "Round 3";
                bracketGrid3.Columns.Add(round3);

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum - 1) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 1)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid3.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid3.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid3.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum - 1) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 1))
                    {
                        tempList.Remove(playoffTeamList[t]);

                        bracketGrid3.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid3.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid3.Items.Add("");
                        }
                    }
                }
                playoffTeamList = tempList;

                DataGridTextColumn round4 = new DataGridTextColumn();
                round4.Header = "Round 4";
                bracketGrid4.Columns.Add(round4);

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        //tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid4.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid4.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid4.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum))
                    {
                        //tempList.Remove(playoffTeamList[t]);

                        bracketGrid4.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid4.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid4.Items.Add("");
                        }
                    }
                }
            }
//Fill in playoff standings after 4 weeks (week 5) (should only display if there are 16 or more teams)
//(also last possible display since the max number of playoff weeks is 16 currently)
            else if (DaysSincePlayoffStart >= 28 && NumTeams >= 16)
            {
                DataGridTextColumn round2 = new DataGridTextColumn();
                round2.Header = "Round 2";
                bracketGrid2.Columns.Add(round2);

                List <Team> tempList = playoffTeamList;

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum - 3) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 3)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid2.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum - 3) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 3))
                    {
                        tempList.Remove(playoffTeamList[t]);

                        bracketGrid2.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                }
                playoffTeamList = tempList;

                DataGridTextColumn round3 = new DataGridTextColumn();
                round3.Header = "Round 3";
                bracketGrid3.Columns.Add(round3);

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum - 2) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 2)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid3.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid3.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid3.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum - 2) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 2))
                    {
                        tempList.Remove(playoffTeamList[t]);

                        bracketGrid3.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid3.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid3.Items.Add("");
                        }
                    }
                }
                playoffTeamList = tempList;

                DataGridTextColumn round4 = new DataGridTextColumn();
                round4.Header = "Round 4";
                bracketGrid4.Columns.Add(round4);

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum - 1) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 1)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid4.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid4.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid4.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum - 1) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 1))
                    {
                        tempList.Remove(playoffTeamList[t]);

                        bracketGrid4.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid4.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid4.Items.Add("");
                        }
                    }
                }
                playoffTeamList = tempList;

                DataGridTextColumn round5 = new DataGridTextColumn();
                round5.Header = "Round 5";
                bracketGrid5.Columns.Add(round5);

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        //tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid4.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid4.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid4.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum))
                    {
                        //tempList.Remove(playoffTeamList[t]);

                        bracketGrid4.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid4.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid4.Items.Add("");
                        }
                    }
                }
            }
        }
        public Leaderboard()
        {
            TeamDataParser  teamParser   = new TeamDataParser();
            List <Team>     teamList     = teamParser.GetTeams();
            List <Employee> employeeList = new List <Employee>();

            ldp              = new LeagueDataParser("leaguerules.xml");
            displayedTeams   = new List <TeamsData>();
            displayedPlayers = new List <PlayersData>();
            game             = ldp.StoredRules;
            Trace.WriteLine("Playoff weeks: " + game.PlayoffWeeks + " Season weeks: " + game.SeasonWeeks);
            foreach (Team t in teamList)
            {
                employeeList.AddRange(t.Members);
            }

            employeeList.Sort();



            InitializeComponent();
            DataGridTextColumn tCol1 = new DataGridTextColumn();
            DataGridTextColumn tCol2 = new DataGridTextColumn();
            DataGridTextColumn tCol3 = new DataGridTextColumn();
            DataGridTextColumn tCol4 = new DataGridTextColumn();

            teamsDataGrid.Columns.Add(tCol1);
            teamsDataGrid.Columns.Add(tCol2);
            teamsDataGrid.Columns.Add(tCol3);
            teamsDataGrid.Columns.Add(tCol4);
            tCol1.Binding = new Binding("teamRank");
            tCol2.Binding = new Binding("teamName");
            tCol3.Binding = new Binding("teamScore");
            tCol4.Binding = new Binding("teamProgress");
            tCol1.Header  = "Rank";
            tCol2.Header  = "Team Name";
            tCol3.Header  = "Score";
            tCol4.Header  = "Progress";

            DataGridTextColumn pCol1 = new DataGridTextColumn();
            DataGridTextColumn pCol2 = new DataGridTextColumn();
            DataGridTextColumn pCol3 = new DataGridTextColumn();
            DataGridTextColumn pCol4 = new DataGridTextColumn();

            playersDataGrid.Columns.Add(pCol1);
            playersDataGrid.Columns.Add(pCol2);
            playersDataGrid.Columns.Add(pCol3);
            playersDataGrid.Columns.Add(pCol4);
            pCol1.Binding = new Binding("playerRank");
            pCol2.Binding = new Binding("playerName");
            pCol3.Binding = new Binding("playerScore");
            pCol4.Binding = new Binding("playerProgress");
            pCol1.Header  = "Rank";
            pCol2.Header  = "Player Name";
            pCol3.Header  = "Score";
            pCol4.Header  = "Progress";

            for (int j = 0; j < teamList.Count; j++)
            {
                if (teamList[j].TeamName != "Free Agents")
                {
                    teamList[j].SubCheck(weeks);
                    teamsDataGrid.Items.Add(
                        new TeamsData
                    {
                        teamRank     = j,
                        teamName     = teamList[j].TeamName,
                        teamScore    = teamList[j].GetTotalForWeek(weeks),
                        teamProgress = "+" + teamList[j].GetPointsGainedForWeek(weeks),
                        hostTeam     = teamList[j]
                    });
                    displayedTeams.Add(
                        new TeamsData
                    {
                        teamRank     = j + 1,
                        teamName     = teamList[j].TeamName,
                        teamScore    = teamList[j].GetTotalForWeek(weeks),
                        teamProgress = "+" + teamList[j].GetPointsGainedForWeek(weeks),
                        hostTeam     = teamList[j]
                    });
                }
            }
            teamsDataGrid.Items.Remove(teamsDataGrid.Items[0]);

            for (int k = 0; k < employeeList.Count; k++)
            {
                playersDataGrid.Items.Add(
                    new PlayersData {
                    playerRank     = (k + 1),
                    playerName     = employeeList[k].GetName(),
                    playerScore    = employeeList[k].GetPoints(),
                    playerProgress = "+" + employeeList[k].GetScoreOfWeek(weeks),
                    hostEmp        = employeeList[k]
                });
                displayedPlayers.Add(
                    new PlayersData
                {
                    playerRank     = (k + 1),
                    playerName     = employeeList[k].GetName(),
                    playerScore    = employeeList[k].GetPoints(),
                    playerProgress = "+" + employeeList[k].GetScoreOfWeek(weeks),
                    hostEmp        = employeeList[k]
                });
            }
            playersDataGrid.Items.Remove(playersDataGrid.Items[0]);

            vL1.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL2.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL3.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL4.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL5.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL6.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL7.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL8.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL9.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL10.Add(new KeyValuePair <string, int>("Week 1", 0));
        }
示例#7
0
        public SetupScreen()
        {
            ldp = new LeagueDataParser("leaguerules.xml");
            //lg = ldp.StoredRules;
            InitializeComponent();

            if (ldp.initialized)
            {
                done.Content = "Apply Changes";
            }
            else
            {
                done.Content = "Start League";
            }

            //done.Content = "Start League";


            cb_teamSize.Items.Add(1);
            cb_teamSize.Items.Add(2);
            cb_teamSize.Items.Add(3);
            cb_teamSize.Items.Add(4);
            cb_teamSize.Items.Add(5);
            cb_teamSize.Items.Add(6);
            cb_teamSize.SelectedValue     = ldp.StoredRules.MembersPerTeam;
            cb_teamSize.SelectionChanged += TeamSize_SelectionChanged;

            cb_teamExtra.Items.Add(0);
            cb_teamExtra.Items.Add(1);
            cb_teamExtra.Items.Add(2);
            cb_teamExtra.SelectedValue     = ldp.StoredRules.ExtrasPerTeam;
            cb_teamExtra.SelectionChanged += TeamExtras_SelectionChanged;

            cb_gameNight.Items.Add("Sunday");
            cb_gameNight.Items.Add("Monday");
            cb_gameNight.Items.Add("Tuesday");
            cb_gameNight.Items.Add("Wednesday");
            cb_gameNight.Items.Add("Thursday");
            cb_gameNight.Items.Add("Friday");
            cb_gameNight.Items.Add("Saturday");
            byte gnight = ldp.StoredRules.GameNight;

            switch (gnight)
            {
            case 0:
                cb_gameNight.SelectedValue = "Thursday";
                break;

            case 1:
                cb_gameNight.SelectedValue = "Sunday";
                break;

            case 2:
                cb_gameNight.SelectedValue = "Monday";
                break;

            case 3:
                cb_gameNight.SelectedValue = "Tuesday";
                break;

            case 4:
                cb_gameNight.SelectedValue = "Wednesday";
                break;

            case 5:
                cb_gameNight.SelectedValue = "Friday";
                break;

            case 6:
                cb_gameNight.SelectedValue = "Saturday";
                break;
            }
            cb_gameNight.SelectionChanged += GameNight_SelectionChanged;

            cb_playerExclusive.Items.Add(1);
            cb_playerExclusive.Items.Add(2);
            cb_playerExclusive.Items.Add(3);
            cb_playerExclusive.SelectedValue     = (int)ldp.StoredRules.SimultaneousTeams;
            cb_playerExclusive.SelectionChanged += PlayerExclusivity_SelectionChanged;

            cb_playoffSize.Items.Add(4);
            cb_playoffSize.Items.Add(8);
            cb_playoffSize.Items.Add(16);
            cb_playoffSize.SelectedValue     = (int)ldp.StoredRules.PlayoffTeams;
            cb_playoffSize.SelectionChanged += PlayoffSize_SelectionChanged;

            for (int n = 1; n <= 52; n++)
            {
                cb_seasonDuration.Items.Add(n);
            }
            TimeSpan t = ldp.StoredRules.SeasonEnd - ldp.StoredRules.SeasonStart;

            cb_seasonDuration.SelectedValue     = (int)(t.TotalDays / 7);
            cb_seasonDuration.SelectionChanged += SeasonDuration_SelectionChanged;

            cb_playoffBreak.Items.Add(0);
            cb_playoffBreak.Items.Add(1);
            cb_playoffBreak.Items.Add(2);
            cb_playoffBreak.Items.Add(3);
            cb_playoffBreak.Items.Add(4);
            cb_playoffBreak.Items.Add(5);

            t = ldp.StoredRules.SeasonEnd - ldp.StoredRules.PlayoffStart;
            cb_playoffBreak.SelectedValue     = (int)(t.TotalDays / 7);
            cb_playoffBreak.SelectionChanged += PlayoffBreak_SelectionChanged;
            breakSelected = true;

            dp_seasonStartDate.SelectedDate         = ldp.StoredRules.SeasonStart;
            dp_seasonStartDate.SelectedDateChanged += StartDate_SelectionChanged;
            startSelected = true;

            dp_draftDate.SelectedDate         = ldp.StoredRules.DraftTime;
            dp_draftDate.SelectedDateChanged += DraftDay_SelectionChanged;

            rb_mutualMatchYes.IsChecked = ldp.StoredRules.MutualMatching;
            rb_mutualMatchNo.IsChecked  = !ldp.StoredRules.MutualMatching;
            rb_mutualMatchYes.Checked  += MutualMatching_SelectionChanged;

            rb_superbowlYes.IsChecked = ldp.StoredRules.TeamSuperbowl;
            rb_superbowlNo.IsChecked  = !ldp.StoredRules.TeamSuperbowl;
            rb_superbowlYes.Checked  += Superbowl_SelectionChanged;
        }
        public Leaderboard()
        {
            
			TeamDataParser teamParser = new TeamDataParser();
			List<Team> teamList = teamParser.GetTeams();
			List<Employee> employeeList = new List<Employee>();
            ldp = new LeagueDataParser("leaguerules.xml");
            displayedTeams = new List<TeamsData>();
            displayedPlayers = new List<PlayersData>();
            game = ldp.StoredRules;
            Trace.WriteLine("Playoff weeks: " + game.PlayoffWeeks + " Season weeks: " + game.SeasonWeeks);
			foreach(Team t in teamList)
			{
				employeeList.AddRange(t.Members);
			}
			
			employeeList.Sort();

            

            InitializeComponent();
            DataGridTextColumn tCol1 = new DataGridTextColumn();
            DataGridTextColumn tCol2 = new DataGridTextColumn();
            DataGridTextColumn tCol3 = new DataGridTextColumn();
			DataGridTextColumn tCol4 = new DataGridTextColumn();
            teamsDataGrid.Columns.Add(tCol1);
            teamsDataGrid.Columns.Add(tCol2);
            teamsDataGrid.Columns.Add(tCol3);
			teamsDataGrid.Columns.Add(tCol4);
            tCol1.Binding = new Binding("teamRank");
            tCol2.Binding = new Binding("teamName");
            tCol3.Binding = new Binding("teamScore");
			tCol4.Binding = new Binding("teamProgress");
            tCol1.Header = "Rank";
            tCol2.Header = "Team Name";
            tCol3.Header = "Score";
			tCol4.Header = "Progress";
			
			DataGridTextColumn pCol1 = new DataGridTextColumn();
			DataGridTextColumn pCol2 = new DataGridTextColumn();
			DataGridTextColumn pCol3 = new DataGridTextColumn();
			DataGridTextColumn pCol4 = new DataGridTextColumn();
			playersDataGrid.Columns.Add(pCol1);
			playersDataGrid.Columns.Add(pCol2);
			playersDataGrid.Columns.Add(pCol3);
			playersDataGrid.Columns.Add(pCol4);
			pCol1.Binding = new Binding("playerRank");
			pCol2.Binding = new Binding("playerName");
			pCol3.Binding = new Binding("playerScore");
			pCol4.Binding = new Binding("playerProgress");
			pCol1.Header = "Rank";
			pCol2.Header = "Player Name";
			pCol3.Header = "Score";
			pCol4.Header = "Progress";
			
			for(int j = 0; j<teamList.Count; j++)
			{
                if (teamList[j].TeamName != "Free Agents")
                {
                    teamList[j].SubCheck(weeks);
                    teamsDataGrid.Items.Add(
                        new TeamsData
                        {
                            teamRank = j,
                            teamName = teamList[j].TeamName,
                            teamScore = teamList[j].GetTotalForWeek(weeks),
                            teamProgress = "+" + teamList[j].GetPointsGainedForWeek(weeks),
                            hostTeam = teamList[j]
                        });
                    displayedTeams.Add(
                        new TeamsData
                        {
                            teamRank = j + 1,
                            teamName = teamList[j].TeamName,
                            teamScore = teamList[j].GetTotalForWeek(weeks),
                            teamProgress = "+" + teamList[j].GetPointsGainedForWeek(weeks),
                            hostTeam = teamList[j]
                        });
                }
			}
            teamsDataGrid.Items.Remove(teamsDataGrid.Items[0]);

			for(int k = 0; k<employeeList.Count; k++)
			{
				playersDataGrid.Items.Add(
                    new PlayersData{
                        playerRank = (k+1), 
                        playerName = employeeList[k].GetName(), 
                        playerScore = employeeList[k].GetPoints(), 
                        playerProgress = "+"+employeeList[k].GetScoreOfWeek(weeks),
                        hostEmp = employeeList[k]});
                displayedPlayers.Add(
                        new PlayersData
                        {
                            playerRank = (k + 1),
                            playerName = employeeList[k].GetName(),
                            playerScore = employeeList[k].GetPoints(),
                            playerProgress = "+" + employeeList[k].GetScoreOfWeek(weeks),
                            hostEmp = employeeList[k]
                        });
			}
            playersDataGrid.Items.Remove(playersDataGrid.Items[0]);

            vL1.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL2.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL3.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL4.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL5.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL6.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL7.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL8.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL9.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL10.Add(new KeyValuePair<string, int>("Week 1", 0));
        
        }
示例#9
0
        public LeagueRules()
        {
            LeagueDataParser ldp  = new LeagueDataParser("leaguerules.xml");
            League           game = ldp.StoredRules;

            InitializeComponent();

            String teamR   = "error reading rules";
            String seasonR = "seriously, there's a problem";

            String mm;

            if (game.MutualMatching)
            {
                mm = "Yes";
            }
            else
            {
                mm = "No";
            }

            //team size, extras, x teams player is on, mutual match
            teamR = "Team Size: " + game.MembersPerTeam +
                    "\nExtras on team: " + game.ExtrasPerTeam +
                    "\nMutual Matching: " + mm +
                    "\nPlayer Recurrence: " + game.SimultaneousTeams;

            String gd;

            if (game.GameNight == 0)
            {
                gd = "Thursday";
            }
            else if (game.GameNight == 1)
            {
                gd = "Sunday";
            }
            else
            {
                gd = "Monday";
            }

            String tsb;

            if (game.TeamSuperbowl)
            {
                tsb = "Yes";
            }
            else
            {
                tsb = "No";
            }

            //game night, playoff size, bowl project, season duration, break duration
            //Season End needs work, -does start date mean first game that night or not?
            seasonR = "Game Night: " + gd +
                      "\nDraft Day: " + game.DraftTime.Date.ToString("d") +
                      "\nSeason Start: " + game.SeasonStart.Date.ToString("d") +
                      "\nSeason End: " + game.SeasonStart.AddDays((game.SeasonWeeks - 1) * 7).Date.ToString("d") +
                      "\nTeams in Playoffs: " + game.PlayoffTeams +
                      "\nPlayoff Start: " + game.PlayoffStart.Date.ToString("d") +
                      "\nSuperbowl Project: " + tsb;

            teamRules.Text   = teamR;
            seasonRules.Text = seasonR;

            //IMPLEMENT CALENDAR STUFF
            //draft day, season play, game days, playoffs, playoff break

            calendar.SelectedDates.Add(game.SeasonStart);
            for (int i = 1; i < game.SeasonWeeks; i++)
            {
                calendar.SelectedDates.Add(game.SeasonStart.AddDays(i * 7));
            }
            for (int i = 0; i < game.PlayoffWeeks; i++)
            {
                calendar.SelectedDates.Add(game.PlayoffStart.AddDays(i * 7));
            }
        }