示例#1
0
        private void itemsControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (CurrentViewMode == MainControls.CurrentViewMode.ArtistDetails ||
                CurrentViewMode == MainControls.CurrentViewMode.ComposerDetails)
            {
                if (e.LeftButton == MouseButtonState.Pressed)
                {
                    ListBoxItem item = VisualTreeExtensions.FindParent <ListBoxItem>(e.OriginalSource as DependencyObject);
                    if (item != null)
                    {
                        TrackListItem tli         = item.DataContext as TrackListItem;
                        PersonGroup   personGroup = DataBase.GetPersonGroupByName(tli.Name, false);

                        PersonGroupWindow personGroupWindow = new PersonGroupWindow(DataBase,
                                                                                    CurrentViewMode == MainControls.CurrentViewMode.ArtistDetails ? PersonType.Artist : PersonType.Composer,
                                                                                    personGroup);
                        personGroupWindow.ChangeAllSoundFiles = true;
                        personGroupWindow.Owner = Window.GetWindow(this);
                        personGroupWindow.ShowDialog();

                        UpdateTrackListItem(tli);
                    }
                }
            }
        }
示例#2
0
        private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (VisualTreeExtensions.FindParent <DataGridRow>(e.OriginalSource as DependencyObject) != null)
            {
                AlbumListItem item = dataGrid.SelectedItem as AlbumListItem;
                if (item != null)
                {
                    switch (CurrentViewMode)
                    {
                    case CurrentViewMode.MediumTable:
                    {
                        ChangeViewCommandParameters changeViewParams = new ChangeViewCommandParameters();
                        changeViewParams.ViewMode = MainControls.CurrentViewMode.AlbumTable;

                        Big3.Hitbase.DataBaseEngine.Condition condition = new Big3.Hitbase.DataBaseEngine.Condition();
                        condition.Add(new SingleCondition(Field.Medium, Operator.Equal, item.Title));
                        changeViewParams.Condition = condition;

                        CatalogViewCommands.ChangeView.Execute(changeViewParams, this);
                        break;
                    }
                    }
                }
            }
        }
示例#3
0
        private void ButtonMultiLineEdit_Click(object sender, RoutedEventArgs e)
        {
            DataGridRow  row  = VisualTreeExtensions.FindParent <DataGridRow>(e.OriginalSource as DependencyObject);
            DataGridCell cell = VisualTreeExtensions.FindParent <DataGridCell>(e.OriginalSource as DependencyObject);

            Field     field = (Field)cell.Column.GetValue(Big3.Hitbase.Controls.DataGridExtensions.FieldProperty);
            AlbumItem album = row.DataContext as AlbumItem;

            WindowMultiline wm = new WindowMultiline();

            wm.Owner = Window.GetWindow(this);
            object textValue = album.Comment;

            if (textValue != null)
            {
                wm.Text = textValue.ToString();
            }
            wm.Title = DataBase.GetNameOfField(field);
            if (wm.ShowDialog() == true)
            {
                // Im Moment hier nur Read-Only

/*                cell.IsEditing = true;
 *              track.SetValueToField(field, wm.Text);
 *              cell.IsEditing = false;*/
            }
        }
示例#4
0
        private void RatingCell_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            DataGridRow       row               = VisualTreeExtensions.FindParent <DataGridRow>((DependencyObject)e.OriginalSource);
            DataGridCell      cell              = VisualTreeExtensions.FindParent <DataGridCell>((DependencyObject)e.OriginalSource);
            DataGridColumn    column            = cell.Column;
            RatingUserControl ratingUserControl = sender as RatingUserControl;
            MyMusicListItem   musicItem         = row.DataContext as MyMusicListItem;

            dataGrid.CommitEdit(DataGridEditingUnit.Row, true);

            if (this.dataGrid.SelectedItems.Count > 1)
            {
                WpfMessageBoxResult result = WPFMessageBox.Show(Window.GetWindow(this),
                                                                StringTable.MultiTagEdit, StringTable.MultiTagEditWarning,
                                                                "/Big3.Hitbase.SharedResources;component/Images/RenameLarge.png",
                                                                WpfMessageBoxButtons.YesNo, "MultiTagEdit", false);

                if (result == WpfMessageBoxResult.Yes)
                {
                    Field field       = (Field)column.GetValue(DataGridExtensions.FieldProperty);
                    int   columnIndex = column.DisplayIndex - 1;
                    musicItem.Items[columnIndex] = ratingUserControl.Rating;
                    PerformMultiEdit(musicItem, field, columnIndex);
                }
            }
            else
            {
                Field field = (Field)column.GetValue(DataGridExtensions.FieldProperty);
                musicItem.Items[column.DisplayIndex - 1] = ratingUserControl.Rating;
                EditTrackField(column.DisplayIndex - 1, field, musicItem);
            }
        }
