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" )); }
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" )); }
public string AggregatedTimeLine(DateTimeOffset currentDateTime, ITimeSpanDisplayFormatter displayFormatter) { return(TimeLine.ToString(currentDateTime, displayFormatter)); }