private void FillData(Player player)
 {
     try
     {
         TB_Name.Text = player.Name;
         CB_SuddenDeathSmasher.SelectedIndex = CB_SuddenDeathSmasher.Items.IndexOf(player.SuddenDeathSmasherName);
     }
     catch(Exception e)
     {
         MessageBox.Show(this, "There was an error filling the data: " + e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 private void BTN_Select_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(CB_PlayerSelector.Text))
     {
         MessageBox.Show(this, "You must select a player!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     else
     {
         SelectedPlayer = Players.Find(p => p.Name == CB_PlayerSelector.Text);
         DialogResult = true;
         Close();
     }
 }
        private void BTN_Submit_Click(object sender, RoutedEventArgs e)
        {
            if (ValidateData())
            {
                Player newPlayer = new Player(TB_Name.Text);
                newPlayer.SuddenDeathSmasherName = CB_SuddenDeathSmasher.Text;

                //newPlayer.WriteToFile();
                Player = newPlayer;

                DialogResult = true;
                Close();
            }
        }
Example #4
0
        /// <summary>
        /// initialize the Cell
        /// </summary>
        public PlayerCell(Player player)
        {
            InitializeComponent();
            Data = new PlayerCellWrapper(player);

            //try
            //{
            //    Color fill = Color.FromArgb(255, player.ColorR, player.ColorG, player.ColorB);
            //    R_Background.Fill = new SolidColorBrush(fill);
            //}
            //catch (Exception) { }

            CB_PlaceSelector.ItemsSource = PlacementOptions;
            try
            {
                OnPlayerChanged();
                OnSmasherChanged();
            }
            catch (Exception e)
            {
                MessageBox.Show("There was an error creating the PlayerCell: " + e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Example #5
0
 public PlayerCellWrapper(Player player)
 {
     Player = player;
     Smasher = Player.SuddenDeathSmasher;
 }
Example #6
0
 public string GetRankForPlayer(Player player)
 {
     if (PlayerRank.ContainsKey(player))
     {
         return PlayerRank[player];
     }
     else
     {
         throw new ArgumentException("The player: " + player.Name + " could not be found.");
     }
 }
Example #7
0
 public void GiveRankToPlayer(string rank, Player player)
 {
     PlayerRank[player] = rank;
 }