Exemplo n.º 1
0
 public void InsertItems(int index, SyncMenuItemEntity parentItem, List<SyncMenuItemEntity> items, object userData)
 {
 }
Exemplo n.º 2
0
        public void InsertItems(int index, SyncMenuItemEntity parentItem, List<SyncMenuItemEntity> items, object userData)
        {
            Console.WriteLine("SyncMenuWindowController - InsertItems - index: {0} items.Count: {1}", index, items.Count);
            InvokeOnMainThread(delegate {
                var item = _items.FirstOrDefault(x => x.Entity == parentItem);
                // Try to search in subitems
                if(item == null)
                    foreach(var currentItem in _items)
                        foreach(var subItem in currentItem.SubItems)
                            if(subItem.Entity == parentItem)
                            {
                                item = subItem;
                                break;
                            }
                if(item == null)
                    return;

                // Clear dummy node and add actual items
                item.SubItems.Clear();
                foreach(var entity in items)
                {
                    var newItem = new SyncMenuItem(entity);
                    if(entity.ItemType != SyncMenuItemEntityType.Song)
                        newItem.SubItems.Add(new SyncMenuItem(new SyncMenuItemEntity(){
                            ArtistName = "dummy",
                            AlbumTitle = "dummy"
                        }));
                    item.SubItems.Add(newItem);
                }
                outlineView.ReloadData();
            });
        }
Exemplo n.º 3
0
 public SyncMenuItem(SyncMenuItemEntity entity)
 {
     Entity = entity;
     StringValue = new NSString(entity.ItemType.ToString());
     SubItems = new List<SyncMenuItem>();
 }
Exemplo n.º 4
0
        public void InsertItems(int index, SyncMenuItemEntity parentItem, List<SyncMenuItemEntity> items, object userData)
        {
            Gtk.Application.Invoke(delegate{
                Console.WriteLine("SyncMenuWindow - InsertItems - index {0}", index);
                TreeIter treeIter = (TreeIter)userData;
                //Gtk.TreePath treePath = new TreePath((index-1).ToString());
                //_storeItems.GetIter(out treeIter, treePath);
                //object stuff = _storeItems.GetValue(treeIter, 0);
                //_storeItems.IterNthChild(out treeIter, index-1);
                TreeIter treeIterDummy;
                _storeItems.IterNthChild(out treeIterDummy, treeIter, 0);
                //object stuff2 = _storeItems.GetValue(treeIterDummy, 0);

                // Add new children
                foreach(var item in items)
                {
                    TreeIter treeIterChild = _storeItems.AppendValues(treeIter, item);
                    if(item.ItemType == SyncMenuItemEntityType.Album)
                    {
                        // Add dummy cell
                        _storeItems.AppendValues(treeIterChild, new SyncMenuItemEntity(){
                            ItemType = SyncMenuItemEntityType.Song,
                            ArtistName = "dummy",
                            AlbumTitle = "dummy"
                        });
                    }
                }

                // Remove dummy node
                _storeItems.Remove(ref treeIterDummy);
            });
        }
Exemplo n.º 5
0
        public void InsertItems(int index, SyncMenuItemEntity parentItem, List<SyncMenuItemEntity> items, object userData)
        {
            InvokeOnMainThread(() => {
                _items.InsertRange(index, items);

                List<NSIndexPath> indexPaths = new List<NSIndexPath>();
                for(int a = index; a < index + items.Count; a++)
                    indexPaths.Add(NSIndexPath.FromRowSection(a, 0));

                tableView.InsertRows(indexPaths.ToArray(), UITableViewRowAnimation.Top);
            });
        }
Exemplo n.º 6
0
 public void InsertItems(int index, SyncMenuItemEntity parentItem, List<SyncMenuItemEntity> items, object userData)
 {
     RunOnUiThread(() =>
     {
         _items.InsertRange(index, items);
         _listAdapter.SetData(_items);
     });
 }