Banshee.Audiobook.AudiobookLibrarySource.SwitchToBookView C# (CSharp) Method

SwitchToBookView() public method

public SwitchToBookView ( Banshee.Collection.Database.DatabaseAlbumInfo book ) : void
book Banshee.Collection.Database.DatabaseAlbumInfo
return void
        public void SwitchToBookView (DatabaseAlbumInfo book)
        {
            if (!book_label.Visible) {
                CurrentViewBook = book;
                book_label.Text = String.Format (" ยป  {0}", book.DisplayTitle);
                book_label.Visible = true;
                book_view.SetSource (this);
                book_view.Contents.SetBook (book);
                Properties.Set<ISourceContents> ("Nereid.SourceContents", book_view);

                if (BooksModel.Selection.Count != 1) {
                    var index = BooksModel.Selection.FocusedIndex;
                    BooksModel.Selection.Clear (false);
                    BooksModel.Selection.Select (index);
                }

                Actions.UpdateActions ();
            }
        }

Usage Example

        private void OnOpen(object o, EventArgs a)
        {
            var index = library.BooksModel.Selection.FocusedIndex;

            if (index > -1)
            {
                var book = library.BooksModel[index];
                library.SwitchToBookView(book as DatabaseAlbumInfo);
            }
        }