示例#1
0
 public Form1()
 {
     InitializeComponent();
     scoreComputer = null;
     textBox1.Text = "8";
     textBox2.Text = "2";
 }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            correct = Convert.ToInt16(textBox1.Text);
            incorrect = Convert.ToInt16(textBox2.Text);

            if (rdo_Adult.Checked)
            {
                scoreComputer = new ScorerDelegate(Scorer.AdultScore);
            }
            if (rdo_Child.Checked)
            {
                scoreComputer = new ScorerDelegate(Scorer.ChildScore);
            }
            if (scoreComputer != null)
            {
                computeScore(scoreComputer);
            }
        }
示例#3
0
 public void computeScore(ScorerDelegate scoreDelegate)
 {
     int score = scoreDelegate(correct, incorrect);
     textBox3.Text = Convert.ToString(score);
 }