/// <summary>
 /// Initializes a new instance of the Tennis_Management_Software.Tournament.TournamentCreatorForm class.
 /// </summary>
 public TournamentCreatorForm()
 {
     InitializeComponent();
     filepathToSave     = string.Empty;
     changesSaved       = false;
     tournamentSettings = new TournamentSettings();
 }
        /// <summary>
        /// Loads the tournament.
        /// </summary>
        /// <param name="filepath"></param>
        public void LoadTournament(string filepath)
        {
            if (System.IO.File.Exists(filepath))
            {
                //Setting the title of the form
                this.Text = filepath.Substring(filepath.LastIndexOf('\\') + 1, filepath.Length - filepath.LastIndexOf('.') - 1) + " - Tournament";

                filepathToSave = filepath;
                changesSaved   = true;

                tournamentSettings = Serialization.Deserialize <TournamentSettings>(filepath);
                DrawLayout(tournamentSettings.NumberOfPersons);

                if (tournamentSettings.TournamentStarted)
                {
                    startTournamentToolStripMenuItem.Enabled = false;
                }
                else
                {
                    foreach (Cell cell in CellList2D[0])
                    {
                        cell.MouseClick += cell_MouseClick;
                    }
                }

                int subscriberCounter = 0;

                for (int i = 0; i < CellList2D.Count; i++)
                {
                    for (int j = 0; j < CellList2D[i].Count; j++)
                    {
                        CellList2D[i][j].SetText(tournamentSettings.cellText[i][j]);

                        if (tournamentSettings.TournamentStarted && tournamentSettings.SubscribedToDoubleClick[subscriberCounter])
                        {
                            CellList2D[i][j].MouseDoubleClick += cell_MouseDoubleClick;
                        }

                        subscriberCounter++;
                    }
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the Tennis_Management_Software.Tournament.TournamentCreatorForm class.
        /// </summary>
        /// <param name="personNum"></param>
        public TournamentCreatorForm(int personNum)
        {
            InitializeComponent();
            filepathToSave     = string.Empty;
            changesSaved       = true;
            tournamentSettings = new TournamentSettings();
            int numOfCells = personNum + (personNum - 1);

            tournamentSettings.NumberOfPersons = personNum;

            for (int i = 0; i < numOfCells; i++)
            {
                tournamentSettings.ColorList.Add(Color.Black);
            }

            DrawLayout(personNum);

            //Adds the event handlers
            foreach (Cell cell in CellList2D[0])
            {
                cell.MouseClick += cell_MouseClick;
            }
        }