예제 #1
0
        //------------------------------------------------------------------------------------------------------------------------------------
        //
        //--------------------------------------------  Buttons  --------------------------------------------
        //
        //------------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Load the four on four from the currently selected team.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadLinesbtn_Click(object sender, EventArgs e)
        {
            NHLTeam team = JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent());        // Copy the currently selected team to gain access to the four on four

            // Go through each four on four unit
            foreach (FourOnFourLines unit in team.FFL)
            {
                int line = unit.Unit;
                switch (line)
                {
                case 1:
                    FourLW1tb.Text = unit.Wing;
                    FourC1tb.Text  = unit.Center;
                    FourLD1tb.Text = unit.LeftDefence;
                    FourRD1tb.Text = unit.RightDefence;
                    break;

                case 2:
                    FourLW2tb.Text = unit.Wing;
                    FourC2tb.Text  = unit.Center;
                    FourLD2tb.Text = unit.LeftDefence;
                    FourRD2tb.Text = unit.RightDefence;
                    break;

                case 3:
                    FourLW3tb.Text = unit.Wing;
                    FourC3tb.Text  = unit.Center;
                    FourLD3tb.Text = unit.LeftDefence;
                    FourRD3tb.Text = unit.RightDefence;
                    break;
                }
            }
        }
예제 #2
0
        private void SOEAform_Load(object sender, EventArgs e)
        {
            if (Screen.AllScreens.Length >= 1)
            {
                // Get the data of the second monitor
                var monitor = Screen.AllScreens[2].WorkingArea;
                // Change the window to the second monitor and lower the form so it doesn't start ontop of the even strength one
                Location = new Point(monitor.Location.X, monitor.Location.Y + 785);       // Lower the position of the form by the max Y of an even strength form.
            }

            // Check to make sure the team is not empty before setting textbox's
            NHLTeam nhlteam = (Methods.SelectCurrent() != null) ? JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent()) : new NHLTeam();

            if (nhlteam.SOEA != null)
            {
                // Go through each extra attacker then the shootout lineup
                EA1tb.Text = nhlteam.SOEA.ExtraA1;
                EA2tb.Text = nhlteam.SOEA.ExtraA2;

                SO1tb.Text = nhlteam.SOEA.Shooter1;
                SO2tb.Text = nhlteam.SOEA.Shooter2;
                SO3tb.Text = nhlteam.SOEA.Shooter3;
                SO4tb.Text = nhlteam.SOEA.Shooter4;
                SO5tb.Text = nhlteam.SOEA.Shooter5;
            }
        }
예제 #3
0
        /// <summary>
        /// Overwrite the currently selected team's three on three with the current three on three.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveLinesbtn_Click(object sender, EventArgs e)
        {
            NHLTeam team = JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent());            // Copy the currently selected team

            //--------------------------------------------  1st Unit  --------------------------------------------
            ThreeOnThreeLines ttl1 = new ThreeOnThreeLines();

            ttl1.Unit    = 1;
            ttl1.Wing    = TTW1tb.Text;
            ttl1.Center  = TTC1tb.Text;
            ttl1.Defence = TTD1tb.Text;

            //--------------------------------------------  2nd Unit  --------------------------------------------
            ThreeOnThreeLines ttl2 = new ThreeOnThreeLines();

            ttl2.Unit    = 2;
            ttl2.Wing    = TTW2tb.Text;
            ttl2.Center  = TTC2tb.Text;
            ttl2.Defence = TTD2tb.Text;

            //--------------------------------------------  3rd Unit  --------------------------------------------
            ThreeOnThreeLines ttl3 = new ThreeOnThreeLines();

            ttl3.Unit    = 3;
            ttl3.Wing    = TTW3tb.Text;
            ttl3.Center  = TTC3tb.Text;
            ttl3.Defence = TTD3tb.Text;

            team.TTL[0] = ttl1;
            team.TTL[1] = ttl2;
            team.TTL[2] = ttl3;

            Methods.Add(Methods.GetCurrentYear(), JsonConvert.SerializeObject(team));              // Overwrite the currently selected team (only changing the three on three)
        }
예제 #4
0
        //------------------------------------------------------------------------------------------------------------------------------------
        //
        //--------------------------------------------  Buttons  --------------------------------------------
        //
        //------------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Load the three on three from the currently selected team.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadLinesbtn_Click(object sender, EventArgs e)
        {
            NHLTeam team = JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent());        // Copy the currently selected team

            // Go through each powerplay unit
            foreach (ThreeOnThreeLines unit in team.TTL)
            {
                int line = unit.Unit;
                switch (line)
                {
                case 1:
                    TTC1tb.Text = unit.Center;
                    TTW1tb.Text = unit.Wing;
                    TTD1tb.Text = unit.Defence;
                    break;

                case 2:
                    TTC2tb.Text = unit.Center;
                    TTW2tb.Text = unit.Wing;
                    TTD2tb.Text = unit.Defence;
                    break;

                case 3:
                    TTC3tb.Text = unit.Center;
                    TTW3tb.Text = unit.Wing;
                    TTD3tb.Text = unit.Defence;
                    break;
                }
            }
        }
예제 #5
0
        private void PPform_Load(object sender, EventArgs e)
        {
            if (Screen.AllScreens.Length >= 1)
            {
                // Get the data of the second monitor
                var monitor = Screen.AllScreens[2].WorkingArea;
                // Change the window to the second monitor and lower the form so it doesn't start ontop of the even strength one
                Location = new Point(monitor.Location.X, monitor.Location.Y + 785);       // Lower the position of the form by the max Y of an even strength form.
            }

            // Check to make sure the team powerplay is not empty before setting textbox's
            NHLTeam nhlteam = (Methods.SelectCurrent() != null) ? JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent()) : new NHLTeam();

            if (nhlteam.PPL[0] != null)
            {
                // Go through each powerplay unit
                foreach (PowerPlayLines unit in nhlteam.PPL)
                {
                    int line = unit.Unit;
                    switch (line)
                    {
                    case 1:                                                     // First Unit
                        PPLW1tb.Text = unit.LeftWing;
                        PPC1tb.Text  = unit.Center;
                        PPRW1tb.Text = unit.RightWing;
                        PPLD1tb.Text = unit.LeftDefence;
                        PPRD1tb.Text = unit.RightDefence;
                        break;

                    case 2:                                                     // Second Unit
                        PPLW2tb.Text = unit.LeftWing;
                        PPC2tb.Text  = unit.Center;
                        PPRW2tb.Text = unit.RightWing;
                        PPLD2tb.Text = unit.LeftDefence;
                        PPRD2tb.Text = unit.RightDefence;
                        break;

                    case 3:                                                     // First Unit (Four-man powerplay)
                        FPLW1tb.Text = unit.LeftWing;
                        FPC1tb.Text  = unit.Center;
                        FPRW1tb.Text = unit.RightWing;
                        FPD1tb.Text  = unit.LeftDefence;
                        break;

                    case 4:                                                     // Second Unit (Four-man powerplay)
                        FPLW2tb.Text = unit.LeftWing;
                        FPC2tb.Text  = unit.Center;
                        FPRW2tb.Text = unit.RightWing;
                        FPD2tb.Text  = unit.LeftDefence;
                        break;
                    }
                }
            }
        }
