Inheritance: PacketListItem
Example #1
0
        private void PacketListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 0 || e.AddedItems[0] == null)
            {
                return;
            }

            object item               = (sender as ListBox).SelectedItem;
            AcknowledgeListItem ack   = item as AcknowledgeListItem;
            AsyncListItem       async = item as AsyncListItem;
            ErrorListItem       err   = item as ErrorListItem;

            if (ack != null)
            {
                ObjectTree.SetRoot("Invoke", BuildAck(ack.ServiceName, ack.Operation, ack.InvokeArguments, ack.Response));
            }
            else if (async != null)
            {
                ObjectTree.SetRoot("AsyncMessage", BuildAsync(async.Body));
            }
            else if (err != null)
            {
                ObjectTree.SetRoot("Invoke", BuildError(err.ServiceName, err.Operation, err.InvokeArguments, err.Response));
            }
        }
        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;
        }