Пример #1
0
        static void Main(string[] args)
        {
            SmartThermometer smartThermometer = new SmartThermometer();

            smartThermometer.TurnOn();

            Console.WriteLine("Press any key for continuing...");
            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            SmartThermometer smartThermometer = new SmartThermometer();

            smartThermometer.HighTemperatureHandler += (s, e) =>
            {
                Console.WriteLine($"   警告,高溫出現,現在溫度為 {e.CurrentTemperature} 度");
            };
            smartThermometer.TurnOn();

            Console.WriteLine("Press any key for continuing...");
            Console.ReadKey();
        }