示例#5
0
        private void AddButtonClicked()
        {
            try
            {
                var parent = VisualTreeExtensions.FindParent <MainCalendarView>(this);
                if (parent == null)
                {
                    throw new NullReferenceException("Couldn't find parent.");
                }

                CalendarViewModel viewModel = parent.ViewModel;
                if (viewModel == null)
                {
                    throw new NullReferenceException("Parent's view model was null");
                }

                App.ShowFlyoutAddHomeworkOrExam(
                    elToCenterFrom: _addButton,
                    addHomeworkAction: delegate { viewModel.AddHomework(base.Date); },
                    addExamAction: delegate { viewModel.AddExam(base.Date); },
                    addHolidayAction: delegate { viewModel.AddHoliday(base.Date); });
            }

            catch (Exception ex)
            {
                TelemetryExtension.Current?.TrackException(ex);
            }
        }
示例#6
0
        private void SearchPictureButton_Click(object sender, RoutedEventArgs e)
        {
            ListBoxItem         lbi  = VisualTreeExtensions.FindParent <ListBoxItem>(e.OriginalSource as DependencyObject);
            PersonGroupViewItem pgvi = lbi.DataContext as PersonGroupViewItem;

            Canvas overlayPopupCanvas = VisualTreeExtensions.FindVisualChildByName <Canvas>(Window.GetWindow(this), "OverlayPopupCanvas");
            PictureSearchUserControl pictureSearchPopup = new PictureSearchUserControl();

            pictureSearchPopup.Width  = 620;
            pictureSearchPopup.Height = 180;
            DropShadowEffect dse = new DropShadowEffect();

            dse.Color = Colors.LightGray;
            pictureSearchPopup.Effect = dse;

            overlayPopupCanvas.Children.Clear();
            overlayPopupCanvas.Children.Add(pictureSearchPopup);

            pictureSearchPopup.SetValue(Canvas.TopProperty, Mouse.GetPosition(overlayPopupCanvas).Y);
            pictureSearchPopup.SetValue(Canvas.LeftProperty, Mouse.GetPosition(overlayPopupCanvas).X);
            overlayPopupCanvas.Visibility = System.Windows.Visibility.Visible;
            pictureSearchPopup.Search(pgvi.Name);
            pictureSearchPopup.PictureSelected += new EventHandler(PictureSearchPopup_PictureSelected);
            pictureSearchPopup.CloseClicked    += new EventHandler(PictureSearchPopup_CloseClicked);
        }
示例#7
0
 private void DataGridResult_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (VisualTreeExtensions.FindParent <DataGridRow>(e.OriginalSource as DependencyObject) != null)
     {
         ShowDetails();
     }
 }
示例#8
0
        private void AddToPlaylistPlayLast(object sender, System.Windows.RoutedEventArgs e)
        {
            DataGridRow     dataGridRow     = VisualTreeExtensions.FindParent <DataGridRow>((System.Windows.DependencyObject)sender);
            MyMusicListItem myMusicListItem = dataGridRow.DataContext as MyMusicListItem;

            if (myMusicListItem != null)
            {
                string soundFile = DataBase.GetSoundfileByTrackId(myMusicListItem.ID);
                AddTracksFromSearchResult(soundFile, AddTracksToPlaylistType.End);
            }
        }
