Beispiel #1
0
 public string AggregatedSubscriptions(DateTimeOffset currentDateTime,
                                       ITimeSpanDisplayFormatter displayFormatter)
 {
     return
         ((
              from subscription in _subscriptions
              from message in subscription.Value.Messages
              select new
     {
         UserName = subscription.Key,
         MessageDateTime = message.Key,
         Message = message.Value
     }
              )
          .Union
          (
              from message in TimeLine.Messages
              select new
     {
         UserName = Name,
         MessageDateTime = message.Key,
         Message = message.Value
     }
          )
          .OrderByDescending(m => m.MessageDateTime)
          .Aggregate
          (
              string.Empty,
              (current, item) =>
              current +
              $"{item.UserName} - {item.Message} ({displayFormatter.GetFormattedDisplayString(currentDateTime.Subtract(item.MessageDateTime))} ago)\r\n"
          ));
 }
Beispiel #2
0
 public string ToString(DateTimeOffset dateTime, ITimeSpanDisplayFormatter displayFormatter)
 {
     return(Messages
            .OrderByDescending(t => t.Key)
            .Aggregate
            (
                string.Empty,
                (current, item) => current + $"{item.Value} ({displayFormatter.GetFormattedDisplayString(dateTime.Subtract(item.Key))} ago)\r\n"
            ));
 }
Beispiel #3
0
 public string AggregatedTimeLine(DateTimeOffset currentDateTime, ITimeSpanDisplayFormatter displayFormatter)
 {
     return(TimeLine.ToString(currentDateTime, displayFormatter));
 }