예제 #6
0
        //------------------------------------------------------------------------------------------------------------------------------------
        //
        //--------------------------------------------  Buttons  --------------------------------------------
        //
        //------------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Load the extra attackers and shootout lineup from the currently selected team.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadLinesbtn_Click(object sender, EventArgs e)
        {
            NHLTeam team = JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent());            // Copy the currently selected team

            // Go through each extra attacker then the shootout lineup
            EA1tb.Text = team.SOEA.ExtraA1;
            EA2tb.Text = team.SOEA.ExtraA2;

            SO1tb.Text = team.SOEA.Shooter1;
            SO2tb.Text = team.SOEA.Shooter2;
            SO3tb.Text = team.SOEA.Shooter3;
            SO4tb.Text = team.SOEA.Shooter4;
            SO5tb.Text = team.SOEA.Shooter5;
        }
예제 #7
0
        /// <summary>
        /// Overwrite the currently selected team's powerplay with the current powerplay.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveLinesbtn_Click(object sender, EventArgs e)
        {
            NHLTeam team = JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent());            // Copy the currently selected team

            //--------------------------------------------  1st Unit  --------------------------------------------
            PowerPlayLines ppl1 = new PowerPlayLines();

            ppl1.Unit         = 1;
            ppl1.LeftWing     = PPLW1tb.Text;
            ppl1.Center       = PPC1tb.Text;
            ppl1.RightWing    = PPRW1tb.Text;
            ppl1.LeftDefence  = PPLD1tb.Text;
            ppl1.RightDefence = PPRD1tb.Text;

            //--------------------------------------------  2nd Unit  --------------------------------------------
            PowerPlayLines ppl2 = new PowerPlayLines();

            ppl2.Unit         = 2;
            ppl2.LeftWing     = PPLW2tb.Text;
            ppl2.Center       = PPC2tb.Text;
            ppl2.RightWing    = PPRW2tb.Text;
            ppl2.LeftDefence  = PPLD2tb.Text;
            ppl2.RightDefence = PPRD2tb.Text;

            //--------------------------------------------  1st Unit Four-man  --------------------------------------------
            PowerPlayLines ppl3 = new PowerPlayLines();

            ppl3.Unit        = 3;
            ppl3.LeftWing    = FPLW1tb.Text;
            ppl3.Center      = FPC1tb.Text;
            ppl3.RightWing   = FPRW1tb.Text;
            ppl3.LeftDefence = FPD1tb.Text;

            //--------------------------------------------  2nd Unit Four-man  --------------------------------------------
            PowerPlayLines ppl4 = new PowerPlayLines();

            ppl4.Unit        = 4;
            ppl4.LeftWing    = FPLW2tb.Text;
            ppl4.Center      = FPC2tb.Text;
            ppl4.RightWing   = FPRW2tb.Text;
            ppl4.LeftDefence = FPD2tb.Text;


            team.PPL[0] = ppl1;
            team.PPL[1] = ppl2;
            team.PPL[2] = ppl3;
            team.PPL[3] = ppl4;

            Methods.Add(Methods.GetCurrentYear(), JsonConvert.SerializeObject(team));              // Overwrite the currently selected team (only changing the powerplay)
        }
예제 #8
0
        private void PKform_Load(object sender, EventArgs e)
        {
            if (Screen.AllScreens.Length >= 1)
            {
                // Get the data of the second monitor
                var monitor = Screen.AllScreens[2].WorkingArea;
                // Change the window to the second monitor and lower the form so it doesn't start ontop of the even strength one
                Location = new Point(monitor.Location.X, monitor.Location.Y + 785);       // Lower the position of the form by the max Y of an even strength form.
            }

            // Check to make sure the team is not empty before setting textbox's
            NHLTeam nhlteam = (Methods.SelectCurrent() != null) ? JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent()) : new NHLTeam();

            if (nhlteam.PKL[0] != null)
            {
                // Go through each penalty killing unit
                foreach (PenaltyKillLines unit in nhlteam.PKL)
                {
                    int line = unit.Unit;
                    switch (line)
                    {
                    case 1:
                        PKLW1tb.Text = unit.Wing;
                        PKC1tb.Text  = unit.Center;
                        PKLD1tb.Text = unit.LeftDefence;
                        PKRD1tb.Text = unit.RightDefence;
                        break;

                    case 2:
                        PKLW2tb.Text = unit.Wing;
                        PKC2tb.Text  = unit.Center;
                        PKLD2tb.Text = unit.LeftDefence;
                        PKRD2tb.Text = unit.RightDefence;
                        break;

                    case 3:
                        TPC1tb.Text  = unit.Center;
                        TPLD1tb.Text = unit.LeftDefence;
                        TPRD1tb.Text = unit.RightDefence;
                        break;

                    case 4:
                        TPC2tb.Text  = unit.Center;
                        TPLD2tb.Text = unit.LeftDefence;
                        TPRD2tb.Text = unit.RightDefence;
                        break;
                    }
                }
            }
        }
예제 #9
0
        /// <summary>
        /// Overwrite the currently selected team's penalty kill with the current penalty kill.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveLinesbtn_Click(object sender, EventArgs e)
        {
            NHLTeam team = JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent());        // Copy the currently selected team

            //--------------------------------------------  1st Unit  --------------------------------------------
            PenaltyKillLines pkl1 = new PenaltyKillLines();

            pkl1.Unit         = 1;
            pkl1.Wing         = PKLW1tb.Text;
            pkl1.Center       = PKC1tb.Text;
            pkl1.LeftDefence  = PKLD1tb.Text;
            pkl1.RightDefence = PKRD1tb.Text;

            //--------------------------------------------  2nd Unit  --------------------------------------------
            PenaltyKillLines pkl2 = new PenaltyKillLines();

            pkl2.Unit         = 2;
            pkl2.Wing         = PKLW2tb.Text;
            pkl2.Center       = PKC2tb.Text;
            pkl2.LeftDefence  = PKLD2tb.Text;
            pkl2.RightDefence = PKRD2tb.Text;

            //--------------------------------------------  1st Unit (Three-man)  --------------------------------------------
            PenaltyKillLines pkl3 = new PenaltyKillLines();

            pkl3.Unit         = 3;
            pkl3.Center       = TPC1tb.Text;
            pkl3.LeftDefence  = TPLD1tb.Text;
            pkl3.RightDefence = TPRD1tb.Text;

            //--------------------------------------------  2nd Unit (Three-man)  --------------------------------------------
            PenaltyKillLines pkl4 = new PenaltyKillLines();

            pkl4.Unit         = 4;
            pkl4.Center       = TPC2tb.Text;
            pkl4.LeftDefence  = TPLD2tb.Text;
            pkl4.RightDefence = TPRD2tb.Text;

            team.PKL[0] = pkl1;
            team.PKL[1] = pkl2;
            team.PKL[2] = pkl3;
            team.PKL[3] = pkl4;

            Methods.Add(Methods.GetCurrentYear(), JsonConvert.SerializeObject(team));          // Overwrite the currently selected team (only changing the penalty kill)
        }
