Inheritance: System.Windows.Forms.TreeNode
示例#1
0
        private void TvConnectionsRightClick(BaseTreeNode treeNode)
        {
            tvConnections.ContextMenuStrip = null;

            SelectedNode = treeNode;

            if (treeNode.NodeType == NodeType.NewConnection)
            {

            }
            else if (treeNode.NodeType == NodeType.Connection)
            {
                var connectionNode = (ConnectionNode)(treeNode);

                if (BlockStudioProjectService.BlockStudioProject.Connection.ConnectionType == ConnectionType.Instance)
                {
                    ConnectionNodeContextMenu.Items[0].Text = connectionNode.HasConnected ? "&Refresh" : "&Connect";
                    ConnectionNodeContextMenu.Items[3].Enabled = true;
                }
                else
                {

                    ConnectionNodeContextMenu.Items[3].Enabled = false;
                }

                tvConnections.ContextMenuStrip = ConnectionNodeContextMenu;
            }
            else if (treeNode.NodeType == NodeType.AccountParent)
            {
                tvConnections.ContextMenuStrip = AccountParentContextMenuStrip;
            }
            else if (treeNode.NodeType == NodeType.Account)
            {
                var accountNode = (AccountNode)treeNode;
                if (accountNode.Account.LockState == LockedState.Unlocked)
                {
                    AccountContextMenuStrip.Items[0].Enabled = false;
                    AccountContextMenuStrip.Items[1].Enabled = true;
                }
                else
                {
                    AccountContextMenuStrip.Items[0].Enabled = true;
                    AccountContextMenuStrip.Items[1].Enabled = false;
                }

                tvConnections.ContextMenuStrip = AccountContextMenuStrip;
            }
            else if (treeNode.NodeType == NodeType.Address)
            {
                tvConnections.ContextMenuStrip = addressMenuStrip;
            }
        }
示例#2
0
        private void TvConnectionsLeftClick(BaseTreeNode baseTreeNode)
        {
            if (baseTreeNode.NodeType == NodeType.Connection)
            {
                var connectionNode = (ConnectionNode)baseTreeNode;

                if (!connectionNode.HasConnected)
                {
                    AttemptConnection(connectionNode);

                }
            }
        }