Esempio n. 1
0
        private void RefreshDialog()
        {
            TOList.Clear();
            treeView1.Nodes.Clear();
            LoadOptions(Application.StartupPath + @"\Tools\uVisionGenerator\Processors");

            foreach (TargetOptions to in TOList)
            {
                TreeNode VendorNode = GetVendorNode(to.Vendor);
                if (VendorNode == null)
                {
                    VendorNode = new TreeNode(to.Vendor);
                    treeView1.Nodes.Add(VendorNode);
                }
                VendorNode.Collapse();
                VendorNode.SelectedImageIndex = 0;
                VendorNode.ImageIndex         = 0;

                TreeNode DeviceNode = new TreeNode(to.Device);
                DeviceNode.SelectedImageIndex = 2;
                DeviceNode.ImageIndex         = 2;
                DeviceNode.Tag = to;

                VendorNode.Nodes.Add(DeviceNode);
            }
            treeView1.Sort();
        }
        public override void update()
        {
            CswNbtMetaDataObjectClass VendorOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.VendorClass );

            // For the existing vendor nodetype(s), set the default value of Internal to false.
            foreach( CswNbtMetaDataNodeType VendorNT in VendorOC.getNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp VendorInternalNTP = VendorNT.getNodeTypePropByObjectClassProp( CswNbtObjClassVendor.PropertyName.Internal );
                VendorInternalNTP.DesignNode.AttributeProperty[CswEnumNbtPropertyAttributeName.DefaultValue].AsLogical.Checked = CswEnumTristate.False;
                VendorInternalNTP.DesignNode.postChanges( false );

                // For all existing vendor nodes, set Internal to false.
                foreach( CswNbtObjClassVendor VendorNode in VendorNT.getNodes( false, true ) )
                {
                    VendorNode.Internal.Checked = CswEnumTristate.False;
                    VendorNode.postChanges( false );
                }

            }

            // Duplicate the existing Vendor nodetype, and name the new Vendor nodetype "Internal Vendor"
            CswNbtMetaDataNodeType FirstVendorNT = VendorOC.getNodeTypes().FirstOrDefault();
            if( null != FirstVendorNT )
            {
                CswNbtObjClassDesignNodeType NewVendorNTNode = FirstVendorNT.DesignNode.CopyNode( OnCopy: delegate( CswNbtNode CopiedNode )
                    {
                        ( (CswNbtObjClassDesignNodeType) CopiedNode ).NodeTypeName.Text = "Internal Vendor";
                    } );
                NewVendorNTNode.postChanges( false );

                // For the new vendor nodetype, set the default value of Internal to true.
                CswNbtMetaDataNodeTypeProp VendorInternalNTP = NewVendorNTNode.RelationalNodeType.getNodeTypePropByObjectClassProp( CswNbtObjClassVendor.PropertyName.Internal );
                VendorInternalNTP.DesignNode.AttributeProperty[CswEnumNbtPropertyAttributeName.DefaultValue].AsLogical.Checked = CswEnumTristate.True;
                VendorInternalNTP.DesignNode.postChanges( false );
            }

            // Fix the default 'Vendors' view to use the Vendor object class instead of the nodetype.
            if( _CswNbtSchemaModTrnsctn.isMaster() )
            {
                CswNbtView View = _CswNbtSchemaModTrnsctn.restoreView( "Vendors", CswEnumNbtViewVisibility.Global );
                if( null != View )
                {
                    View.Root.ChildRelationships.Clear();
                    CswNbtViewRelationship rel1 = View.AddViewRelationship( VendorOC, true );
                    View.save();
                }
            }

        } // update()