예제 #10
0
        //------------------------------------------------------------------------------------------------------------------------------------
        //
        //--------------------------------------------  Buttons  --------------------------------------------
        //
        //------------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Load the powerplay from the currently selected team.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadLinesbtn_Click(object sender, EventArgs e)
        {
            NHLTeam team = JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent());                    // Copy the currently selected team

            // Go through each powerplay unit
            foreach (PowerPlayLines unit in team.PPL)
            {
                int line = unit.Unit;
                switch (line)
                {
                case 1:                                                     // First Unit
                    PPLW1tb.Text = unit.LeftWing;
                    PPC1tb.Text  = unit.Center;
                    PPRW1tb.Text = unit.RightWing;
                    PPLD1tb.Text = unit.LeftDefence;
                    PPRD1tb.Text = unit.RightDefence;
                    break;

                case 2:                                                     // Second Unit
                    PPLW2tb.Text = unit.LeftWing;
                    PPC2tb.Text  = unit.Center;
                    PPRW2tb.Text = unit.RightWing;
                    PPLD2tb.Text = unit.LeftDefence;
                    PPRD2tb.Text = unit.RightDefence;
                    break;

                case 3:                                                     // First Unit (Four-man powerplay)
                    FPLW1tb.Text = unit.LeftWing;
                    FPC1tb.Text  = unit.Center;
                    FPRW1tb.Text = unit.RightWing;
                    FPD1tb.Text  = unit.LeftDefence;
                    break;

                case 4:                                                     // Second Unit (Four-man powerplay)
                    FPLW2tb.Text = unit.LeftWing;
                    FPC2tb.Text  = unit.Center;
                    FPRW2tb.Text = unit.RightWing;
                    FPD2tb.Text  = unit.LeftDefence;
                    break;
                }
            }
        }
예제 #11
0
        /// <summary>
        /// Open the form on my vertical monitor so I don't have to move it because I'm lazy
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ESform_Load(object sender, EventArgs e)
        {
            if (Screen.AllScreens.Length >= 1)
            {
                // Get the data of the second monitor
                var monitor = Screen.AllScreens[2].WorkingArea;
                // Change the wingow to the second monitor
                Location = monitor.Location;
            }

            NHLTeam nhlteam = (Methods.SelectCurrent() != null) ? JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent()) : new NHLTeam();

            TeamNametb.Text = nhlteam.Name;
            string selYr = "2020-2021";

            Dictionary <string, NHLTeam> org = JsonConvert.DeserializeObject <Dictionary <string, NHLTeam> >(Methods.GiveHistory <string>());

            // Iterate over each key to populate the year listbox and team dictionary
            foreach (var item in org)
            {
                // Check if year is not already in the year listbox before adding
                if (TeamYearlb.FindString(item.Key) == ListBox.NoMatches)
                {
                    TeamYearlb.Items.Add(item.Key);
                }

                // Check if year is not already in the dictionary before adding the team
                if (!Methods.SetCurrent(item.Key))
                {
                    Methods.Add(item.Key, JsonConvert.SerializeObject(item.Value));
                }
            }

            // Load in the team for the selected year
            Methods.SetCurrent(selYr);
            nhlteam = (Methods.SelectCurrent() != null) ? JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent()) : new NHLTeam();

            TeamNametb.Text = nhlteam.Name;

            NHLrb.Checked = true;
            AHLrb.Checked = false;
        }
예제 #12
0
        private void TTform_Load(object sender, EventArgs e)
        {
            if (Screen.AllScreens.Length >= 1)
            {
                // Get the data of the second monitor
                var monitor = Screen.AllScreens[2].WorkingArea;
                // Change the window to the second monitor and lower the form so it doesn't start ontop of the even strength one
                Location = new Point(monitor.Location.X, monitor.Location.Y + 785);       // Lower the position of the form by the max Y of an even strength form.
            }

            // Check to make sure the team is not empty before setting textbox's
            NHLTeam nhlteam = (Methods.SelectCurrent() != null) ? JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent()) : new NHLTeam();

            if (nhlteam.TTL[0] != null)
            {
                // Go through each powerplay unit
                foreach (ThreeOnThreeLines unit in nhlteam.TTL)
                {
                    int line = unit.Unit;
                    switch (line)
                    {
                    case 1:
                        TTC1tb.Text = unit.Center;
                        TTW1tb.Text = unit.Wing;
                        TTD1tb.Text = unit.Defence;
                        break;

                    case 2:
                        TTC2tb.Text = unit.Center;
                        TTW2tb.Text = unit.Wing;
                        TTD2tb.Text = unit.Defence;
                        break;

                    case 3:
                        TTC3tb.Text = unit.Center;
                        TTW3tb.Text = unit.Wing;
                        TTD3tb.Text = unit.Defence;
                        break;
                    }
                }
            }
        }
예제 #13
0
        /// <summary>
        /// Overwrite the currently selected team's extra attackers and shootout lineup with the current extra attackers and shootout lineup.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveLinesbtn_Click(object sender, EventArgs e)
        {
            NHLTeam team = JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent());                // Copy the currently selected team

            // Go through the extra attackers then the shootout lineup
            ShootoutExtraAttacker soea = new ShootoutExtraAttacker();

            soea.ExtraA1 = EA1tb.Text;
            soea.ExtraA2 = EA2tb.Text;

            soea.Shooter1 = SO1tb.Text;
            soea.Shooter2 = SO2tb.Text;
            soea.Shooter3 = SO3tb.Text;
            soea.Shooter4 = SO4tb.Text;
            soea.Shooter5 = SO5tb.Text;

            team.SOEA = soea;

            Methods.Add(Methods.GetCurrentYear(), JsonConvert.SerializeObject(team));
        }
예제 #14
0
        //------------------------------------------------------------------------------------------------------------------------------------
        //
        //--------------------------------------------  Buttons  --------------------------------------------
        //
        //------------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Load the penalty kill from the currently selected team.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadLinesbtn_Click(object sender, EventArgs e)
        {
            NHLTeam team = JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent());        // Copy the currently selected team to gain access to the penalty kill

            // Go through each penalty killing unit
            foreach (PenaltyKillLines unit in team.PKL)
            {
                int line = unit.Unit;
                switch (line)
                {
                case 1:
                    PKLW1tb.Text = unit.Wing;
                    PKC1tb.Text  = unit.Center;
                    PKLD1tb.Text = unit.LeftDefence;
                    PKRD1tb.Text = unit.RightDefence;
                    break;

                case 2:
                    PKLW2tb.Text = unit.Wing;
                    PKC2tb.Text  = unit.Center;
                    PKLD2tb.Text = unit.LeftDefence;
                    PKRD2tb.Text = unit.RightDefence;
                    break;

                case 3:
                    TPC1tb.Text  = unit.Center;
                    TPLD1tb.Text = unit.LeftDefence;
                    TPRD1tb.Text = unit.RightDefence;
                    break;

                case 4:
                    TPC2tb.Text  = unit.Center;
                    TPLD2tb.Text = unit.LeftDefence;
                    TPRD2tb.Text = unit.RightDefence;
                    break;
                }
            }
        }
