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 AwayFoulButtona(object sender, RoutedEventArgs e)
        {
            string       BeforeAway     = File.ReadAllText("bbAway.Foul");
            int          BeforeAwayFoul = Int32.Parse(BeforeAway);
            int          AfterAwayFoul  = BeforeAwayFoul + 1;
            StreamWriter Away_Foul;

            Away_Foul = File.CreateText("bbAway.Foul");
            Away_Foul.WriteLine(AfterAwayFoul);
            Away_Foul.Close();
            string Home     = File.ReadAllText("bbHome.Foul");
            string Away     = File.ReadAllText("bbAway.Foul");
            int    HomeFoul = Int32.Parse(Home);
            int    AwayFoul = Int32.Parse(Away);

            if (HomeFoul > AwayFoul)
            {
                this.AwayFouls.Background = Brushes.LightGreen;
                this.HomeFouls.Background = Brushes.LightCoral;
                string home = File.ReadAllText("bbHome.Foul");
                string away = File.ReadAllText("bbAway.Foul");
                this.HomeFouls.Text = home;
                this.AwayFouls.Text = away;
            }
            if (AwayFoul > HomeFoul)
            {
                this.HomeFouls.Background = Brushes.LightGreen;
                this.AwayFouls.Background = Brushes.LightCoral;
                string home = File.ReadAllText("bbHome.Foul");
                string away = File.ReadAllText("bbAway.Foul");
                this.HomeFouls.Text = home;
                this.AwayFouls.Text = away;
            }
            if (HomeFoul == AwayFoul)
            {
                this.AwayFouls.Background = Brushes.Yellow;
                this.HomeFouls.Background = Brushes.Yellow;
                string home = File.ReadAllText("bbHome.Foul");
                string away = File.ReadAllText("bbAway.Foul");
                this.HomeFouls.Text = home;
                this.AwayFouls.Text = away;
            }
        }