示例#9
0
        private void ItemContainer_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            ListBoxItem item = VisualTreeExtensions.FindParent <ListBoxItem>(e.OriginalSource as DependencyObject);

            if (item != null)
            {
                PictureSearchItem pictureSearchItem = item.DataContext as PictureSearchItem;

                LoadOriginalImage(pictureSearchItem);
            }
        }
示例#10
0
        private void AddToPlaylistPreListen(object sender, System.Windows.RoutedEventArgs e)
        {
            DataGridRow     dataGridRow     = VisualTreeExtensions.FindParent <DataGridRow>((System.Windows.DependencyObject)sender);
            MyMusicListItem myMusicListItem = dataGridRow.DataContext as MyMusicListItem;

            if (myMusicListItem != null)
            {
                Track track = DataBase.GetTrackById(myMusicListItem.ID);

                HitbaseCommands.PreListenTrack.Execute(track, this);
            }
        }
 private void listBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (VisualTreeExtensions.FindParent <ListBoxItem>(e.OriginalSource as DependencyObject) != null)
     {
         AlbumViewItem selItem = listBox.SelectedItem as AlbumViewItem;
         if (selItem != null)
         {
             OpenCD(this, new EventArgs());
             UpdateAlbumViewItem(selItem);
         }
     }
 }
示例#12
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);
            }
        }
示例#13
0
        private void RatingCell_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            DataGridRow row       = VisualTreeExtensions.FindParent <DataGridRow>((DependencyObject)e.OriginalSource);
            AlbumItem   albumItem = row.DataContext as AlbumItem;

            RatingUserControl ratingUserControl = sender as RatingUserControl;
            int rating = ratingUserControl.Rating;

            CD cd = DataBase.GetCDById(albumItem.ID);

            cd.Rating = rating;
            cd.Save(DataBase);
        }
        private void ChoosePictureUserControl_ImageChanged(object sender, EventArgs e)
        {
            ChoosePictureUserControl choosePictureUserControl = sender as ChoosePictureUserControl;

            ListBoxItem item = VisualTreeExtensions.FindParent <ListBoxItem>(choosePictureUserControl as DependencyObject);

            if (item != null)
            {
                AlbumViewItem selItem = item.DataContext as AlbumViewItem;

                selItem.ImageFilename = choosePictureUserControl.ImageFilename;
            }
        }
示例#15
0
        Big3.Hitbase.DataBaseEngine.Track GetTrack(DependencyObject dep)
        {
            ListBoxItem lbi = VisualTreeExtensions.FindParent <ListBoxItem>(dep);

            if (lbi != null)
            {
                ListBox lb    = VisualTreeExtensions.FindParent <ListBox>(dep);
                Track   track = lb.ItemContainerGenerator.ItemFromContainer(lbi) as Track;

                return(track);
            }

            return(null);
        }
示例#16
0
        private void AddTracksToPlaylistPreListen_Click(object sender, RoutedEventArgs e)
        {
            ContextMenu cm      = VisualTreeExtensions.FindParent <ContextMenu>(sender as DependencyObject);
            ListBox     listBox = cm.PlacementTarget as ListBox;

            if (listBox.SelectedItems.Count == 0)
            {
                return;
            }

            Track track = listBox.SelectedItems[0] as Track;

            HitbaseCommands.PreListenTrack.Execute(track, this);
        }
示例#17
0
        private void listBoxWishlist_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                ListBoxItem lbi = VisualTreeExtensions.FindParent <ListBoxItem>(e.OriginalSource as DependencyObject);
                if (lbi != null)
                {
                    WishlistItem wishlistItem = lbi.DataContext as WishlistItem;

                    FormWishlistItem formWishlistItem = new FormWishlistItem(wishlistItem);
                    formWishlistItem.ShowDialog();
                }
            }
        }
示例#18
0
        private void dataGrid_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGridRow row = VisualTreeExtensions.FindParent <DataGridRow>(e.OriginalSource as DependencyObject);

            if (row != null)
            {
                dataGrid.CancelEdit(DataGridEditingUnit.Row);

                MyMusicListItem listItem = ((MyMusicListItem)row.DataContext);
                Track           track    = DataBase.GetTrackById(listItem.ID);
                HitbaseCommands.OpenTrack.Execute(track, this);
                e.Handled = true;
                UpdateMyMusicList(listItem);
            }
        }