예제 #15
0
        /// <summary>
        /// Overwrite the currently selected team's penalty kill with the current penalty kill.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveLinesbtn_Click(object sender, EventArgs e)
        {
            NHLTeam team = JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent());        // Copy the currently selected team to gain access to the four on four

            //--------------------------------------------  1st Unit  --------------------------------------------
            FourOnFourLines ff1 = new FourOnFourLines();

            ff1.Unit         = 1;
            ff1.Wing         = FourLW1tb.Text;
            ff1.Center       = FourC1tb.Text;
            ff1.LeftDefence  = FourLD1tb.Text;
            ff1.RightDefence = FourRD1tb.Text;

            //--------------------------------------------  2nd Unit  --------------------------------------------
            FourOnFourLines ff2 = new FourOnFourLines();

            ff2.Unit         = 2;
            ff2.Wing         = FourLW2tb.Text;
            ff2.Center       = FourC2tb.Text;
            ff2.LeftDefence  = FourLD2tb.Text;
            ff2.RightDefence = FourRD2tb.Text;

            //--------------------------------------------  3rd Unit  --------------------------------------------
            FourOnFourLines ff3 = new FourOnFourLines();

            ff3.Unit         = 3;
            ff3.Wing         = FourLW3tb.Text;
            ff3.Center       = FourC3tb.Text;
            ff3.LeftDefence  = FourLD3tb.Text;
            ff3.RightDefence = FourRD3tb.Text;

            team.FFL[0] = ff1;
            team.FFL[1] = ff2;
            team.FFL[2] = ff3;

            Methods.Add(Methods.GetCurrentYear(), JsonConvert.SerializeObject(team));
        }
예제 #16
0
        private void AHLform_Load(object sender, EventArgs e)
        {
            // Put form on my second monitor
            if (Screen.AllScreens.Length >= 1)
            {
                // Get the data of the second monitor
                var monitor = Screen.AllScreens[2].WorkingArea;
                // Change the window to the second monitor and lower the form so it doesn't start ontop of the even strength one
                Location = new Point(monitor.Location.X, monitor.Location.Y + 785);       // Lower the position of the form by the max Y of an even strength form.
            }

            NHLTeam nhlteam = (Methods.SelectCurrent() != null) ? JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent()) : new NHLTeam();

            if (nhlteam.AHLLines != null)
            {
                AHLTeam team = nhlteam.AHLLines;

                // Load team info
                TeamNametb.Text = team.Name;

                NHLrb.Checked = team.League ? true : false;
                AHLrb.Checked = team.League ? false : true;

                Recordtb.Text  = team.Record;
                Playofftb.Text = team.Playoff;

                // Load Goalies
                G1tb.Text    = team.goalies.Starter.Name;
                G1OVRtb.Text = team.goalies.Starter.Overall.ToString();
                G2tb.Text    = team.goalies.Backup.Name;
                G2OVRtb.Text = team.goalies.Backup.Overall.ToString();
                G3tb.Text    = team.goalies.ThirdString.Name;
                G3OVRtb.Text = team.goalies.ThirdString.Overall.ToString();


                // Load Player Lines
                foreach (EvenStrengthLines line in team.ESL)
                {
                    int unit = line.Line;
                    switch (unit)
                    {
                    case 1:                                                         // First Line
                        LW1tb.Text    = line.LeftWing.Name;
                        LW1OVRtb.Text = line.LeftWing.Overall.ToString();
                        C1tb.Text     = line.Center.Name;
                        C1OVRtb.Text  = line.Center.Overall.ToString();
                        RW1tb.Text    = line.RightWing.Name;
                        RW1OVRtb.Text = line.RightWing.Overall.ToString();
                        LD1tb.Text    = line.LeftDefence.Name;
                        LD1OVRtb.Text = line.LeftDefence.Overall.ToString();
                        RD1tb.Text    = line.RightDefence.Name;
                        RD1OVRtb.Text = line.RightDefence.Overall.ToString();
                        break;

                    case 2:                                                         // Second Line
                        LW2tb.Text    = line.LeftWing.Name;
                        LW2OVRtb.Text = line.LeftWing.Overall.ToString();
                        C2tb.Text     = line.Center.Name;
                        C2OVRtb.Text  = line.Center.Overall.ToString();
                        RW2tb.Text    = line.RightWing.Name;
                        RW2OVRtb.Text = line.RightWing.Overall.ToString();
                        LD2tb.Text    = line.LeftDefence.Name;
                        LD2OVRtb.Text = line.LeftDefence.Overall.ToString();
                        RD2tb.Text    = line.RightDefence.Name;
                        RD2OVRtb.Text = line.RightDefence.Overall.ToString();
                        break;

                    case 3:                                                         // Third Line
                        LW3tb.Text    = line.LeftWing.Name;
                        LW3OVRtb.Text = line.LeftWing.Overall.ToString();
                        C3tb.Text     = line.Center.Name;
                        C3OVRtb.Text  = line.Center.Overall.ToString();
                        RW3tb.Text    = line.RightWing.Name;
                        RW3OVRtb.Text = line.RightWing.Overall.ToString();
                        LD3tb.Text    = line.LeftDefence.Name;
                        LD3OVRtb.Text = line.LeftDefence.Overall.ToString();
                        RD3tb.Text    = line.RightDefence.Name;
                        RD3OVRtb.Text = line.RightDefence.Overall.ToString();
                        break;

                    case 4:                                                         // Forth Line
                        LW4tb.Text    = line.LeftWing.Name;
                        LW4OVRtb.Text = line.LeftWing.Overall.ToString();
                        C4tb.Text     = line.Center.Name;
                        C4OVRtb.Text  = line.Center.Overall.ToString();
                        RW4tb.Text    = line.RightWing.Name;
                        RW4OVRtb.Text = line.RightWing.Overall.ToString();
                        break;

                    case 5:                                                         // Scratched
                        LW5tb.Text    = line.LeftWing.Name;
                        LW5OVRtb.Text = line.LeftWing.Overall.ToString();
                        C5tb.Text     = line.Center.Name;
                        C5OVRtb.Text  = line.Center.Overall.ToString();
                        RW5tb.Text    = line.RightWing.Name;
                        RW5OVRtb.Text = line.RightWing.Overall.ToString();
                        LD4tb.Text    = line.LeftDefence.Name;
                        LD4OVRtb.Text = line.LeftDefence.Overall.ToString();
                        RD4tb.Text    = line.RightDefence.Name;
                        RD4OVRtb.Text = line.RightDefence.Overall.ToString();
                        break;
                    }
                }
            }
        }
