Пример #1
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.Songs);
            lstValues.Add(showHidden);

            SongViewGenresConverter songGenres = new SongViewGenresConverter();

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

            SongViewArtistsConverter songArtists = new SongViewArtistsConverter();

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

            SongViewAlbumsConverter songAlbums = new SongViewAlbumsConverter();

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

            tags.Sort();
            return(tags.ToArray());
        }
        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]);
        }