Ejemplo n.º 1
0
        private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                if (e.Node is FeedNode)
                {
                    (e.Node as FeedNode).ShowContextMenu(e.Node.TreeView, e.Location);
                }
            }
            else if (e.Button == MouseButtons.Left)
            {
                // render the JSON in the right panel.
                this.currentText = null;
                this.currentJson = null;

                if (e.Node is DocumentNode)
                {
                    DocumentNode node = e.Node as DocumentNode;
                    string       body = node.GetBody();

                    if (!string.IsNullOrEmpty(body))
                    {
                        this.currentText = body;
                    }
                }

                if (e.Node.Tag is string)
                {
                    this.currentText = e.Node.Tag.ToString();
                }
                else if (e.Node is DatabaseAccountNode)
                {
                    this.currentJson = JsonConvert.SerializeObject(e.Node.Tag, Newtonsoft.Json.Formatting.Indented);
                }
                else if (e.Node.Tag != null)
                {
                    this.currentJson = e.Node.Tag.ToString();
                }

                if (this.currentJson == null && this.currentText == null)
                {
                    this.currentText = e.Node.Text;
                }

                this.DisplayResponseContent();
            }
        }