예제 #17
0
        /// <summary>
        /// Load the AHL lines from the currently selected team
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadLinesbtn_Click(object sender, EventArgs e)
        {
            NHLTeam nhlteam = (Methods.SelectCurrent() != null) ? JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent()) : new NHLTeam();
            AHLTeam team    = (nhlteam.AHLLines != null) ? nhlteam.AHLLines : new AHLTeam();


            // Load team info
            TeamNametb.Text = team.Name;

            NHLrb.Checked = team.League ? true : false;
            AHLrb.Checked = team.League ? false : true;

            Recordtb.Text  = team.Record;
            Playofftb.Text = team.Playoff;

            // Load Goalies
            G1tb.Text    = team.goalies.Starter.Name;
            G1OVRtb.Text = team.goalies.Starter.Overall.ToString();
            G2tb.Text    = team.goalies.Backup.Name;
            G2OVRtb.Text = team.goalies.Backup.Overall.ToString();
            G3tb.Text    = team.goalies.ThirdString.Name;
            G3OVRtb.Text = team.goalies.ThirdString.Overall.ToString();


            // Load Player Lines
            foreach (EvenStrengthLines line in team.ESL)
            {
                int unit = line.Line;
                switch (unit)
                {
                case 1:                                                         // First Line
                    LW1tb.Text    = line.LeftWing.Name;
                    LW1OVRtb.Text = line.LeftWing.Overall.ToString();
                    C1tb.Text     = line.Center.Name;
                    C1OVRtb.Text  = line.Center.Overall.ToString();
                    RW1tb.Text    = line.RightWing.Name;
                    RW1OVRtb.Text = line.RightWing.Overall.ToString();
                    LD1tb.Text    = line.LeftDefence.Name;
                    LD1OVRtb.Text = line.LeftDefence.Overall.ToString();
                    RD1tb.Text    = line.RightDefence.Name;
                    RD1OVRtb.Text = line.RightDefence.Overall.ToString();
                    break;

                case 2:                                                         // Second Line
                    LW2tb.Text    = line.LeftWing.Name;
                    LW2OVRtb.Text = line.LeftWing.Overall.ToString();
                    C2tb.Text     = line.Center.Name;
                    C2OVRtb.Text  = line.Center.Overall.ToString();
                    RW2tb.Text    = line.RightWing.Name;
                    RW2OVRtb.Text = line.RightWing.Overall.ToString();
                    LD2tb.Text    = line.LeftDefence.Name;
                    LD2OVRtb.Text = line.LeftDefence.Overall.ToString();
                    RD2tb.Text    = line.RightDefence.Name;
                    RD2OVRtb.Text = line.RightDefence.Overall.ToString();
                    break;

                case 3:                                                         // Third Line
                    LW3tb.Text    = line.LeftWing.Name;
                    LW3OVRtb.Text = line.LeftWing.Overall.ToString();
                    C3tb.Text     = line.Center.Name;
                    C3OVRtb.Text  = line.Center.Overall.ToString();
                    RW3tb.Text    = line.RightWing.Name;
                    RW3OVRtb.Text = line.RightWing.Overall.ToString();
                    LD3tb.Text    = line.LeftDefence.Name;
                    LD3OVRtb.Text = line.LeftDefence.Overall.ToString();
                    RD3tb.Text    = line.RightDefence.Name;
                    RD3OVRtb.Text = line.RightDefence.Overall.ToString();
                    break;

                case 4:                                                         // Forth Line
                    LW4tb.Text    = line.LeftWing.Name;
                    LW4OVRtb.Text = line.LeftWing.Overall.ToString();
                    C4tb.Text     = line.Center.Name;
                    C4OVRtb.Text  = line.Center.Overall.ToString();
                    RW4tb.Text    = line.RightWing.Name;
                    RW4OVRtb.Text = line.RightWing.Overall.ToString();
                    break;

                case 5:                                                         // Scratched
                    LW5tb.Text    = line.LeftWing.Name;
                    LW5OVRtb.Text = line.LeftWing.Overall.ToString();
                    C5tb.Text     = line.Center.Name;
                    C5OVRtb.Text  = line.Center.Overall.ToString();
                    RW5tb.Text    = line.RightWing.Name;
                    RW5OVRtb.Text = line.RightWing.Overall.ToString();
                    LD4tb.Text    = line.LeftDefence.Name;
                    LD4OVRtb.Text = line.LeftDefence.Overall.ToString();
                    RD4tb.Text    = line.RightDefence.Name;
                    RD4OVRtb.Text = line.RightDefence.Overall.ToString();
                    break;
                }
            }
        }
