Ejemplo n.º 1
0
        private Operation GetPortTypeOperation(WsdlTreeViewItem item)
        {
            PortType  pt          = wsdlIn.serviceDescription.PortTypes[item.Parent.Parent.Name];
            Operation ptOperation = null;

            for (int i = 0; i < pt.Operations.Count; i++)
            {
                if (pt.Operations[i].Name == item.Name)
                {
                    ptOperation = pt.Operations[i];
                    break;
                }
            }

            return(ptOperation);
        }
Ejemplo n.º 2
0
        private OperationBinding GetOperationBinding(WsdlTreeViewItem item)
        {
            Binding          bind          = wsdlIn.serviceDescription.Bindings[item.Parent.Name];
            OperationBinding bindOperation = null;

            for (int i = 0; i < bind.Operations.Count; i++)
            {
                if (bind.Operations[i].Name == item.Name)
                {
                    bindOperation = bind.Operations[i];
                    break;
                }
            }

            return(bindOperation);
        }
Ejemplo n.º 3
0
        private void LoadWsdlTreeView(WsdlDocument wsdl)
        {
            wsdlTree.Items.Clear();

            foreach (Service service in wsdl.serviceDescription.Services)
            {
                WsdlTreeViewItem serviceTreeItem = new WsdlTreeViewItem();
                serviceTreeItem.PropertyChanged += new PropertyChangedEventHandler(TreeItem_Change);

                serviceTreeItem.Name = service.Name;
                serviceTreeItem.Type = WsdlElementType.Service;
                foreach (Port port in service.Ports)
                {
                    string portBinding = port.Binding.Name;
                    foreach (Binding binding in wsdl.serviceDescription.Bindings)
                    {
                        if (binding.Name == portBinding)
                        {
                            WsdlTreeViewItem bindingTreeItem = new WsdlTreeViewItem();
                            bindingTreeItem.PropertyChanged += new PropertyChangedEventHandler(TreeItem_Change);
                            bindingTreeItem.Name             = binding.Name;
                            bindingTreeItem.Parent           = serviceTreeItem;
                            bindingTreeItem.Type             = WsdlElementType.Binding;
                            foreach (OperationBinding operation in binding.Operations)
                            {
                                WsdlTreeViewItem operationTreeItem = new WsdlTreeViewItem();
                                operationTreeItem.PropertyChanged += new PropertyChangedEventHandler(TreeItem_Change);
                                operationTreeItem.Name             = operation.Name;
                                operationTreeItem.Parent           = bindingTreeItem;
                                operationTreeItem.Type             = WsdlElementType.Operation;
                                bindingTreeItem.Children.Add(operationTreeItem);
                            }
                            bindingTreeItem.Children.Sort();
                            serviceTreeItem.Children.Add(bindingTreeItem);
                            SetUpOutputWsdl(wsdl);
                        }
                    }
                }
                wsdlTree.Items.Add(serviceTreeItem);
                wsdlTree.Items.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
            }
        }
Ejemplo n.º 4
0
        private void TreeItem_Change(object sender, PropertyChangedEventArgs e)
        {
            WsdlTreeViewItem item = (WsdlTreeViewItem)sender;

            if (item.Type == WsdlElementType.Operation)
            {
                if (item.IsChecked.HasValue && item.IsChecked.Value)
                {
                    wsdlOut.AddPortTypeOperation(item.Parent.Parent.Name, GetPortTypeOperation(item));
                    wsdlOut.AddOperationBinding(item.Parent.Name, GetOperationBinding(item));
                }
                else
                if (item.IsChecked.HasValue && !item.IsChecked.Value)
                {
                    wsdlOut.RemovePortTypeOperation(item.Parent.Parent.Name, GetPortTypeOperation(item));
                    wsdlOut.RemoveOperationBinding(item.Parent.Name, GetOperationBinding(item));
                }
            }

            UpdateDocumentView(wsdlOut);
        }