Пример #1
0
        private void SenderButton_Click(object sender, RoutedEventArgs e)
        {
            DependencyObject source       = (sender as DependencyObject).FindVisualAncestor <ListViewItem>();
            PlaylistItemBase playlistItem = (lstPlaylist.ItemContainerGenerator.ItemFromContainer(source) as PlaylistItemBase);

            if (EventPlaylistItemNavigationClick != null && playlistItem != null)
            {
                EventPlaylistItemNavigationClick(this, new PlaylistSelectionEventArgs(playlistItem));
            }
        }
Пример #2
0
        private void DetailsExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            PlaylistItemBase selected = iRightMouseSelectedItem as PlaylistItemBase;

            if (selected != null && !(selected is PlaylistGroupHeaderItem))
            {
                DetailsDialog details = new DetailsDialog(selected.WrappedItem.DidlLite[0], null, iUiOptions);
                details.Owner = Window.GetWindow(this);
                details.ShowDialog();
            }
        }
Пример #3
0
        private void ImageFailed(object sender, ExceptionRoutedEventArgs e)
        {
            Image            img          = e.OriginalSource as Image;
            ListViewItem     item         = img.FindVisualAncestor <ListViewItem>();
            PlaylistItemBase playlistItem = (lstPlaylist.ItemContainerGenerator.ItemFromContainer(item) as PlaylistItemBase);

            if (playlistItem != null)
            {
                UserLog.WriteLine(string.Format("{0}:{1}", e.ErrorException.Message, playlistItem.ImageSource));
                playlistItem.ImageSource = KinskyDesktopWpf.StaticImages.ImageSourceIconAlbumError;
                img.SetBinding(Image.SourceProperty, "ImageSource");
            }
            e.Handled = true;
        }
Пример #4
0
        private static void OnScrollOffsetChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            PlaylistWidgetTimeline me = obj as PlaylistWidgetTimeline;

            if (me != null)
            {
                int itemPosition = Math.Max(0, Math.Min(me.lstPlaylist.Items.Count - 1, (int)Math.Round((double)args.NewValue)));
                if (itemPosition < me.lstPlaylist.Items.Count)
                {
                    me.lstPlaylist.Items.MoveCurrentToPosition(itemPosition);
                    PlaylistItemBase item = me.lstPlaylist.Items[itemPosition] as PlaylistItemBase;
                    if (item != null)
                    {
                        me.lstPlaylist.ScrollToCenterOfView(item);
                    }
                }
                me.UpdateDetailsPanel();
            }
        }