示例#19
0
        private void dataGrid_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (VisualTreeExtensions.FindParent <DataGridRow>(e.OriginalSource as DependencyObject) != null)
            {
                AlbumItem selItem = dataGrid.SelectedItem as AlbumItem;
                if (selItem != null)
                {
                    dataGrid.CancelEdit(DataGridEditingUnit.Row);

                    OpenCD(this, new EventArgs());
                    UpdateAlbumItem(selItem);
                    e.Handled = true;
                }
            }
        }
示例#20
0
        private UIElement GetSelectableObject(UIElement element)
        {
            while (element != null)
            {
                bool isSelectable = (bool)element.GetValue(CoverElementExtensions.IsSelectableProperty);

                if (isSelectable)
                {
                    return(element);
                }

                element = VisualTreeExtensions.FindParent <UIElement>(element);
            }

            return(null);
        }
示例#21
0
        void TreeView_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            TreeViewItem item = VisualTreeExtensions.FindParent <TreeViewItem>((DependencyObject)e.OriginalSource);

            if (item == null)
            {
                return;
            }

            e.Handled = true;

            if (DoubleClick != null)
            {
                DoubleClick(sender, new EventArgs());
            }
        }
示例#22
0
        private void itemsControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ListBoxItem item = VisualTreeExtensions.FindParent <ListBoxItem>(e.OriginalSource as DependencyObject);

            if (item != null)
            {
                PersonGroupViewItem pgvi = itemsControl.SelectedItem as PersonGroupViewItem;
                //            OpenCD(avi.ID);

                PersonGroupProperties pgp = new PersonGroupProperties();
                pgp.DataBase    = DataBase;
                pgp.PersonGroup = DataBase.GetPersonGroupById(pgvi.ID);
                pgp.PersonType  = PersonType.Unknown;
                GlobalServices.ModalService.NavigateTo(pgp, StringTable.EditPersonGroup, delegate(bool returnValue)
                {
                });
            }
        }
示例#23
0
        private void itemsControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ListBoxItem listBoxItem = VisualTreeExtensions.FindParent <ListBoxItem>(e.OriginalSource as DependencyObject);

            if (listBoxItem != null && listBoxItem.DataContext is Track)
            {
                HitbaseCommands.OpenTrack.Execute(listBoxItem.DataContext, this);

                ListBoxItem   lbItem = VisualTreeExtensions.FindParent <ListBoxItem>(listBoxItem);
                AlbumViewItem item   = lbItem.DataContext as AlbumViewItem;
                UpdateAlbumItem(item);
            }
            else
            {
                if (listBoxItem != null && listBoxItem.DataContext is AlbumViewItem)
                {
                    OpenCD(this, new EventArgs());

                    AlbumViewItem item = listBoxItem.DataContext as AlbumViewItem;
                    UpdateAlbumItem(item);
                }
            }
        }
        private void ButtonShowDetails_Click(object sender, RoutedEventArgs e)
        {
            DataGridRow row = VisualTreeExtensions.FindParent <DataGridRow>(sender as DependencyObject);

            if (row != null)
            {
                StatisticsItem item = row.DataContext as StatisticsItem;
                Big3.Hitbase.DataBaseEngine.Condition condition = new DataBaseEngine.Condition();
                string          image    = "";
                string          title    = "";
                CurrentViewMode viewMode = CurrentViewMode.None;

                if (item.ShowDetails)
                {
                    switch (item.StatisticOverviewType)
                    {
                    case StatisticOverviewType.TrackLengthLongest:
                    case StatisticOverviewType.TrackLengthShortest:
                    {
                        condition.Add(new SingleCondition(Field.TrackLength, Operator.Equal, item.RawValue));
                        title    = item.Name;
                        viewMode = CurrentViewMode.MyMusicTable;
                        image    = "Music.png";
                        break;
                    }

                    case StatisticOverviewType.CDTrackMax:
                    {
                        condition.Add(new SingleCondition(Field.NumberOfTracks, Operator.Equal, item.RawValue));
                        title    = item.Name;
                        viewMode = CurrentViewMode.AlbumTable;
                        image    = "Music.png";
                        break;
                    }

                    case StatisticOverviewType.CDLengthLongest:
                    case StatisticOverviewType.CDLengthShortest:
                    {
                        condition.Add(new SingleCondition(Field.TotalLength, Operator.Equal, item.RawValue));
                        title    = item.Name;
                        viewMode = CurrentViewMode.AlbumTable;
                        image    = "Music.png";
                        break;
                    }

                    case StatisticOverviewType.CDAssignedCount:
                    {
                        condition.Add(new SingleCondition(Field.Identity, Operator.NotEmpty, null));
                        title    = item.Name;
                        viewMode = CurrentViewMode.AlbumTable;
                        image    = "Music.png";
                        break;
                    }

                    case StatisticOverviewType.CDAssignedNotCount:
                    {
                        condition.Add(new SingleCondition(Field.Identity, Operator.Empty, null));
                        title    = item.Name;
                        viewMode = CurrentViewMode.AlbumTable;
                        image    = "Music.png";
                        break;
                    }

                    default:
                        break;
                    }

                    AddViewCommandParameters addViewParams = new AddViewCommandParameters();
                    addViewParams.Condition           = condition;
                    addViewParams.ImageResourceString = image;
                    addViewParams.Title    = title;
                    addViewParams.ViewMode = viewMode;

                    CatalogViewCommands.AddView.Execute(addViewParams, Application.Current.MainWindow);
                }
            }
        }
