private RootTreeViewItem BuildAsyncTree(object body)
        {

            RootTreeViewItem root = new RootTreeViewItem("AsyncMessage");
            BuildObjectTree(root, body, "Body", true,false);
            return root;
        }
        private RootTreeViewItem BuildAsyncTree(object body)
        {
            RootTreeViewItem root = new RootTreeViewItem("AsyncMessage");

            BuildObjectTree(root, body, "Body", true, false);
            return(root);
        }
        private void PacketListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 0 || e.AddedItems[0] == null)
            {
                ObjectTreeView.Items.Clear();
                return;
            }
            object item               = (sender as ListBox).SelectedItem;
            AcknowledgeListItem ack   = item as AcknowledgeListItem;
            AsyncListItem       async = item as AsyncListItem;
            ErrorListItem       err   = item as ErrorListItem;

            RootTreeViewItem root = null;

            if (ack != null)
            {
                root = BuildAckTree(ack.ServiceName, ack.Operation, ack.InvokeArguments, ack.Response);
            }
            else if (async != null)
            {
                root = BuildAsyncTree(async.Body);
            }
            else if (err != null)
            {
                root = BuildErrorTree(err.ServiceName, err.Operation, err.InvokeArguments, err.Error);
            }

            ObjectTreeView.Items.Clear();
            ObjectTreeView.Items.Add(root);
            root.IsNodeExpanded = true;
        }
        private RootTreeViewItem BuildErrorTree(string destination, string operation, object[] args, object response)
        {
            RootTreeViewItem root = new RootTreeViewItem ( "Invoke" );

            root.Items.Add(new PropertyValueTreeViewItem(root, "Destination", destination,false));
            root.Items.Add(new PropertyValueTreeViewItem(root, "Operation", operation,false));
            BuildObjectTree(root, args, "Arguments", true,false);
            BuildObjectTree(root, response, "Return", true,false);
            return root;
        }
        private RootTreeViewItem BuildErrorTree(string destination, string operation, object[] args, object response)
        {
            RootTreeViewItem root = new RootTreeViewItem("Invoke");

            root.Items.Add(new PropertyValueTreeViewItem(root, "Destination", destination, false));
            root.Items.Add(new PropertyValueTreeViewItem(root, "Operation", operation, false));
            BuildObjectTree(root, args, "Arguments", true, false);
            BuildObjectTree(root, response, "Return", true, false);
            return(root);
        }