Exemplo n.º 1
0
        public void SetRefresh(BaseItem item)
        {
            BaseItem baseItem = GetActiveItem();

            if (baseItem == null)
            {
                return;
            }

            // We need access to the builder here :/
            if (baseItem != null && _builders.ContainsKey(baseItem))
            {
                BaseGraphBuilder builder = _builders[baseItem];
                if (item != null)
                {
                    string id = item.GetID();

                    // TODO - short id - added nodes do not have full ids.
                    string[] bits = id.Split('?');
                    if (bits.Length > 1)
                    {
                        id = bits[1];
                    }

                    if (builder.AddedNodes.ContainsKey(id))
                    {
                        // We know we added this node, so we do a refresh
                        ForceRefresh();
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void RemoveItem(BaseItem item)
        {
            if (!_rows.ContainsKey(item))
            {
                return;
            }

            _grid.Rows.Remove(_rows[item]);
            _rows.Remove(item);
            _lookup.Remove(item.GetID());
        }
Exemplo n.º 3
0
        public void AddItem(BaseItem item)
        {
            if (_rows.ContainsKey(item)) return;

            _grid.Rows.Add(new object[] { item.Name });
            _grid.CommitEdit(DataGridViewDataErrorContexts.CurrentCellChange);
            DataGridViewRow row = _grid.Rows[_grid.Rows.Count - 1];

            _rows.Add(item, row);

            row.Tag = item;

            row.Selected = true;

            _lookup.Add(item.GetID(), item);
        }
Exemplo n.º 4
0
        public void AddItem(BaseItem item)
        {
            if (_rows.ContainsKey(item))
            {
                return;
            }

            _grid.Rows.Add(new object[] { item.Name });
            _grid.CommitEdit(DataGridViewDataErrorContexts.CurrentCellChange);
            DataGridViewRow row = _grid.Rows[_grid.Rows.Count - 1];

            _rows.Add(item, row);

            row.Tag = item;

            row.Selected = true;

            _lookup.Add(item.GetID(), item);
        }
Exemplo n.º 5
0
        public void SetRefresh(BaseItem item)
        {
            BaseItem baseItem = GetActiveItem();
            if (baseItem == null) return;

            // We need access to the builder here :/
            if (baseItem != null && _builders.ContainsKey(baseItem))
            {
                BaseGraphBuilder builder = _builders[baseItem];
                if (item != null)
                {
                    string id = item.GetID();

                    // TODO - short id - added nodes do not have full ids.
                    string[] bits = id.Split('?');
                    if (bits.Length > 1)
                    {
                        id = bits[1];
                    }

                    if (builder.AddedNodes.ContainsKey(id))
                    {
                        // We know we added this node, so we do a refresh
                        ForceRefresh();
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void AddWithParent(BaseItem item, Node parent, int idx)
        {
            string id = item.GetID();

            if (_items.ContainsKey(id)) return;

            Node node = null;
            if (parent != null)
            {
                if (parent is FavouritesNode && (parent as FavouritesNode).IsFolder)
                {
                    // Standard.
                    node = new FavouritesNode(item.Name, id, false, item);
                    if (idx == -1) parent.Nodes.Add(node);
                    else parent.Nodes.Insert(idx, node);
                }
                else
                {
                    // May be the "root" Node.
                    node = new FavouritesNode(item.Name, id, false, item);

                    if (parent.Parent != null)
                    {
                        if (idx == -1) parent.Parent.Nodes.Add(node);
                        else parent.Parent.Nodes.Insert(idx, node);
                    }
                    else
                    {
                        if (idx == -1) _treeModel.Nodes.Add(node);
                        else _treeModel.Nodes.Insert(idx, node);
                    }
                }
            }
            else
            {
                node = new FavouritesNode(item.Name, id, false, item);
                _treeModel.Nodes.Add(node);
            }

            AddInternal(id, (FavouritesNode)node);
        }
Exemplo n.º 7
0
        internal virtual void Remove(BaseItem item)
        {
            string id = item.GetID();

            if (!_items.ContainsKey(id))
            {
                _windowManager.Logger.LogStr("Warning : Favourite not found to remove : " + id);
                return;
            }

            RemoveInternal(id);
        }
Exemplo n.º 8
0
        private void ActivateItem(BaseItem item)
        {
            if (item == null)
            {
                _windowManager.Logger.LogStr("Warning : ActivateItem : item is null");
                return;
            }

            _currentItem = item;
            _windowManager.BroadcastItemChange(this, _currentItem);
            _statusManager.SetLeftCaption(_currentItem.GetID());

            _model.Prioritise(_treeView.SelectedNode.Tag as BaseItem);
        }
Exemplo n.º 9
0
        public void RemoveItem(BaseItem item)
        {
            if (!_rows.ContainsKey(item)) return;

            _grid.Rows.Remove(_rows[item]);
            _rows.Remove(item);
            _lookup.Remove(item.GetID());
        }