예제 #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveLinesbtn_Click(object sender, EventArgs e)
        {
            NHLTeam nhlteam = (Methods.SelectCurrent() != null) ? JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent()) : new NHLTeam();
            AHLTeam team    = (nhlteam.AHLLines != null) ? nhlteam.AHLLines : new AHLTeam();

            // Save team info
            team.Name    = TeamNametb.Text;
            team.League  = NHLrb.Checked ? true : false;
            team.Record  = Recordtb.Text.ToString();
            team.Playoff = Playofftb.Text.ToString();

            //--------------------------------------------  1st Line / 1st Pairing  --------------------------------------------
            EvenStrengthLines line1 = new EvenStrengthLines();

            line1.Line = 1;

            // Save 1st line left wing
            Player player = new Player();                       // Create a player object

            player.Name    = LW1tb.Text;
            player.Overall = String.IsNullOrEmpty(LW1OVRtb.Text) ? 0 : int.Parse(LW1OVRtb.Text);

            line1.LeftWing = player;

            // Save 1st line center
            player         = new Player();
            player.Name    = C1tb.Text;
            player.Overall = String.IsNullOrEmpty(C1OVRtb.Text) ? 0 : int.Parse(C1OVRtb.Text);

            line1.Center = player;

            // Save 1st line right wing
            player         = new Player();
            player.Name    = RW1tb.Text;
            player.Overall = String.IsNullOrEmpty(RW1OVRtb.Text) ? 0 : int.Parse(RW1OVRtb.Text);

            line1.RightWing = player;

            // Save 1st pair left defence
            player         = new Player();
            player.Name    = LD1tb.Text;
            player.Overall = String.IsNullOrEmpty(LD1OVRtb.Text) ? 0 : int.Parse(LD1OVRtb.Text);

            line1.LeftDefence = player;

            // Save 1st pair right defence
            player         = new Player();
            player.Name    = RD1tb.Text;
            player.Overall = String.IsNullOrEmpty(RD1OVRtb.Text) ? 0 : int.Parse(RD1OVRtb.Text);

            line1.RightDefence = player;

            //--------------------------------------------  2nd Line / 2nd Pairing  --------------------------------------------
            EvenStrengthLines line2 = new EvenStrengthLines();

            line2.Line = 2;

            // Save 2nd line left wing
            player         = new Player();
            player.Name    = LW2tb.Text;
            player.Overall = String.IsNullOrEmpty(LW2OVRtb.Text) ? 0 : int.Parse(LW2OVRtb.Text);

            line2.LeftWing = player;

            // Save 2nd line center
            player         = new Player();
            player.Name    = C2tb.Text;
            player.Overall = String.IsNullOrEmpty(C2OVRtb.Text) ? 0 : int.Parse(C2OVRtb.Text);

            line2.Center = player;

            // Save 2nd line right wing
            player         = new Player();
            player.Name    = RW2tb.Text;
            player.Overall = String.IsNullOrEmpty(RW2OVRtb.Text) ? 0 : int.Parse(RW2OVRtb.Text);

            line2.RightWing = player;

            // Save 2nd pair left defence
            player         = new Player();
            player.Name    = LD2tb.Text;
            player.Overall = String.IsNullOrEmpty(LD2OVRtb.Text) ? 0 : int.Parse(LD2OVRtb.Text);

            line2.LeftDefence = player;

            // Save 2nd pair right defence
            player         = new Player();
            player.Name    = RD2tb.Text;
            player.Overall = String.IsNullOrEmpty(RD2OVRtb.Text) ? 0 : int.Parse(RD2OVRtb.Text);

            line2.RightDefence = player;

            //--------------------------------------------  3rd Line / 3rd Pairing  --------------------------------------------
            EvenStrengthLines line3 = new EvenStrengthLines();

            line3.Line = 3;

            // Save 3rd line left wing
            player         = new Player();
            player.Name    = LW3tb.Text;
            player.Overall = String.IsNullOrEmpty(LW3OVRtb.Text) ? 0 : int.Parse(LW3OVRtb.Text);

            line3.LeftWing = player;

            // Save 3rd line center
            player         = new Player();
            player.Name    = C3tb.Text;
            player.Overall = String.IsNullOrEmpty(C3OVRtb.Text) ? 0 : int.Parse(C3OVRtb.Text);

            line3.Center = player;

            // Save 3rd line right wing
            player         = new Player();
            player.Name    = RW3tb.Text;
            player.Overall = String.IsNullOrEmpty(RW3OVRtb.Text) ? 0 : int.Parse(RW3OVRtb.Text);

            line3.RightWing = player;

            // Save 3rd pair left defence
            player         = new Player();
            player.Name    = LD3tb.Text;
            player.Overall = String.IsNullOrEmpty(LD3OVRtb.Text) ? 0 : int.Parse(LD3OVRtb.Text);

            line3.LeftDefence = player;

            // Save 3rd pair right defence
            player         = new Player();
            player.Name    = RD3tb.Text;
            player.Overall = String.IsNullOrEmpty(RD3OVRtb.Text) ? 0 : int.Parse(RD3OVRtb.Text);

            line3.RightDefence = player;

            //--------------------------------------------  4th Line  --------------------------------------------
            EvenStrengthLines line4 = new EvenStrengthLines();

            line4.Line = 4;

            // Save 4th line left wing
            player         = new Player();
            player.Name    = LW4tb.Text;
            player.Overall = String.IsNullOrEmpty(LW4OVRtb.Text) ? 0 : int.Parse(LW4OVRtb.Text);

            line4.LeftWing = player;

            // Save 4th line center
            player         = new Player();
            player.Name    = C4tb.Text;
            player.Overall = String.IsNullOrEmpty(C4OVRtb.Text) ? 0 : int.Parse(C4OVRtb.Text);

            line4.Center = player;

            // Save 4th line right wing
            player         = new Player();
            player.Name    = RW4tb.Text;
            player.Overall = String.IsNullOrEmpty(RW4OVRtb.Text) ? 0 : int.Parse(RW4OVRtb.Text);

            line4.RightWing = player;

            //--------------------------------------------  Goalies  --------------------------------------------
            Goalies goalies = new Goalies();

            // Save starting goalie
            player         = new Player();
            player.Name    = G1tb.Text;
            player.Overall = String.IsNullOrEmpty(G1OVRtb.Text) ? 0 : int.Parse(G1OVRtb.Text);

            goalies.Starter = player;

            // Save backup goalie
            player         = new Player();
            player.Name    = G2tb.Text;
            player.Overall = String.IsNullOrEmpty(G2OVRtb.Text) ? 0 : int.Parse(G2OVRtb.Text);

            goalies.Backup = player;

            // Save third string
            player         = new Player();
            player.Name    = G3tb.Text;
            player.Overall = String.IsNullOrEmpty(G3OVRtb.Text) ? 0 : int.Parse(G3OVRtb.Text);

            goalies.ThirdString = player;

            //--------------------------------------------  Scratched  --------------------------------------------
            EvenStrengthLines scratched = new EvenStrengthLines();

            scratched.Line = 5;

            // Save scratched left wing
            player         = new Player();
            player.Name    = LW5tb.Text;
            player.Overall = String.IsNullOrEmpty(LW5OVRtb.Text) ? 0 : int.Parse(LW5OVRtb.Text);

            scratched.LeftWing = player;

            // Save scratched center
            player         = new Player();
            player.Name    = C5tb.Text;
            player.Overall = String.IsNullOrEmpty(C5OVRtb.Text) ? 0 : int.Parse(C5OVRtb.Text);

            scratched.Center = player;

            // Save scratched right wing
            player         = new Player();
            player.Name    = RW5tb.Text;
            player.Overall = String.IsNullOrEmpty(RW5OVRtb.Text) ? 0 : int.Parse(RW5OVRtb.Text);

            scratched.RightWing = player;

            // Save scratched left defence
            player         = new Player();
            player.Name    = LD4tb.Text;
            player.Overall = String.IsNullOrEmpty(LD4OVRtb.Text) ? 0 : int.Parse(LD4OVRtb.Text);

            scratched.LeftDefence = player;

            // Save scratched right defence
            player         = new Player();
            player.Name    = RD4tb.Text;
            player.Overall = String.IsNullOrEmpty(RD4OVRtb.Text) ? 0 : int.Parse(RD4OVRtb.Text);

            scratched.RightDefence = player;

            team.ESL[0]  = line1;
            team.ESL[1]  = line2;
            team.ESL[2]  = line3;
            team.ESL[3]  = line4;
            team.ESL[4]  = scratched;
            team.goalies = goalies;

            nhlteam.AHLLines = team;

            Methods.Add(Methods.GetCurrentYear(), JsonConvert.SerializeObject(nhlteam));
        }
