public static string DateTimeAgo(this DateTime date)
        {
            TimeSpan span = DateTime.Now - date;
            string timeAsSting = string.Empty;

            var yearsHandler = new YearsHandler();
            var monthsHandler = new MonthsHandler();
            var daysHandler = new DaysHandler();
            var hoursHandler = new HoursHandler();
            var minutesHandler = new MinutesHandler();
            var secondsHandler = new SecondsHandler();
            var justNowHandler = new JustNowHandler();

            yearsHandler.SetSuccessor(monthsHandler);
            monthsHandler.SetSuccessor(daysHandler);
            daysHandler.SetSuccessor(hoursHandler);
            hoursHandler.SetSuccessor(minutesHandler);
            minutesHandler.SetSuccessor(secondsHandler);
            secondsHandler.SetSuccessor(justNowHandler);

            return yearsHandler.HandleDateSpan(span, timeAsSting);
        }
Esempio n. 2
0
 public void AddCallback(SecondsHandler handler)
 {
     callback += handler;
 }
Esempio n. 3
0
 public void AdicionarCallBack(SecondsHandler handler)
 {
     callbacks += handler;
 }