Esempio n. 1
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            MyMusicDetails albumViewDetails = VisualTreeExtensions.FindParent <MyMusicDetails>(container);

            if (item is AlbumViewTitle)
            {
                return(albumViewDetails.FindResource("AlbumViewTitleDataTemplate") as DataTemplate);
            }
            else
            {
                return(albumViewDetails.FindResource("AlbumViewItemDataTemplate") as DataTemplate);
            }
        }
Esempio n. 2
0
        private void SetNewViewMode(MainControls.CurrentViewMode value)
        {
            currentViewMode = value;

            ExtendedSearchUserControl.FieldType = FieldType.TrackAndCD;

            switch (value)
            {
            case CurrentViewMode.None:
                break;

            case CurrentViewMode.MyMusicDetails:
                View = new MyMusicDetails()
                {
                    ShowItemType = this.ShowItemType
                };
                splitButtonView.Image = ImageLoader.FromResource("ViewDetails.png");
                if (this.ShowItemType == MainControls.ShowItemType.Directory)
                {
                    Settings.Current.DirectoryViewType = 0;
                }
                else
                {
                    Settings.Current.MyMusicViewType = 0;
                }
                break;

            case CurrentViewMode.MyMusicTable:
                splitButtonView.Image = ImageLoader.FromResource("ViewTable.png");

                if (this.ShowItemType == MainControls.ShowItemType.Directory)
                {
                    Settings.Current.DirectoryViewType = 1;
                }
                else
                {
                    Settings.Current.MyMusicViewType = 1;
                }
                View = new MyMusicTable()
                {
                    ShowItemType = this.ShowItemType
                };
                break;

            case CurrentViewMode.AlbumTable:
                View = new AlbumViewTable();
                splitButtonView.Image               = ImageLoader.FromResource("ViewTable.png");
                Settings.Current.AlbumViewType      = 1;
                ExtendedSearchUserControl.FieldType = FieldType.CD;
                break;

            case CurrentViewMode.AlbumSymbols:
                View = new AlbumViewSymbols();
                splitButtonView.Image          = ImageLoader.FromResource("ViewImages.png");
                Settings.Current.AlbumViewType = 0;

                ExtendedSearchUserControl.FieldType = FieldType.CD;
                break;

            case CurrentViewMode.MediumTable:
                AlbumListTable albumView = new AlbumListTable();
                splitButtonView.Image     = ImageLoader.FromResource("ViewTable.png");
                albumView.CurrentViewMode = currentViewMode;
                View = albumView;
                break;

            case CurrentViewMode.PersonGroupDetails:
                splitButtonView.Image = ImageLoader.FromResource("ViewImages.png");
                View = new PersonGroupViewDetails();
                break;

            case CurrentViewMode.PersonGroupTable:
                splitButtonView.Image = ImageLoader.FromResource("ViewTable.png");
                View = new PersonGroupViewTable();
                break;

            case CurrentViewMode.ArtistTable:
            case CurrentViewMode.ComposerTable:
            case CurrentViewMode.GenreTable:
            case CurrentViewMode.YearTable:
            case CurrentViewMode.RatingTable:
                splitButtonView.Image = ImageLoader.FromResource("ViewTable.png");
                TrackListTable trackList = new TrackListTable();
                trackList.CurrentViewMode = currentViewMode;
                View = trackList;
                break;

            case CurrentViewMode.ArtistDetails:
            case CurrentViewMode.ComposerDetails:
                splitButtonView.Image = ImageLoader.FromResource("ViewImages.png");
                TrackListDetails trackListDetails = new TrackListDetails();
                trackListDetails.CurrentViewMode = currentViewMode;
                View = trackListDetails;
                break;

            default:
                break;
            }

            MenuItemCoverView.Visibility = (currentViewMode == MainControls.CurrentViewMode.AlbumSymbols ||
                                            currentViewMode == MainControls.CurrentViewMode.AlbumTable ||
                                            currentViewMode == MainControls.CurrentViewMode.ArtistDetails ||
                                            currentViewMode == MainControls.CurrentViewMode.ArtistTable ||
                                            currentViewMode == MainControls.CurrentViewMode.ComposerDetails ||
                                            currentViewMode == MainControls.CurrentViewMode.ComposerTable) ?
                                           System.Windows.Visibility.Visible :
                                           System.Windows.Visibility.Collapsed;

            MenuItemAlbumView.Visibility = (currentViewMode == MainControls.CurrentViewMode.MyMusicDetails ||
                                            currentViewMode == MainControls.CurrentViewMode.MyMusicTable) ?
                                           System.Windows.Visibility.Visible :
                                           System.Windows.Visibility.Collapsed;

            if (currentViewMode == MainControls.CurrentViewMode.ArtistDetails ||
                currentViewMode == MainControls.CurrentViewMode.ArtistTable)
            {
                MenuItemCoverView.Header = StringTable.ImageView;
            }
            else
            {
                MenuItemCoverView.Header = StringTable.AlbumView;
            }

            this.ExtendedSearchToggleButton.Visibility =
                (CurrentViewMode == MainControls.CurrentViewMode.MyMusicTable ||
                 CurrentViewMode == MainControls.CurrentViewMode.MyMusicDetails ||
                 CurrentViewMode == MainControls.CurrentViewMode.AlbumSymbols ||
                 CurrentViewMode == MainControls.CurrentViewMode.AlbumTable) ?
                Visibility.Visible :
                Visibility.Collapsed;

            if (albumView1Visible)
            {
                albumView1Visible = false;
                AlbumViewTransitionBox.Content = View as UserControl;
            }
            else
            {
                albumView1Visible = true;
                AlbumViewTransitionBox.Content = View as UserControl;
            }

            View.OpenCD            += new EventHandler(View_OpenCD);
            View.FillListCompleted += new EventHandler(View_FillListCompleted);
        }