Exemplo n.º 1
0
        public static void ShowMsg(Object sender, Heater.HeatEventArgs e)        //静态方法
        {
            Heater heater = (Heater)sender;

            Console.WriteLine("{0} - {1}: ", heater.area, heater.type);
            Console.WriteLine("管道超温了,当前温度:{0}度。", e.temperature);
            Console.WriteLine();
        }
Exemplo n.º 2
0
        public void MakeAlert(Object sender, Heater.HeatEventArgs e)
        {
            Heater heater = (Heater)sender;

            //访问 sender 中的公共字段
            Console.WriteLine("{0} - {1}: ", heater.area, heater.type);
            int a = 0X7FF;    //发生频率(Hz)
            int b = 1000;     //持续时间(毫秒)

            Beep(a, b);
            Console.WriteLine("管道已经 {0} 度了:", e.temperature);
            Console.WriteLine();
        }