예제 #19
0
        /// <summary>
        /// Load user lines from Roster folder in root project folder
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadLinesbtn_Click(object sender, EventArgs e)
        {
            string nhlTeamName = TeamNametb.Text;
            string filePath    = "";

            //string fileContent = File.ReadAllText(Path.Combine("..\\..\\Rosters\\", (nhlTeamName + ".txt")));               // Setup path of the file

            string fileContent = filePath == "" ? File.ReadAllText(Path.Combine("..\\..\\Rosters\\", (nhlTeamName + ".txt"))) : File.ReadAllText(filePath);

            Dictionary <string, NHLTeam> org = JsonConvert.DeserializeObject <Dictionary <string, NHLTeam> >(fileContent);      // Read the file and place data in dictionary

            // Find the team of the selected year
            string selYr = TeamYearlb.SelectedItem == null ? "2020-2021" : TeamYearlb.SelectedItem.ToString();


            // Iterate over each key to populate the year listbox and team dictionary
            foreach (var item in org)
            {
                // Check if year is not already in the year listbox before adding
                if (TeamYearlb.FindString(item.Key) == ListBox.NoMatches)
                {
                    TeamYearlb.Items.Add(item.Key);
                }

                // Check if year is not already in the dictionary before adding the team
                if (!Methods.SetCurrent(item.Key))
                {
                    Methods.Add(item.Key, JsonConvert.SerializeObject(item.Value));
                }
            }

            // Load in the team for the selected year
            Methods.SetCurrent(selYr);
            NHLTeam team = JsonConvert.DeserializeObject <NHLTeam>(Methods.SelectCurrent());

            TeamNametb.Text = team.Name;

            NHLrb.Checked = team.League ? true : false;
            AHLrb.Checked = team.League ? false : true;

            Recordtb.Text  = team.Record;
            Playofftb.Text = team.Playoff;

            // Load Goalies
            G1tb.Text    = team.goalies.Starter.Name.ToString();
            G1OVRtb.Text = team.goalies.Starter.Overall.ToString();
            G2tb.Text    = team.goalies.Backup.Name.ToString();
            G2OVRtb.Text = team.goalies.Backup.Overall.ToString();

            // Go through each line
            foreach (EvenStrengthLines line in team.ESL)
            {
                int unit = line.Line;
                switch (unit)
                {
                case 1:                                                         // First Line / First Pair
                    LW1tb.Text    = line.LeftWing.Name.ToString();
                    LW1OVRtb.Text = line.LeftWing.Overall.ToString();
                    C1tb.Text     = line.Center.Name.ToString();
                    C1OVRtb.Text  = line.Center.Overall.ToString();
                    RW1tb.Text    = line.RightWing.Name.ToString();
                    RW1OVRtb.Text = line.RightWing.Overall.ToString();
                    LD1tb.Text    = line.LeftDefence.Name.ToString();
                    LD1OVRtb.Text = line.LeftDefence.Overall.ToString();
                    RD1tb.Text    = line.RightDefence.Name.ToString();
                    RD1OVRtb.Text = line.RightDefence.Overall.ToString();
                    break;

                case 2:                                                         // Second Line / Second Pair
                    LW2tb.Text    = line.LeftWing.Name.ToString();
                    LW2OVRtb.Text = line.LeftWing.Overall.ToString();
                    C2tb.Text     = line.Center.Name.ToString();
                    C2OVRtb.Text  = line.Center.Overall.ToString();
                    RW2tb.Text    = line.RightWing.Name.ToString();
                    RW2OVRtb.Text = line.RightWing.Overall.ToString();
                    LD2tb.Text    = line.LeftDefence.Name.ToString();
                    LD2OVRtb.Text = line.LeftDefence.Overall.ToString();
                    RD2tb.Text    = line.RightDefence.Name.ToString();
                    RD2OVRtb.Text = line.RightDefence.Overall.ToString();
                    break;

                case 3:                                                         // Third Line / Third Pair
                    LW3tb.Text    = line.LeftWing.Name.ToString();
                    LW3OVRtb.Text = line.LeftWing.Overall.ToString();
                    C3tb.Text     = line.Center.Name.ToString();
                    C3OVRtb.Text  = line.Center.Overall.ToString();
                    RW3tb.Text    = line.RightWing.Name.ToString();
                    RW3OVRtb.Text = line.RightWing.Overall.ToString();
                    LD3tb.Text    = line.LeftDefence.Name.ToString();
                    LD3OVRtb.Text = line.LeftDefence.Overall.ToString();
                    RD3tb.Text    = line.RightDefence.Name.ToString();
                    RD3OVRtb.Text = line.RightDefence.Overall.ToString();
                    break;

                case 4:                                                         // Fourth Line
                    LW4tb.Text    = line.LeftWing.Name.ToString();
                    LW4OVRtb.Text = line.LeftWing.Overall.ToString();
                    C4tb.Text     = line.Center.Name.ToString();
                    C4OVRtb.Text  = line.Center.Overall.ToString();
                    RW4tb.Text    = line.RightWing.Name.ToString();
                    RW4OVRtb.Text = line.RightWing.Overall.ToString();
                    break;

                case 5:                                                         // Scratched
                    LW5tb.Text    = line.LeftWing.Name.ToString();
                    LW5OVRtb.Text = line.LeftWing.Overall.ToString();
                    C5tb.Text     = line.Center.Name.ToString();
                    C5OVRtb.Text  = line.Center.Overall.ToString();
                    RW5tb.Text    = line.RightWing.Name.ToString();
                    RW5OVRtb.Text = line.RightWing.Overall.ToString();
                    LD4tb.Text    = line.LeftDefence.Name.ToString();
                    LD4OVRtb.Text = line.LeftDefence.Overall.ToString();
                    RD4tb.Text    = line.RightDefence.Name.ToString();
                    RD4OVRtb.Text = line.RightDefence.Overall.ToString();
                    break;
                }
            }
        }
