Exemple #1
0
        /// <summary>
        /// event to create the other that the user will use
        /// </summary>
        /// <param name="sender"> string datetime or string with the gap </param>
        /// <param name="e"></param>
        private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            //create a class to which pass the parameter
            StateObj st = new StateObj();

            st.Data = DateTime.Now.ToString("HH.mm.ss");//giving the parameter data the datetime
            Count++;
            if (Alarm == Count / 60)
            {
                _timer.Stop();
                Console.WriteLine("\nAlarm! Time's Up!\n");
                IsFinished = true;
            }
            DisplayDate(st, null);
            if (Count % Gap == 0) //when the module between gap and count has as a rest 0
            {
                st.Message = string.Format("{0} seconds passed!\r", Count);
            }
            DisplayGap(st, null);
        }
Exemple #2
0
        /// <summary>
        /// event to show the gap message
        /// </summary>
        /// <param name="sender"> string message </param>
        /// <param name="e"> null</param>
        private static void Ring_DisplayGap(object sender, EventArgs e)
        {
            StateObj obj = sender as StateObj;

            Console.Write(obj.Message + "\r");
        }