コード例 #1
0
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Length == 2)
            {
                if (values[0] is MediaItem)
                {
                    MediaItem            mediaItem = values[0] as MediaItem;
                    IMultiValueConverter valueConverter;

                    switch (mediaItem.Type)
                    {
                    case MediaItemTypeEnum.Video:
                        valueConverter = new VideoViewGenresConverter();
                        break;

                    case MediaItemTypeEnum.Song:
                        valueConverter = new SongViewGenresConverter();
                        break;

                    default:
                        throw new UnknownEnumValueException(mediaItem.Type);
                    }

                    return(valueConverter.Convert(values, targetType, parameter, culture));
                }
            }

            return(new IntelligentString[0]);
        }
コード例 #2
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            List <IntelligentString> tags = new List <IntelligentString>();

            Boolean?showHidden = value as Boolean?;

            MediaPlayerDialog mpd       = Application.Current.MainWindow as MediaPlayerDialog;
            List <object>     lstValues = new List <object>();

            lstValues.Add(mpd.Videos);
            lstValues.Add(showHidden);

            VideoViewGenresConverter videoGenres = new VideoViewGenresConverter();

            tags.AddRange((IEnumerable <IntelligentString>)videoGenres.Convert(lstValues.ToArray(), targetType, parameter, culture));

            VideoViewProgramsConverter videoPrograms = new VideoViewProgramsConverter();

            tags.AddRange((IEnumerable <IntelligentString>)videoPrograms.Convert(lstValues.ToArray(), targetType, parameter, culture));

            tags.Sort();
            return(tags.ToArray());
        }