public void MakeAlert(object sender, BoildEventArgs e) { StandardEvent heater = (StandardEvent)sender; Console.WriteLine($"滴滴滴滴,温度超过{heater.temperature}"); Console.WriteLine("{0},{1}", heater.type, heater.name); }
public static void DisplayTemperature(object sender, BoildEventArgs e) { StandardEvent heater = (StandardEvent)sender; Console.WriteLine($"温度{heater.temperature}"); Console.WriteLine("{0},{1}", heater.type, heater.name); }
public void BoilWater() { for (int i = 0; i < 100; i++) { temperature = i; } if (temperature >= 96) { BoildEventArgs e = new BoildEventArgs(temperature); BoilEvent?.Invoke(this, e); } }