Esempio n. 1
0
        /// <summary>
        /// 报警器
        /// </summary>
        public static void ShowAlarm(object sender, BoilEventArgs e)
        {
            Heater heater = (Heater)sender;

            System.Console.WriteLine("报警器:型号:{0}", heater.type);
            System.Console.WriteLine("报警器:产地:{0}", heater.area);
            System.Console.WriteLine("报警器:滴滴滴~~~~ 警报,警报!!! 水温{0}度", e.temperature);
        }
Esempio n. 2
0
        /// <summary>
        /// 显示器
        /// </summary>
        public static void ShowMsg(Object sender, BoilEventArgs e)
        {
            Heater heater = (Heater)sender;

            System.Console.WriteLine("显示器:型号:{0}", heater.type);
            System.Console.WriteLine("显示器:产地:{0}", heater.area);
            System.Console.WriteLine("显示器:水已开,当前温度{0}", e.temperature);
        }
Esempio n. 3
0
 /// <summary>
 /// 烧水
 /// </summary>
 public void Boilwater()
 {
     System.Console.WriteLine("烧水中......");
     for (int i = 0; i < 100; i++)
     {
         temperature = i;
         if (temperature == 90)
         {
             //建立BoiledEventArgs 对象。
             BoilEventArgs e = new BoilEventArgs(temperature);
             if (Boil != null)
             {
                 Boil(this, e);
             }
             return;
         }
         System.Console.WriteLine($"当前温度: {temperature}");
     }
 }