示例#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);
                    }
                }
            }
        }
        private void OpenSelectedPersonGroup()
        {
            TrackListItem tli = dataGrid.SelectedItem as TrackListItem;

            if (tli == null)
            {
                return;
            }

            PersonGroup personGroup = DataBase.GetPersonGroupByName(tli.Title, false);

            PersonGroupWindow personGroupWindow = new PersonGroupWindow(DataBase,
                                                                        CurrentViewMode == MainControls.CurrentViewMode.ArtistTable ?
                                                                        PersonType.Artist : PersonType.Composer, personGroup);

            personGroupWindow.ChangeAllSoundFiles = true;
            personGroupWindow.Owner = Window.GetWindow(this);
            if (personGroupWindow.ShowDialog() == true)
            {
                tli.Title = personGroup.Name;
            }
        }