public void Populate() { if (_filePath != null && _filePath != "") { string line = ""; char splitter = ';'; StreamReader reader = new StreamReader(_filePath); while ((line = reader.ReadLine()) != null) { string[] data = line.Split(splitter); Player player = new Player(); player.Name = data[1]; player.Points = Int32.Parse(data[3]); player.Salary = Double.Parse(data[4]); String position = data[2]; switch (position) { case "LW": player.Position = Position.LeftWing; this.LeftWings.Add(player); break; case "C": player.Position = Position.Center; this.Centers.Add(player); break; case "RW": player.Position = Position.RightWing; this.RightWings.Add(player); break; case "D": player.Position = Position.Defenseman; this.Defensemen.Add(player); break; case "G": player.Position = Position.Goaltender; this.Goaltenders.Add(player); break; } } reader.Close(); } }
private void MakePlayerUnavailable(Player player, Button btnLockIn, Button btnUnavailable) { player.Picked = false; player.Available = false; this.DisplayOptimalRoster(); }
private void UnpickPlayer(Player player, Button btnLockIn, Button btnUnavailable) { player.Picked = false; player.Available = true; btnLockIn.Text = "Pick"; btnUnavailable.Enabled = true; }