示例#25
0
        public new void Drop(Controls.DragDrop.IDropInfo dropInfo)
        {
            List <WishlistItem> wishlistItems = new List <WishlistItem>();

            if (dropInfo.Data is PlaylistItem)
            {
                PlaylistItem playlistItem = dropInfo.Data as PlaylistItem;

                WishlistItem item = new WishlistItem();
                item.Artist  = playlistItem.Info.Artist;
                item.Title   = playlistItem.Info.Title;
                item.TrackID = playlistItem.ID;
                wishlistItems.Add(item);
            }

            if (dropInfo.Data is Track || dropInfo.Data is List <Track> )
            {
                // Prüfen, ob ein Track einer CD gedropped wurde
                MainCDUserControl mainCDUserControl = VisualTreeExtensions.FindParent <MainCDUserControl>(dropInfo.DragInfo.VisualSource);
                if (mainCDUserControl != null)
                {
                }
                else
                {
                    Track        track     = dropInfo.Data as Track;
                    List <Track> trackList = dropInfo.Data as List <Track>;

                    if (track != null)
                    {
                        WishlistItem item = GetWishlistItemByTrack(track);
                        wishlistItems.Add(item);
                    }

                    if (trackList != null)
                    {
                        foreach (Track trackItem in trackList)
                        {
                            WishlistItem item = GetWishlistItemByTrack(track);
                            wishlistItems.Add(item);
                        }
                    }
                }
            }

            if (dropInfo.Data is MyMusicListItem)
            {
                MyMusicListItem item  = dropInfo.Data as MyMusicListItem;
                Track           track = DataBase.GetTrackById(item.ID);

                AddTracksToPlaylistParameter addTracksParams = new AddTracksToPlaylistParameter();
                addTracksParams.AddTracksType = AddTracksToPlaylistType.InsertAtIndex;
                addTracksParams.InsertIndex   = dropInfo.InsertIndex;
                addTracksParams.Filenames.Add(track.Soundfile);
                HitbaseCommands.AddTracksToPlaylist.Execute(addTracksParams, this);
            }

            if (dropInfo.Data is List <MyMusicListItem> )
            {
                List <MyMusicListItem> items = dropInfo.Data as List <MyMusicListItem>;

                AddTracksToPlaylistParameter addTracksParams = new AddTracksToPlaylistParameter();
                addTracksParams.AddTracksType = AddTracksToPlaylistType.InsertAtIndex;
                addTracksParams.InsertIndex   = dropInfo.InsertIndex;
                foreach (MyMusicListItem item in items)
                {
                    addTracksParams.Filenames.Add(item.Soundfile);
                }
                HitbaseCommands.AddTracksToPlaylist.Execute(addTracksParams, this);
            }

            if (wishlistItems.Count > 0)
            {
                HitbaseCommands.AddToWishlist.Execute(wishlistItems, System.Windows.Application.Current.MainWindow);
            }
        }
 private void listBoxPlaylist_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed && listBoxPlaylist.SelectedIndex >= 0 && VisualTreeExtensions.FindParent <ListBoxItem>(e.OriginalSource as UIElement) != null)
     {
         Playlist.CurrentTrack = listBoxPlaylist.SelectedIndex;
     }
 }
        public new void DragOver(Controls.DragDrop.IDropInfo dropInfo)
        {
            if (Playlist.IsCDInPlaylist)
            {
                bool trackOfCDDropped = false;
                if (dropInfo.Data is Track || dropInfo.Data is List <Track> )
                {
                    // Prüfen, ob ein Track einer CD gedropped wurde
                    MainCDUserControl mainCDUserControl = VisualTreeExtensions.FindParent <MainCDUserControl>(dropInfo.DragInfo.VisualSource);
                    if (mainCDUserControl != null)
                    {
                        trackOfCDDropped = true;
                    }
                }
                if (dropInfo.Data is PlaylistItem)
                {
                    trackOfCDDropped = true;
                }
                if (!trackOfCDDropped)
                {
                    dropInfo.Effects = DragDropEffects.None;
                    return;
                }
            }

            dropInfo.DropTargetAdorner = Big3.Hitbase.Controls.DragDrop.DropTargetAdorners.Insert;

            if (dropInfo.Data is PlaylistItem)
            {
                dropInfo.Effects = DragDropEffects.Move;
            }

            if (dropInfo.Data is Big3.Hitbase.CDUtilities.WishlistItem)
            {
                dropInfo.Effects = DragDropEffects.Copy;
            }
            if (dropInfo.Data is AlbumItem)
            {
                dropInfo.Effects = DragDropEffects.Copy;
            }
            if (dropInfo.Data is AlbumViewItem)
            {
                dropInfo.Effects = DragDropEffects.Copy;
            }
            if (dropInfo.Data is Track || dropInfo.Data is List <Track> )
            {
                dropInfo.Effects = DragDropEffects.Copy;
            }
            if (dropInfo.Data is MyMusicListItem || dropInfo.Data is List <MyMusicListItem> )
            {
                dropInfo.Effects = DragDropEffects.Copy;
            }
            if (dropInfo.Data is DataObject)
            {
                DataObject dataObject = dropInfo.Data as DataObject;
                if (dataObject.GetDataPresent(DataFormats.FileDrop))
                {
                    dropInfo.Effects = DragDropEffects.Copy;
                }
            }
        }
