private void SetItemNodeConnecting(ObjectExplorerItem item)
 {
     ApplyForItemNodes(item, (ITreeNode node) =>
     {
         node.Text = "[...wait...] " + item.Name;
     });
 }
        private ITreeNode CreateTreeNodeForItem(ObjectExplorerItem item)
        {
            ITreeNode n = item.ToUITreeNode(TreeNodeFactory, AddNodeForItem);

            AddNodeForItem(n, item);
            return(n);
        }
 private void SetItemNodeActivated(ObjectExplorerItem item, bool isActive)
 {
     ApplyForItemNodes(item, (ITreeNode node) =>
     {
         node.IsBold = isActive;
     });
 }
        private IMenuItem[] GenerateNodeMenuItems(ITreeNode treeNode)
        {
            ObjectExplorerItem objectExplorerItem = treeNode.Data as ObjectExplorerItem;

            switch (objectExplorerItem.ItemType)
            {
            case ObjectExplorerItemType.Connections:
            {
                return(new IMenuItem[]
                    {
                        MenuFactory.CreateMenuItem("Add connection", () => CommandBus.Send(new ConnectionAddCommand()))
                    });
            }

            case ObjectExplorerItemType.Connection:
            {
                ConnectionItem connectionItem = objectExplorerItem as ConnectionItem;
                return(new IMenuItem[]
                    {
                        MenuFactory.CreateMenuItem("Connect", () => CommandBus.Send(new ConnectCommand(connectionItem))),
                        MenuFactory.CreateMenuItem("Edit", () => CommandBus.Send(new ConnectionEditCommand(connectionItem)))
                    });
            }

            default:
                return(new IMenuItem[] { });
            }
        }
 private void SetItemNodeConnected(ObjectExplorerItem item)
 {
     ApplyForItemNodes(item, (ITreeNode node) =>
     {
         node.Text   = "[C] " + item.Name;
         node.IsBold = true;
     });
 }
 private void SetItemNodeConnectingFailed(ObjectExplorerItem item)
 {
     ApplyForItemNodes(item, (ITreeNode node) =>
     {
         node.Text   = "[Failed] " + item.Name;
         node.IsBold = false;
     });
 }
 private void SetItemNodeDisconnected(ObjectExplorerItem item)
 {
     ApplyForItemNodes(item, (ITreeNode node) =>
     {
         node.Text   = item.Name;
         node.IsBold = false;
     });
 }
        private void AddNodeForItem(ITreeNode node, ObjectExplorerItem item)
        {
            if (!nodesForItem.ContainsKey(item))
            {
                nodesForItem.Add(item, new List <ITreeNode>());
            }

            nodesForItem[item].Add(node);
        }
 private void ApplyForItemNodes(ObjectExplorerItem item, Action <ITreeNode> action)
 {
     if (nodesForItem.ContainsKey(item))
     {
         foreach (ITreeNode node in nodesForItem[item])
         {
             action(node);
         }
     }
 }
        public static ITreeNode ToUITreeNode(this ObjectExplorerItem item, ITreeNodeFactory factory, Action <ITreeNode, ObjectExplorerItem> action)
        {
            ITreeNode uinode = factory.Create();

            uinode.Text = item.Name;
            uinode.Data = item;
            action?.Invoke(uinode, item);
            foreach (var explorerItem in item.Items)
            {
                uinode.Nodes.Add(explorerItem.ToUITreeNode(factory, action));
            }

            return(uinode);
        }
Exemple #11
0
 public ConnectionLink(ObjectExplorerItem item, IConnection connection)
 {
     Item       = item;
     Connection = connection;
 }