コード例 #1
0
        private void listViewHistory_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.treeViewJson.Nodes.Clear();
            if (this.listViewHistory.SelectedIndices.Count == 0)
            {
                return;
            }
            ResponseHistory.HistoryItem historyItem = FFRKProxy.Instance.ResponseHistory[this.listViewHistory.SelectedIndices[0]];
            if (historyItem.JsonObject == null)
            {
                if (historyItem.Handler == null)
                {
                    return;
                }
                historyItem.JsonObject = historyItem.Handler.CreateJsonObject(historyItem.Session);
            }
            this.textBoxJson.Text = JsonConvert.SerializeObject((object)historyItem.JsonObject, Formatting.Indented);
            TreeNode treeNode = new TreeNode("ROOT");

            this.treeViewJson.Nodes.Add(treeNode);
            this.Json2Tree(treeNode, historyItem.JsonObject);
            treeNode.Expand();
            foreach (TreeNode node in treeNode.Nodes)
            {
                node.Expand();
            }
            treeNode.EnsureVisible();
        }
コード例 #2
0
 private ListViewItem CreateListViewItem(ResponseHistory.HistoryItem data) => new ListViewItem(new string[2]
 {
     data.Timestamp.ToString(),
     ((ClientChatter)data.Session.oRequest).headers.RequestPath
 })
 {
     Tag = (object)data
 };
コード例 #3
0
        private ListViewItem CreateListViewItem(ResponseHistory.HistoryItem data)
        {
            string[] rows =
            {
                data.Timestamp.ToString(),
                data.Session.oRequest.headers.RequestPath
            };
            ListViewItem Item = new ListViewItem(rows);

            Item.Tag = data;
            return(Item);
        }
コード例 #4
0
        private void listViewHistory_SelectedIndexChanged(object sender, EventArgs e)
        {
            treeViewJson.Nodes.Clear();

            if (listViewHistory.SelectedIndices.Count == 0)
            {
                return;
            }

            int index = listViewHistory.SelectedIndices[0];

            ResponseHistory.HistoryItem hi = FFRKProxy.Instance.ResponseHistory[index];

            if (hi.JsonObject == null)
            {
                if (hi.Handler == null)
                {
                    return;
                }

                // This is expensive, so we do it only once
                hi.JsonObject = hi.Handler.CreateJsonObject(hi.Session);
            }

            string JsonText = JsonConvert.SerializeObject(hi.JsonObject, Formatting.Indented);

            textBoxJson.Text = JsonText;

            TreeNode root = new TreeNode("ROOT");

            treeViewJson.Nodes.Add(root);
            Json2Tree(root, hi.JsonObject);

            // Expand 2 levels deep
            root.Expand();
            foreach (TreeNode child in root.Nodes)
            {
                child.Expand();
            }
            root.EnsureVisible();
        }