Esempio n. 1
0
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Length == 3)
            {
                if (values[0] is TimeSpan)
                {
                    TimeSpan duration = (TimeSpan)values[0];

                    if (values[1] is TimeSpan)
                    {
                        TimeSpan position = (TimeSpan)values[1];

                        if (values[2] is Boolean)
                        {
                            Boolean showTimeRemaining = (Boolean)values[2];

                            TimeSpan result = (showTimeRemaining ? duration - position : duration);

                            TimeSpanStringConverter tssc = new TimeSpanStringConverter();
                            return(tssc.Convert(result, targetType, parameter, culture));
                        }
                    }
                }
            }

            return(String.Empty);
        }
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Length == 2)
            {
                if (values[0] is TimeSpan)
                {
                    TimeSpan ts = (TimeSpan)values[0];

                    MediaItem mediaItem = values[1] as MediaItem;

                    if (mediaItem != null)
                    {
                        TimeSpanStringConverter tssc = new TimeSpanStringConverter();
                        return(tssc.Convert(ts, targetType, parameter, culture));
                    }
                }
            }

            return(String.Empty);
        }