예제 #1
0
        public IEnumerable <DetailPaneTab> DetailTabs()
        {
            // The json file only gets created, if Vault DataStandard is installed
            var jsonFile = @"C:\ProgramData\Autodesk\Vault 2018\Extensions\DataStandard\" +
                           @"Vault\CustomEntityDefinitions.json";

            if (System.IO.File.Exists(jsonFile))
            {
                var text        = System.IO.File.ReadAllText(jsonFile);
                var definitions = Newtonsoft.Json.JsonConvert.
                                  DeserializeObject <CustomEntityDefinition[]>(text);
                foreach (var definition in definitions)
                {
                    var entityDefinition = definition.EntityDefinitions.FirstOrDefault(
                        e => e.dispNameField == "Organisation");
                    if (entityDefinition != null)
                    {
                        var selectionTypeId = new SelectionTypeId(entityDefinition.nameField);
                        var detailPaneTab   = new DetailPaneTab(
                            "Organisation.Tab.OrdersTab",
                            "Orders",
                            selectionTypeId,
                            typeof(OrdersUserControl));
                        detailPaneTab.SelectionChanged += OrganisationSelectionChanged;

                        return(new List <DetailPaneTab> {
                            detailPaneTab
                        });
                    }
                }
            }

            return(null);
        }
예제 #2
0
        /// <summary>
        /// This function tells Vault Explorer what custom tabs this extension provides.
        /// Part of the IExtension interface.
        /// </summary>
        /// <returns>A collection of DetailTabs, each object represents a custom tab.</returns>
        public IEnumerable <DetailPaneTab> DetailTabs()
        {
            // Create a DetailPaneTab list to return from method
            List <DetailPaneTab> fileTabs = new List <DetailPaneTab>();

            // Create Selection Info tab for Files
            DetailPaneTab filePropertyTab = new DetailPaneTab("File.Tab.PropertyGrid",
                                                              "Selection Info",
                                                              SelectionTypeId.File,
                                                              typeof(MyCustomTabControl));

            // The propertyTab_SelectionChanged is called whenever our tab is active and the selection changes in the
            // main grid.
            filePropertyTab.SelectionChanged += propertyTab_SelectionChanged;
            fileTabs.Add(filePropertyTab);

            // Create Selection Info tab for Folders
            DetailPaneTab folderPropertyTab = new DetailPaneTab("Folder.Tab.PropertyGrid",
                                                                "Selection Info",
                                                                SelectionTypeId.Folder,
                                                                typeof(MyCustomTabControl));

            folderPropertyTab.SelectionChanged += propertyTab_SelectionChanged;
            fileTabs.Add(folderPropertyTab);

            // Create Selection Info tab for Items
            DetailPaneTab itemPropertyTab = new DetailPaneTab("Item.Tab.PropertyGrid",
                                                              "Selection Info",
                                                              SelectionTypeId.Item,
                                                              typeof(MyCustomTabControl));

            itemPropertyTab.SelectionChanged += propertyTab_SelectionChanged;
            fileTabs.Add(itemPropertyTab);

            // Create Selection Info tab for Change Orders
            DetailPaneTab coPropertyTab = new DetailPaneTab("Co.Tab.PropertyGrid",
                                                            "Selection Info",
                                                            SelectionTypeId.ChangeOrder,
                                                            typeof(MyCustomTabControl));

            coPropertyTab.SelectionChanged += propertyTab_SelectionChanged;
            fileTabs.Add(coPropertyTab);

            // Return tabs
            return(fileTabs);
        }