Exemple #1
0
        static void Main(string[] args)
        {
            Clock clock = new Clock();

            Console.Write("请输入定时时间(单位为秒) : \n");
            float seconds = Convert.ToSingle(Console.ReadLine());

            while (seconds <= 0)
            {
                Console.WriteLine("请输入大于0的时间");
                seconds = Convert.ToSingle(Console.ReadLine());
            }

            ClockRegister register = new ClockRegister(seconds, "用户");

            clock.Register(register);
            clock.Notify();

            Console.Read();
        }
Exemple #2
0
 public void Register(ClockRegister register)
 {
     _clockEvent += register.Notify;
 }