private void NameBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (!ExistingTeams.Contains(TeamNumber))
     {
         if (TeamName.Trim() != "")
         {
             OKBtn.IsEnabled     = true;
             NameBox.BorderBrush = new SolidColorBrush(GRAY_BORDER);
             NameBox.ToolTip     = null;
         }
         else
         {
             OKBtn.IsEnabled     = false;
             NameBox.BorderBrush = new SolidColorBrush(Colors.Red);
             NameBox.ToolTip     = "You must specify a name.";
         }
     }
 }
        private void NumberBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            int  n      = -1;
            bool worked = int.TryParse(NumberBox.Text, out n);

            if (!worked)
            {
                NumberBox.Text = TeamNumber.ToString();
            }
            else if (ExistingTeams.Contains(n))
            {
                NumberBox.BorderBrush = new SolidColorBrush(Colors.Red);
                NumberBox.ToolTip     = "A team with that number already exists.";
                OKBtn.IsEnabled       = false;
            }
            else
            {
                TeamNumber = n;

                NumberBox.BorderBrush = new SolidColorBrush(GRAY_BORDER);
                NumberBox.ToolTip     = null;

                if (TeamName.Trim() != "")
                {
                    OKBtn.IsEnabled     = true;
                    NameBox.BorderBrush = new SolidColorBrush(GRAY_BORDER);
                    NameBox.ToolTip     = null;
                }
                else
                {
                    OKBtn.IsEnabled     = false;
                    NameBox.BorderBrush = new SolidColorBrush(Colors.Red);
                    NameBox.ToolTip     = "You must specify a name.";
                }
            }
        }