コード例 #1
0
        private void AddComplexType_Click(object sender, System.EventArgs e)
        {
            UPnPComplexType c;
            TreeNode n = new TreeNode();

            ComplexTypeProperty ctp = new ComplexTypeProperty();
            if(ctp.ShowDialog()==DialogResult.OK)
            {
                c = new UPnPComplexType(ctp.LocalName,ctp.Namespace);
                upnpService.AddComplexType(c);
                n.Tag = c;
                n.Text = c.ToString();
                TypesView.Nodes.Add(n);
            }
        }
コード例 #2
0
        private void Properties_Click(object sender, System.EventArgs e)
        {
            TreeNode n = TypesView.SelectedNode;
            UPnPComplexType c;

            if(n.Tag.GetType()==typeof(UPnPComplexType))
            {
                c = (UPnPComplexType)n.Tag;

                ComplexTypeProperty ctp = new ComplexTypeProperty(c);
                if(ctp.ShowDialog()==DialogResult.OK)
                {
                    UPnPComplexType NewComplexType = new UPnPComplexType(ctp.LocalName,ctp.Namespace);
                    NewComplexType.ClearCollections();
                    foreach(UPnPComplexType.GenericContainer gc in c.Containers)
                    {
                        NewComplexType.AddContainer(gc);
                    }
                    upnpService.RemoveComplexType(c);
                    upnpService.AddComplexType(NewComplexType);
                    n.Tag = NewComplexType;
                    n.Text = NewComplexType.ToString();
                }
            }
            else if(n.Tag.GetType().BaseType == typeof(UPnPComplexType.GenericContainer))
            {
                ContainerProperty cp = new ContainerProperty(upnpService.GetComplexTypeList(),(UPnPComplexType.GenericContainer)n.Tag);
                if(cp.ShowDialog()==DialogResult.OK)
                {
                    if(n.Tag.GetType()==typeof(UPnPComplexType.ComplexContent))
                    {
                        ((UPnPComplexType.ComplexContent)n.Tag).RestExt = cp.re;
                    }
                    else if(n.Tag.GetType()==typeof(UPnPComplexType.ComplexContent))
                    {
                        ((UPnPComplexType.SimpleContent)n.Tag).RestExt = cp.re;
                    }
                }
            }
        }