public LibraryBrowserItem(LibraryBrowserEntity entity) { Entity = entity; StringValue = new NSString(entity.Title); // Create empty list of subitems SubItems = new List<LibraryBrowserItem>(); foreach(LibraryBrowserEntity subEntity in entity.SubItems) SubItems.Add(new LibraryBrowserItem(subEntity)); }
public void NotifyLibraryBrowserNewNode(int position, LibraryBrowserEntity entity) { //Console.WriteLine("===========>>>> MainWindow - RefreshLibraryBrowserSelectedNode - isnull: {0} title: {1} position: {2}", entity == null, entity == null ? string.Reset : entity.Title, position); }
public void RefreshLibraryBrowserSelectedNode(LibraryBrowserEntity entity) { _selectedLibraryNode = entity; Console.WriteLine("MainWindow - RefreshLibraryBrowserSelectedNode - isnull: {0} title: {1}", entity == null, entity == null ? string.Empty : entity.Title); Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { LibraryTreeViewItem item = null; switch (entity.EntityType) { case LibraryBrowserEntityType.Artists: item = GetLibraryTreeViewItem(treeViewLibrary.Items, LibraryBrowserEntityType.Artists); item.IsSelected = true; break; case LibraryBrowserEntityType.Albums: item = GetLibraryTreeViewItem(treeViewLibrary.Items, LibraryBrowserEntityType.Albums); item.IsSelected = true; break; case LibraryBrowserEntityType.ArtistAlbum: case LibraryBrowserEntityType.Artist: item = GetLibraryTreeViewItem(treeViewLibrary.Items, LibraryBrowserEntityType.Artists); item.IsExpanded = true; item.BringIntoView(); break; case LibraryBrowserEntityType.Album: item = GetLibraryTreeViewItem(treeViewLibrary.Items, LibraryBrowserEntityType.Albums); item.IsExpanded = true; item.BringIntoView(); break; } })); }
public void RefreshLibraryBrowserNode(LibraryBrowserEntity entity, IEnumerable<LibraryBrowserEntity> entities, object userData) { //Console.WriteLine("MainWindow - RefreshLibraryBrowserNode - entities.Count: {0}", entities.Count()); Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { var item = (LibraryTreeViewItem) userData; foreach (var subentity in entities) { var subitem = new LibraryTreeViewItem(); subitem.Entity = subentity; subitem.Header = subentity; subitem.HeaderTemplate = FindResource("TreeViewItemTemplate") as DataTemplate; if (subentity.SubItems.Count > 0) { var dummy = new LibraryTreeViewItem(); dummy.IsDummyNode = true; subitem.Items.Add(dummy); } item.Items.Add(subitem); } if (_selectedLibraryNode != null) { switch (entity.EntityType) { case LibraryBrowserEntityType.Artists: var artistNode = GetLibraryTreeViewItemByArtistName(item.Items, _selectedLibraryNode.Query.ArtistName); if (artistNode != null) { if (_selectedLibraryNode.EntityType == LibraryBrowserEntityType.Artist) { artistNode.IsSelected = true; artistNode.BringIntoView(); _selectedLibraryNode = null; } else if (_selectedLibraryNode.EntityType == LibraryBrowserEntityType.ArtistAlbum) { artistNode.IsExpanded = true; artistNode.BringIntoView(); } } break; case LibraryBrowserEntityType.Artist: var artistAlbumNode = GetLibraryTreeViewItemByAlbumTitle(item.Items, _selectedLibraryNode.Query.AlbumTitle); if (artistAlbumNode != null) { artistAlbumNode.IsSelected = true; artistAlbumNode.BringIntoView(); //new Rect(0, treeViewLibrary.ScrollViewer.VerticalOffset, 10, 10)); } _selectedLibraryNode = null; break; case LibraryBrowserEntityType.Albums: var albumNode = GetLibraryTreeViewItemByAlbumTitle(item.Items, _selectedLibraryNode.Query.AlbumTitle); if (albumNode != null) { albumNode.IsSelected = true; albumNode.BringIntoView(); } _selectedLibraryNode = null; break; } } // When calling BringIntoView, the horizontal offset is not always zero. // This is a workaround, BringIntoView(Rect) doesn't seem to work... treeViewLibrary.ScrollViewer.ScrollToHorizontalOffset(0); })); }
public virtual void BindSelectPlaylistView(ISelectPlaylistView view, LibraryBrowserEntity item) { _selectPlaylistView = view; _selectPlaylistPresenter = Bootstrapper.GetContainer().Resolve<ISelectPlaylistPresenter>(new NamedParameterOverloads() { { "item", item } }); _selectPlaylistPresenter.BindView(view); _selectPlaylistView.OnViewDestroy = (view2) => { _selectPlaylistPresenter.ViewDestroyed(); _selectPlaylistPresenter = null; _selectPlaylistView = null; }; }
public virtual ISelectPlaylistView CreateSelectPlaylistView(LibraryBrowserEntity item) { _selectPlaylistView = Bootstrapper.GetContainer().Resolve<ISelectPlaylistView>(new NamedParameterOverloads() { { "item", item } }); return _selectPlaylistView; }
public void RefreshLibraryBrowserNode(LibraryBrowserEntity entity, IEnumerable<LibraryBrowserEntity> entities, object userData) { Gtk.Application.Invoke(delegate{ Console.WriteLine("MainWindow - RefreshLibraryBrowserNode"); Gtk.TreeIter iter = (Gtk.TreeIter)userData; TreeIter treeIterDummy; _storeLibraryBrowser.IterNthChild(out treeIterDummy, iter, 0); switch(entity.EntityType) { case LibraryBrowserEntityType.Artists: foreach(LibraryBrowserEntity artist in entities) { // Add artist node Gtk.TreeIter iterArtist = _storeLibraryBrowser.AppendValues(iter, artist); // The first subitems are always dummy or static. foreach(LibraryBrowserEntity entitySub in artist.SubItems) _storeLibraryBrowser.AppendValues(iterArtist, entitySub); } break; case LibraryBrowserEntityType.Albums: foreach(LibraryBrowserEntity album in entities) _storeLibraryBrowser.AppendValues(iter, album); break; case LibraryBrowserEntityType.Artist: foreach(LibraryBrowserEntity artist in entities) _storeLibraryBrowser.AppendValues(iter, artist); break; } // Remove dummy node _storeLibraryBrowser.Remove(ref treeIterDummy); }); }
public void NotifyLibraryBrowserNewNode(int position, LibraryBrowserEntity entity) { }
public void RefreshLibraryBrowserSelectedNode(LibraryBrowserEntity entity) { }
public SelectPlaylistViewController(LibraryBrowserEntity item) : base (UserInterfaceIdiomIsPhone ? "SelectPlaylistViewController_iPhone" : "SelectPlaylistViewController_iPad", null) { _item = item; }
public SelectPlaylistFragment(LibraryBrowserEntity item) : base() { _item = item; }
private void LibraryBrowserTreeNodeSelected(LibraryBrowserEntity entity) { _currentLibraryBrowserEntity = entity; menuPlay.Enabled = entity != null; menuAddToPlaylist.Enabled = entity != null; menuAddToQueue.Enabled = entity != null; menuRemoveFromLibrary.Enabled = entity != null; menuDeleteFromHardDisk.Enabled = entity != null; if(entity != null) OnTreeNodeSelected(entity); }
public void NotifyLibraryBrowserNewNode(int position, LibraryBrowserEntity entity) { InvokeOnMainThread(() => { outlineLibraryBrowser.ReloadData(); }); }
public void RefreshLibraryBrowserSelectedNode(LibraryBrowserEntity entity) { InvokeOnMainThread(() => { if(entity.EntityType == LibraryBrowserEntityType.Artist || entity.EntityType == LibraryBrowserEntityType.ArtistAlbum) { var artistsNode = _libraryBrowserDataSource.Items.FirstOrDefault(x => x.Entity.EntityType == LibraryBrowserEntityType.Artists); outlineLibraryBrowser.ExpandItem(artistsNode); var artistNode = artistsNode.SubItems.FirstOrDefault(x => string.Compare(x.Entity.Query.ArtistName, entity.Query.ArtistName, true) == 0); if(entity.EntityType == LibraryBrowserEntityType.Artist) { int row = outlineLibraryBrowser.RowForItem(artistNode); outlineLibraryBrowser.SelectRow(row, false); outlineLibraryBrowser.ScrollRowToVisible(row); } else if(entity.EntityType == LibraryBrowserEntityType.ArtistAlbum) { outlineLibraryBrowser.ExpandItem(artistNode); var artistAlbumNode = artistNode.SubItems.FirstOrDefault(x => string.Compare(x.Entity.Query.AlbumTitle, entity.Query.AlbumTitle, true) == 0); int row = outlineLibraryBrowser.RowForItem(artistAlbumNode); outlineLibraryBrowser.SelectRow(row, false); outlineLibraryBrowser.ScrollRowToVisible(row); } } else if(entity.EntityType == LibraryBrowserEntityType.Album) { var albumsNode = _libraryBrowserDataSource.Items.FirstOrDefault(x => x.Entity.EntityType == LibraryBrowserEntityType.Albums); outlineLibraryBrowser.ExpandItem(albumsNode); var albumNode = albumsNode.SubItems.FirstOrDefault(x => string.Compare(x.Entity.Query.AlbumTitle, entity.Query.AlbumTitle, true) == 0); int row = outlineLibraryBrowser.RowForItem(albumNode); outlineLibraryBrowser.SelectRow(row, false); outlineLibraryBrowser.ScrollRowToVisible(row); } }); }
public void RefreshLibraryBrowserNode(LibraryBrowserEntity entity, IEnumerable<LibraryBrowserEntity> entities, object userData) { // Not used in Cocoa. }