示例#1
0
        public string GetUserInput()
        {
            AlarmTimer alarmTimer = new AlarmTimer();

            Console.Write("Enter time to display your message");
            string TimeasString = Console.ReadLine();
            DateTime alarmTime;

            bool validTime = DateTime.TryParse(TimeasString, out alarmTime);
            RingTime = alarmTime;
            Console.Write("Enter message");
            alarmTimer.Message = Console.ReadLine();

               return alarmTimer.Message;
        }
示例#2
0
        static void Main(string[] args)
        {
            Alarm alarm = new Alarm();
            AlarmTimer alarmTimer = new AlarmTimer();

            Console.WriteLine("The current time is {0}", alarm.GetCurrentTime().ToString("h:mm tt"));
            Console.WriteLine();

            alarmTimer.Message = alarm.GetUserInput();

            alarmTimer.Milliseconds = alarm.CalculateTimeSpan();

            alarmTimer.CreateEvent();

            Console.ReadLine();
        }