예제 #1
0
파일: Form1.cs 프로젝트: fabestine1/MyThing
        public Form1()
        {
            InitializeComponent();
            ValentinosBike = new Motorbike("Valentino Rossi", 200);
            MarcsBike      = new Motorbike("Marc Marquez", 180);

            this.groupBox1.Text = ValentinosBike.NameOfDriver;
            this.groupBox2.Text = MarcsBike.NameOfDriver;

            UpdateValentinosDisplay(ValentinosBike, ValentinosBike.Speed);
            UpdateMarcsDisplay(MarcsBike, MarcsBike.Speed);

            ValentinosBike.speedChanged    += new Motorbike.SpeedChangedHandler(this.UpdateValentinosDisplay);
            ValentinosBike.speedingTooFast += new Motorbike.SpeedChangedHandler(this.ShowInListbox);
        }
예제 #2
0
파일: Form1.cs 프로젝트: fabestine1/MyThing
 private void Extra(Motorbike m, int currentSpeed)
 {
     MessageBox.Show(m.NameOfDriver + " goes too fast");
 }
예제 #3
0
파일: Form1.cs 프로젝트: fabestine1/MyThing
 private void ShowInListbox(Motorbike m, int s)
 {
     this.listBox1.Items.Add(m.NameOfDriver + " drives to fast by: " + s.ToString() + " km/h.");
 }
예제 #4
0
파일: Form1.cs 프로젝트: fabestine1/MyThing
 private void UpdateMarcsDisplay(Motorbike m, int currentSpeed)
 {
     this.label2.Text = m.Speed.ToString();
 }
예제 #5
0
파일: Form1.cs 프로젝트: fabestine1/MyThing
 private void UpdateValentinosDisplay(Motorbike m, int currentSpeed)
 {
     this.label1.Text = m.Speed.ToString();
     //or this.label1.Text = currentSpeed.ToString();
 }