public void BoilWater() { for (int i = 0; i <= 99; i++) { temprature = i + 1; if (temprature > 97) { BoiledEventArgs e = new BoiledEventArgs(temprature, type, area); OnBoiled(e); } } }
public void Updata(BoiledEventArgs e) { if (!isDisplayedType) { Console.WriteLine("{0}-{1}:", e.Area, e.Type); Console.WriteLine(); isDisplayedType = true; } if (e.Temperature < 100) { Console.WriteLine("Alarm".PadRight(8) + ":水快烧开了,当前温度:{0}。", e.Temperature); } else { Console.WriteLine("Alarm".PadRight(8) + ":水已经烧开了!!"); } }
protected virtual void OnBoiled(BoiledEventArgs e) { base.Notify(e); }