示例#28
0
        private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                DataGridRow row = VisualTreeExtensions.FindParent <DataGridRow>(e.OriginalSource as DependencyObject);
                if (row == null)
                {
                    return;
                }

                switch (CurrentViewMode)
                {
                case MainControls.CurrentViewMode.ArtistTable:
                case MainControls.CurrentViewMode.ComposerTable:
                {
                    OpenSelectedPersonGroup();

                    break;
                }

                case MainControls.CurrentViewMode.YearTable:
                {
                    TrackListItem tli = dataGrid.SelectedItem as TrackListItem;

                    int year = Misc.Atoi(tli.Title);

                    AddViewCommandParameters addViewParams = new AddViewCommandParameters();
                    addViewParams.Condition = new DataBaseEngine.Condition();
                    addViewParams.Condition.Add(new SingleCondition()
                        {
                            Field = Field.TrackYearRecorded, Operator = Operator.Equal, Value = year, Logical = Logical.Or
                        });
                    addViewParams.Condition.Add(new SingleCondition()
                        {
                            Field = Field.YearRecorded, Operator = Operator.Equal, Value = year
                        });

                    addViewParams.ImageResourceString = "Calendar.png";
                    addViewParams.Title    = tli.Title;
                    addViewParams.ViewMode = MainControls.CurrentViewMode.MyMusicDetails;

                    CatalogViewCommands.AddView.Execute(addViewParams, Application.Current.MainWindow);
                    e.Handled = true;
                    break;
                }

                case MainControls.CurrentViewMode.RatingTable:
                {
                    TrackListItem tli = dataGrid.SelectedItem as TrackListItem;

                    int rating = Misc.Atoi(tli.Title);

                    AddViewCommandParameters addViewParams = new AddViewCommandParameters();
                    addViewParams.Condition = new DataBaseEngine.Condition();
                    addViewParams.Condition.Add(new SingleCondition()
                        {
                            Field = Field.TrackRating, Operator = Operator.Equal, Value = rating
                        });

                    addViewParams.ImageResourceString = "Star.png";
                    addViewParams.Title    = tli.Title;
                    addViewParams.ViewMode = MainControls.CurrentViewMode.MyMusicDetails;

                    CatalogViewCommands.AddView.Execute(addViewParams, Application.Current.MainWindow);
                    e.Handled = true;
                    break;
                }

                case MainControls.CurrentViewMode.GenreTable:
                {
                    TrackListItem tli = dataGrid.SelectedItem as TrackListItem;

                    string genre = tli.Title;

                    AddViewCommandParameters addViewParams = new AddViewCommandParameters();
                    addViewParams.Condition = new DataBaseEngine.Condition();
                    addViewParams.Condition.Add(new SingleCondition(Field.Category, Operator.Equal, genre, Logical.Or));
                    addViewParams.Condition.Add(new SingleCondition(Field.TrackCategory, Operator.Equal, genre));

                    addViewParams.ImageResourceString = "Category.png";
                    addViewParams.Title    = tli.Title;
                    addViewParams.ViewMode = MainControls.CurrentViewMode.MyMusicDetails;

                    CatalogViewCommands.AddView.Execute(addViewParams, Application.Current.MainWindow);
                    e.Handled = true;
                    break;
                }
                }
            }
        }
        public new void Drop(Controls.DragDrop.IDropInfo dropInfo)
        {
            if (dropInfo.Data is PlaylistItem)
            {
                Controls.DragDrop.DragDrop.DefaultDropHandler.Drop(dropInfo);
            }

            if (dropInfo.Data is Big3.Hitbase.CDUtilities.WishlistItem)
            {
                Big3.Hitbase.CDUtilities.WishlistItem wishlistItem = dropInfo.Data as Big3.Hitbase.CDUtilities.WishlistItem;

                AddTracksToPlaylistParameter addTracksParams = new AddTracksToPlaylistParameter();
                addTracksParams.AddTracksType = AddTracksToPlaylistType.InsertAtIndex;
                addTracksParams.InsertIndex   = dropInfo.InsertIndex;

                addTracksParams.TrackIds.Add(wishlistItem.TrackID);
                HitbaseCommands.AddTracksToPlaylist.Execute(addTracksParams, this);
            }

            if (dropInfo.Data is AlbumViewItem)
            {
                AlbumViewItem item = dropInfo.Data as AlbumViewItem;
                CD            cd   = DataBase.GetCDById(item.ID);

                AddTracksToPlaylistParameter addTracksParams = new AddTracksToPlaylistParameter();
                addTracksParams.AddTracksType = AddTracksToPlaylistType.InsertAtIndex;
                addTracksParams.InsertIndex   = dropInfo.InsertIndex;
                foreach (Track track in cd.Tracks)
                {
                    addTracksParams.TrackIds.Add(track.ID);
                }
                HitbaseCommands.AddTracksToPlaylist.Execute(addTracksParams, this);
            }

            if (dropInfo.Data is AlbumItem)
            {
                AlbumItem item = dropInfo.Data as AlbumItem;
                CD        cd   = DataBase.GetCDById(item.ID);

                AddTracksToPlaylistParameter addTracksParams = new AddTracksToPlaylistParameter();
                addTracksParams.AddTracksType = AddTracksToPlaylistType.InsertAtIndex;
                addTracksParams.InsertIndex   = dropInfo.InsertIndex;
                foreach (Track track in cd.Tracks)
                {
                    addTracksParams.TrackIds.Add(track.ID);
                }
                HitbaseCommands.AddTracksToPlaylist.Execute(addTracksParams, this);
            }

            if (dropInfo.Data is Track || dropInfo.Data is List <Track> )
            {
                // Prüfen, ob ein Track einer CD gedropped wurde
                MainCDUserControl mainCDUserControl = VisualTreeExtensions.FindParent <MainCDUserControl>(dropInfo.DragInfo.VisualSource);
                if (mainCDUserControl != null)
                {
                    Track        track     = dropInfo.Data as Track;
                    List <Track> trackList = dropInfo.Data as List <Track>;

                    AddCDTracksToPlaylistParameter addTracksParams = new AddCDTracksToPlaylistParameter();
                    addTracksParams.AddTracksType = AddTracksToPlaylistType.InsertAtIndex;
                    addTracksParams.InsertIndex   = dropInfo.InsertIndex;

                    if (track != null)
                    {
                        addTracksParams.Tracks.Add(track);
                    }
                    if (trackList != null)
                    {
                        addTracksParams.Tracks.AddRange(trackList);
                    }
                    HitbaseCommands.AddTracksToPlaylist.Execute(addTracksParams, this);
                }
                else
                {
                    Track        track     = dropInfo.Data as Track;
                    List <Track> trackList = dropInfo.Data as List <Track>;

                    AddTracksToPlaylistParameter addTracksParams = new AddTracksToPlaylistParameter();
                    addTracksParams.AddTracksType = AddTracksToPlaylistType.InsertAtIndex;
                    addTracksParams.InsertIndex   = dropInfo.InsertIndex;

                    if (track != null)
                    {
                        addTracksParams.TrackIds.Add(track.ID);
                    }

                    if (trackList != null)
                    {
                        foreach (Track trackItem in trackList)
                        {
                            addTracksParams.TrackIds.Add(trackItem.ID);
                        }
                    }

                    HitbaseCommands.AddTracksToPlaylist.Execute(addTracksParams, this);
                }
            }

            if (dropInfo.Data is MyMusicListItem)
            {
                MyMusicListItem item = dropInfo.Data as MyMusicListItem;

                AddTracksToPlaylistParameter addTracksParams = new AddTracksToPlaylistParameter();
                addTracksParams.AddTracksType = AddTracksToPlaylistType.InsertAtIndex;
                addTracksParams.InsertIndex   = dropInfo.InsertIndex;
                addTracksParams.TrackIds.Add(item.ID);
                HitbaseCommands.AddTracksToPlaylist.Execute(addTracksParams, this);
            }

            if (dropInfo.Data is List <MyMusicListItem> )
            {
                List <MyMusicListItem> items = dropInfo.Data as List <MyMusicListItem>;

                AddTracksToPlaylistParameter addTracksParams = new AddTracksToPlaylistParameter();
                addTracksParams.AddTracksType = AddTracksToPlaylistType.InsertAtIndex;
                addTracksParams.InsertIndex   = dropInfo.InsertIndex;
                foreach (MyMusicListItem item in items)
                {
                    addTracksParams.TrackIds.Add(item.ID);
                }
                HitbaseCommands.AddTracksToPlaylist.Execute(addTracksParams, this);
            }

            if (dropInfo.Data is DataObject)
            {
                DataObject dataObject = dropInfo.Data as DataObject;
                if (dataObject.GetDataPresent(DataFormats.FileDrop))
                {
                    AddTracksToPlaylistParameter addTracksParams = new AddTracksToPlaylistParameter();
                    addTracksParams.AddTracksType = AddTracksToPlaylistType.InsertAtIndex;
                    addTracksParams.InsertIndex   = dropInfo.InsertIndex;
                    foreach (string item in dataObject.GetFileDropList())
                    {
                        addTracksParams.Filenames.Add(item);
                    }
                    HitbaseCommands.AddTracksToPlaylist.Execute(addTracksParams, this);
                }
            }
        }