예제 #20
0
        /// <summary>
        /// Save user lines to Roster folder in root project folder
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveLinesbtn_Click(object sender, EventArgs e)
        {
            NHLTeam team = (Methods.SelectCurrent() != null) ? JsonConvert.DeserializeObject <NHLTeam> (Methods.SelectCurrent()) : new NHLTeam();

            team.Name    = TeamNametb.Text;
            team.League  = NHLrb.Checked ? true : false;
            team.Record  = Recordtb.Text.ToString();
            team.Playoff = Playofftb.Text.ToString();

            //--------------------------------------------  1st Line / 1st Pairing  --------------------------------------------
            EvenStrengthLines line1 = new EvenStrengthLines();

            line1.Line = 1;

            // Save 1st line left wing
            Player player = new Player();                       // Create a player object

            player.Name    = LW1tb.Text;
            player.Overall = String.IsNullOrEmpty(LW1OVRtb.Text) ? 0 : int.Parse(LW1OVRtb.Text);

            line1.LeftWing = player;

            // Save 1st line center
            player         = new Player();
            player.Name    = C1tb.Text;
            player.Overall = String.IsNullOrEmpty(C1OVRtb.Text) ? 0 : int.Parse(C1OVRtb.Text);

            line1.Center = player;

            // Save 1st line right wing
            player         = new Player();
            player.Name    = RW1tb.Text;
            player.Overall = String.IsNullOrEmpty(RW1OVRtb.Text) ? 0 : int.Parse(RW1OVRtb.Text);

            line1.RightWing = player;

            // Save 1st pair left defence
            player         = new Player();
            player.Name    = LD1tb.Text;
            player.Overall = String.IsNullOrEmpty(LD1OVRtb.Text) ? 0 : int.Parse(LD1OVRtb.Text);

            line1.LeftDefence = player;

            // Save 1st pair right defence
            player         = new Player();
            player.Name    = RD1tb.Text;
            player.Overall = String.IsNullOrEmpty(RD1OVRtb.Text) ? 0 : int.Parse(RD1OVRtb.Text);

            line1.RightDefence = player;

            //--------------------------------------------  2nd Line / 2nd Pairing  --------------------------------------------
            EvenStrengthLines line2 = new EvenStrengthLines();

            line2.Line = 2;

            // Save 2nd line left wing
            player         = new Player();
            player.Name    = LW2tb.Text;
            player.Overall = String.IsNullOrEmpty(LW2OVRtb.Text) ? 0 : int.Parse(LW2OVRtb.Text);

            line2.LeftWing = player;

            // Save 2nd line center
            player         = new Player();
            player.Name    = C2tb.Text;
            player.Overall = String.IsNullOrEmpty(C2OVRtb.Text) ? 0 : int.Parse(C2OVRtb.Text);

            line2.Center = player;

            // Save 2nd line right wing
            player         = new Player();
            player.Name    = RW2tb.Text;
            player.Overall = String.IsNullOrEmpty(RW2OVRtb.Text) ? 0 : int.Parse(RW2OVRtb.Text);

            line2.RightWing = player;

            // Save 2nd pair left defence
            player         = new Player();
            player.Name    = LD2tb.Text;
            player.Overall = String.IsNullOrEmpty(LD2OVRtb.Text) ? 0 : int.Parse(LD2OVRtb.Text);

            line2.LeftDefence = player;

            // Save 2nd pair right defence
            player         = new Player();
            player.Name    = RD2tb.Text;
            player.Overall = String.IsNullOrEmpty(RD2OVRtb.Text) ? 0 : int.Parse(RD2OVRtb.Text);

            line2.RightDefence = player;

            //--------------------------------------------  3rd Line / 3rd Pairing  --------------------------------------------
            EvenStrengthLines line3 = new EvenStrengthLines();

            line3.Line = 3;

            // Save 3rd line left wing
            player         = new Player();
            player.Name    = LW3tb.Text;
            player.Overall = String.IsNullOrEmpty(LW3OVRtb.Text) ? 0 : int.Parse(LW3OVRtb.Text);

            line3.LeftWing = player;

            // Save 3rd line center
            player         = new Player();
            player.Name    = C3tb.Text;
            player.Overall = String.IsNullOrEmpty(C3OVRtb.Text) ? 0 : int.Parse(C3OVRtb.Text);

            line3.Center = player;

            // Save 3rd line right wing
            player         = new Player();
            player.Name    = RW3tb.Text;
            player.Overall = String.IsNullOrEmpty(RW3OVRtb.Text) ? 0 : int.Parse(RW3OVRtb.Text);

            line3.RightWing = player;

            // Save 3rd pair left defence
            player         = new Player();
            player.Name    = LD3tb.Text;
            player.Overall = String.IsNullOrEmpty(LD3OVRtb.Text) ? 0 : int.Parse(LD3OVRtb.Text);

            line3.LeftDefence = player;

            // Save 3rd pair right defence
            player         = new Player();
            player.Name    = RD3tb.Text;
            player.Overall = String.IsNullOrEmpty(RD3OVRtb.Text) ? 0 : int.Parse(RD3OVRtb.Text);

            line3.RightDefence = player;

            //--------------------------------------------  4th Line  --------------------------------------------
            EvenStrengthLines line4 = new EvenStrengthLines();

            line4.Line = 4;

            // Save 4th line left wing
            player         = new Player();
            player.Name    = LW4tb.Text;
            player.Overall = String.IsNullOrEmpty(LW4OVRtb.Text) ? 0 : int.Parse(LW4OVRtb.Text);

            line4.LeftWing = player;

            // Save 4th line center
            player         = new Player();
            player.Name    = C4tb.Text;
            player.Overall = String.IsNullOrEmpty(C4OVRtb.Text) ? 0 : int.Parse(C4OVRtb.Text);

            line4.Center = player;

            // Save 4th line right wing
            player         = new Player();
            player.Name    = RW4tb.Text;
            player.Overall = String.IsNullOrEmpty(RW4OVRtb.Text) ? 0 : int.Parse(RW4OVRtb.Text);

            line4.RightWing = player;

            //--------------------------------------------  Goalies  --------------------------------------------
            Goalies goalies = new Goalies();

            // Save starting goalie
            player         = new Player();
            player.Name    = G1tb.Text;
            player.Overall = String.IsNullOrEmpty(G1OVRtb.Text) ? 0 : int.Parse(G1OVRtb.Text);

            goalies.Starter = player;

            // Save backup goalie
            player         = new Player();
            player.Name    = G2tb.Text;
            player.Overall = String.IsNullOrEmpty(G2OVRtb.Text) ? 0 : int.Parse(G2OVRtb.Text);

            goalies.Backup = player;

            //--------------------------------------------  Scratched  --------------------------------------------
            EvenStrengthLines scratched = new EvenStrengthLines();

            scratched.Line = 5;

            // Save scratched left wing
            player         = new Player();
            player.Name    = LW5tb.Text;
            player.Overall = String.IsNullOrEmpty(LW5OVRtb.Text) ? 0 : int.Parse(LW5OVRtb.Text);

            scratched.LeftWing = player;

            // Save scratched center
            player         = new Player();
            player.Name    = C5tb.Text;
            player.Overall = String.IsNullOrEmpty(C5OVRtb.Text) ? 0 : int.Parse(C5OVRtb.Text);

            scratched.Center = player;

            // Save scratched right wing
            player         = new Player();
            player.Name    = RW5tb.Text;
            player.Overall = String.IsNullOrEmpty(RW5OVRtb.Text) ? 0 : int.Parse(RW5OVRtb.Text);

            scratched.RightWing = player;

            // Save scratched left defence
            player         = new Player();
            player.Name    = LD4tb.Text;
            player.Overall = String.IsNullOrEmpty(LD4OVRtb.Text) ? 0 : int.Parse(LD4OVRtb.Text);

            scratched.LeftDefence = player;

            // Save scratched right defence
            player         = new Player();
            player.Name    = RD4tb.Text;
            player.Overall = String.IsNullOrEmpty(RD4OVRtb.Text) ? 0 : int.Parse(RD4OVRtb.Text);

            scratched.RightDefence = player;

            team.ESL[0]  = line1;
            team.ESL[1]  = line2;
            team.ESL[2]  = line3;
            team.ESL[3]  = line4;
            team.ESL[4]  = scratched;
            team.goalies = goalies;

            Methods.Add(TeamYearlb.SelectedItem.ToString(), JsonConvert.SerializeObject(team));
            Methods.SetCurrent(TeamYearlb.SelectedItem.ToString());

            // Save the setup
            using (StreamWriter file = File.CreateText(Path.Combine("..\\..\\Rosters\\", (team.Name + ".txt"))))
            {
                JsonSerializer serializer = new JsonSerializer();
                serializer.Serialize(file, Methods.GiveHistory <Dictionary <string, NHLTeam> >());
            }
        }