Exemplo n.º 1
0
        private void BiggerScoreboard(object sender, RoutedEventArgs e)
        {
            if (File.Exists("bbHome.Score") & File.Exists("bbAway.Score") & File.Exists("bbHome.Foul") & File.Exists("bbAway.Foul"))
            {
            }
            else
            {
                StreamWriter Home_Score;
                StreamWriter Away_Score;
                StreamWriter Home_Foul;
                StreamWriter Away_Foul;
                Home_Score = File.CreateText("bbHome.Score");
                Home_Score.WriteLine("0");
                Home_Score.Close();
                Away_Score = File.CreateText("bbAway.Score");
                Away_Score.WriteLine("0");
                Away_Score.Close();
                Home_Foul = File.CreateText("bbHome.Foul");
                Home_Foul.WriteLine("0");
                Home_Foul.Close();
                Away_Foul = File.CreateText("bbAway.Foul");
                Away_Foul.WriteLine("0");
                Away_Foul.Close();
            }
            var scoreboard = new ScoreBoard();

            scoreboard.Show();
        }
        private void AwayThreePointButton(object sender, RoutedEventArgs e)
        {
            string       BeforeAway      = File.ReadAllText("bbAway.Score");
            int          BeforeAwayScore = Int32.Parse(BeforeAway);
            int          AfterAwayScore  = BeforeAwayScore + 3;
            StreamWriter Home_Score;

            Home_Score = File.CreateText("bbAway.Score");
            Home_Score.WriteLine(AfterAwayScore);
            Home_Score.Close();
            string Home      = File.ReadAllText("bbHome.Score");
            string Away      = File.ReadAllText("bbAway.Score");
            int    HomeScore = Int32.Parse(Home);
            int    AwayScore = Int32.Parse(Away);

            if (HomeScore > AwayScore)
            {
                this.HomeScore.Background = Brushes.LightGreen;
                this.AwayScore.Background = Brushes.LightCoral;
                string home = File.ReadAllText("bbHome.Score");
                string away = File.ReadAllText("bbAway.Score");
                this.HomeScore.Text = home;
                this.AwayScore.Text = away;
            }
            if (AwayScore > HomeScore)
            {
                this.AwayScore.Background = Brushes.LightGreen;
                this.HomeScore.Background = Brushes.LightCoral;
                string home = File.ReadAllText("bbHome.Score");
                string away = File.ReadAllText("bbAway.Score");
                this.HomeScore.Text = home;
                this.AwayScore.Text = away;
            }
            if (AwayScore == HomeScore)
            {
                this.AwayScore.Background = Brushes.Yellow;
                this.HomeScore.Background = Brushes.Yellow;
                string home = File.ReadAllText("bbHome.Score");
                string away = File.ReadAllText("bbAway.Score");
                this.HomeScore.Text = home;
                this.AwayScore.Text = away;
            }
        }