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; }
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(); }