Exemplo n.º 1
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            TimeSpan progress      = (TimeSpan)values[0];
            TimeSpan duration      = (TimeSpan)values[1];
            TimeSpan hoverposition = (TimeSpan)values[2];

            TimeSpan timeLeft    = hoverposition - progress;
            TimeSpan timeLeftAbs = timeLeft.Abs();

            string prefix = timeLeft < TimeSpan.Zero ? "-" : "+";

            string format = duration >= TimeSpan.FromHours(1) ? "hh\\:mm\\:ss" : "mm\\:ss";

            string result = hoverposition.ToString(format) + " (" + prefix + timeLeftAbs.ToString(format) + ")";

            return(result);
        }
Exemplo n.º 2
0
 public static void WithIn(this TimeSpan timeSpan, TimeSpan delta, string message = "")
 => timeSpan.Abs().Is(abs => abs < delta, message);