Example #1
0
        public static string PrettyTotalTime(this IMusicPlayer mp)
        {
            long sum = 0;

            foreach (var track in mp.GetQueuedTracks())
            {
                if (track.Duration == TimeSpan.MaxValue)
                {
                    return("∞");
                }

                sum += track.Duration.Ticks;
            }

            var total = new TimeSpan(sum);

            return(total.ToString(@"hh\:mm\:ss"));
        }