Beispiel #1
0
        public AlbumListView() : base()
        {
            renderer    = new ColumnCellAlbum();
            grid_layout = new DataViewLayoutGrid()
            {
                ChildAllocator = () => new DataViewChildAlbum(),
                View           = this
            };
            grid_layout.ChildCountChanged += (o, e) => {
                var artwork_manager = ServiceManager.Get <ArtworkManager> ();
                if (artwork_manager != null && e.Value > 0)
                {
                    int size = (int)((DataViewChildAlbum)grid_layout[0]).ImageSize;
                    artwork_manager.ChangeCacheSize(size, e.Value);
                }
            };
            ViewLayout = grid_layout;

            DisableAlbumGridPref = new SchemaPreference <bool> (DisableAlbumGrid,
                                                                Catalog.GetString("Disable album grid"),
                                                                Catalog.GetString("Disable album grid and show the classic layout instead"),
                                                                ToggleAlbumGrid);

            ServiceManager.SourceManager.SourceRemoved += UninstallPreferences;
            ServiceManager.SourceManager.SourceAdded   += InstallPreferences;
            if (ServiceManager.SourceManager.MusicLibrary != null)
            {
                InstallPreferences();
            }

            ServiceManager.PlayerEngine.ConnectEvent(OnPlayerEvent, PlayerEvent.TrackInfoUpdated);
            Banshee.Metadata.MetadataService.Instance.ArtworkUpdated += OnArtworkUpdated;
        }
Beispiel #2
0
        public Grid()
        {
            var layout = new DataViewLayoutGrid()
            {
                Fill           = true,
                ChildAllocator = () => {
                    DataViewChildImage img = new DataViewChildImage();
                    return(new StackPanel()
                    {
                        Margin = new Thickness(5),
                        Width = 300,
                        Height = 125,
                        Spacing = 5,
                        Children =
                        {
                            new StackPanel()
                            {
                                Orientation = Orientation.Vertical,
                                Width = 90,
                                Spacing = 5,
                                Children =
                                {
                                    img,
                                    new ColumnCellPodcastStatusIndicator(null)
                                }
                            },
                            new TextBlock()
                            {
                                UseMarkup = true,
                                TextWrap = TextWrap.WordChar,
                                TextGenerator = o =>{
                                    var track = o as TrackInfo;
                                    if (track != null)
                                    {
                                        var episode = PodcastTrackInfo.From(track);
                                        if (episode != null)
                                        {
                                            return "<b>{0}</b>\n<small>{1}\n{2}</small>".FormatEscaped(
                                                track.DisplayTrackTitle, episode.PublishedDate.ToShortDateString(), episode.Description
                                                );
                                        }
                                    }
                                    return "";
                                }
                            }
                        },
                        // Render the prelight just on the cover art, but triggered by being anywhere over the album
                        PrelightRenderer = (cr, theme, size, o) => {
                            Prelight.Gradient(cr, theme, new Rect(img.ContentAllocation.X, img.ContentAllocation.Y, img.ImageSize, img.ImageSize), o);
                        }
                    });
                },
                View = this
            };

            ViewLayout = layout;
        }
Beispiel #3
0
        public AudiobookGrid()
        {
            var layout = new DataViewLayoutGrid()
            {
                ChildAllocator = () => new DataViewChildAlbum()
                {
                    ImageSize = 180
                },
                View = this
            };

            ViewLayout    = layout;
            RowActivated += (o, a) => library.Actions["AudiobookOpen"].Activate();
        }
Beispiel #4
0
 public View()
 {
     ViewLayout = new DataViewLayoutGrid()
     {
         ChildAllocator = () => {
             return(new StackPanel()
             {
                 Orientation = Hyena.Gui.Canvas.Orientation.Vertical,
                 Width = 400,
                 Spacing = 15,
                 //Margin = new Thickness (10),
                 Theme = Theme,
                 Children =
                 {
                     new Slider(),
                     new ColumnCellCheckBox("F",true),
                     new TextBlock()
                     {
                         Binder = new ObjectBinder()
                         {
                             Property = "A"
                         }
                     },
                     new TextBlock()
                     {
                         Binder = new ObjectBinder()
                         {
                             Property = "B"
                         }
                     },
                     //new ColumnCellText ("B", true),
                     //new ColumnCellText ("C", true),
                     new ColumnCellRating("G",  true),
                     //new ColumnCellText ("D", true),
                     new ColumnCellDoodle("E",  true),
                     //new ColumnCellText ("A", true)
                 }
             });
             //return new ColumnCellRating ("G", true);
         },
         View = this
     };
 }