예제 #1
0
        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));
        }
예제 #2
0
 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);
 }
예제 #3
0
 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;
         }
     }));
 }
예제 #4
0
        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);
            }));
        }
예제 #5
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;
     };            
 }
예제 #6
0
 public virtual ISelectPlaylistView CreateSelectPlaylistView(LibraryBrowserEntity item)
 {
     _selectPlaylistView = Bootstrapper.GetContainer().Resolve<ISelectPlaylistView>(new NamedParameterOverloads() { { "item", item } });
     return _selectPlaylistView;
 }
예제 #7
0
파일: MainWindow.cs 프로젝트: pascalfr/MPfm
		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);
			});
		}
예제 #8
0
파일: MainWindow.cs 프로젝트: pascalfr/MPfm
		public void NotifyLibraryBrowserNewNode(int position, LibraryBrowserEntity entity)
		{
		}
예제 #9
0
파일: MainWindow.cs 프로젝트: pascalfr/MPfm
		public void RefreshLibraryBrowserSelectedNode(LibraryBrowserEntity entity)
		{
		}
예제 #10
0
        public SelectPlaylistViewController(LibraryBrowserEntity item)
			: base (UserInterfaceIdiomIsPhone ? "SelectPlaylistViewController_iPhone" : "SelectPlaylistViewController_iPad", null)
        {
            _item = item;
        }
예제 #11
0
 public SelectPlaylistFragment(LibraryBrowserEntity item) : base()
 {
     _item = item;
 }
예제 #12
0
        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);
        }
예제 #13
0
 public void NotifyLibraryBrowserNewNode(int position, LibraryBrowserEntity entity)
 {
     InvokeOnMainThread(() => {
         outlineLibraryBrowser.ReloadData();
     });
 }
예제 #14
0
 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);
         }
     });
 }
예제 #15
0
		public void RefreshLibraryBrowserNode(LibraryBrowserEntity entity, IEnumerable<LibraryBrowserEntity> entities, object userData)
		{
		    // Not used in Cocoa.
		}