コード例 #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();
        }
コード例 #2
0
        private void HomeFoulButtonh(object sender, RoutedEventArgs e)
        {
            string       BeforeHome     = File.ReadAllText("bbHome.Foul");
            int          BeforeHomeFoul = Int32.Parse(BeforeHome);
            int          AfterHomeFoul  = BeforeHomeFoul + 1;
            StreamWriter Home_Foul;

            Home_Foul = File.CreateText("bbHome.Foul");
            Home_Foul.WriteLine(AfterHomeFoul);
            Home_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;
            }
        }