Example #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);
        }
Example #2
0
        void cmd_Execute(object sender, CommandItemEventArgs e)
        {
            Util.DoAction(delegate
            {
                Connection conn = e.Context.Application.Connection;

                // lookup the server product to see if we are Vault Professional
                // remember the value so we don't have to look it up again in this session
                if (m_isVaultPro == null)
                {
                    Product[] products = conn.WebServiceManager.InformationService.GetSystemProducts();
                    m_isVaultPro       = products.Any(n => n.ProductName == "Autodesk.Productstream");
                }

                FinderDialog dialog = new FinderDialog(m_isVaultPro.Value, conn);
                DialogResult result = dialog.ShowDialog();

                if (result == DialogResult.OK && dialog.GoToLocation)
                {
                    LocationContext location = null;

                    if (dialog.GoToEntity.EntityClass.ServerId == VDF.Vault.Currency.Entities.EntityClassIds.ChangeOrders)
                    {
                        VDF.Vault.Currency.Entities.ChangeOrder co = dialog.GoToEntity as VDF.Vault.Currency.Entities.ChangeOrder;
                        if (co != null)
                        {
                            location = new LocationContext(SelectionTypeId.ChangeOrder, co.Number);
                        }
                    }
                    else if (dialog.GoToEntity.EntityClass.ServerId == VDF.Vault.Currency.Entities.EntityClassIds.CustomObject)
                    {
                        VDF.Vault.Currency.Entities.CustomObject custom = dialog.GoToEntity as VDF.Vault.Currency.Entities.CustomObject;
                        if (custom != null)
                        {
                            CustEnt custEnt = custom;
                            SelectionTypeId selectionType = new SelectionTypeId(custom.Definition.SystemName);
                            location = new LocationContext(selectionType, custEnt.Num);
                        }
                    }
                    else if (dialog.GoToEntity.EntityClass.ServerId == VDF.Vault.Currency.Entities.EntityClassIds.Files)
                    {
                        VDF.Vault.Currency.Entities.FileIteration file = dialog.GoToEntity as VDF.Vault.Currency.Entities.FileIteration;
                        if (file != null)
                        {
                            location = new LocationContext(SelectionTypeId.File, file.Parent.FullName + "/" + file.EntityName);
                        }
                    }
                    else if (dialog.GoToEntity.EntityClass.ServerId == VDF.Vault.Currency.Entities.EntityClassIds.Folder)
                    {
                        VDF.Vault.Currency.Entities.Folder folder = dialog.GoToEntity as VDF.Vault.Currency.Entities.Folder;
                        if (folder != null)
                        {
                            location = new LocationContext(SelectionTypeId.Folder, folder.FullName);
                        }
                    }
                    else if (dialog.GoToEntity.EntityClass.ServerId == VDF.Vault.Currency.Entities.EntityClassIds.Items)
                    {
                        VDF.Vault.Currency.Entities.ItemRevision item = dialog.GoToEntity as VDF.Vault.Currency.Entities.ItemRevision;
                        if (item != null)
                        {
                            location = new LocationContext(SelectionTypeId.Item, item.ItemNumber);
                        }
                    }

                    if (location != null)
                    {
                        e.Context.GoToLocation = location;
                    }
                }
            });
        }