Esempio n. 1
0
        private void CreatePropertyDefAliases()
        {
            PropertyDefsAdmin propDefs = vault.PropertyDefOperations.GetPropertyDefsAdmin();

            foreach (PropertyDefAdmin pda in propDefs)
            {
                // Skip built-in properties. Modify this if you need to include one or more of these.
                if (pda.PropertyDef.ID <= 101)
                {
                    continue;
                }

                string pdName  = pda.PropertyDef.Name.Replace(" ", "");  //String.Empty);
                string aliases = pda.SemanticAliases.Value;

                Alias newAlias = new Alias(Alias.ELEMENT_TYPE_PD, pdName, pdPrefix);

                // Add the new alias if not already there.
                string updatedAliases = AddAlias(aliases, newAlias.ElementAlias);

                if (aliases != updatedAliases)
                {
                    pda.SemanticAliases.Value = updatedAliases;
                    vault.PropertyDefOperations.UpdatePropertyDefAdmin(pda);
                }

                // We will need the alias object later when generating the "Aliases.cs" and "Config.cs" files.
                pdAliases.Add(newAlias);
            }
        }
Esempio n. 2
0
        // Note: Will go through ALL property defs, even built-in ones (modify the code if different behavior
        // is needed).
        private void ClearAllPropertyDefAliases()
        {
            PropertyDefsAdmin propDefs = vault.PropertyDefOperations.GetPropertyDefsAdmin();

            foreach (PropertyDefAdmin pda in propDefs)
            {
                pda.SemanticAliases.Value = "";
                vault.PropertyDefOperations.UpdatePropertyDefAdmin(pda);
            }
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            // Connect to the vault and continue if successful.
            if (!ConnectToSelectedVault())
            {
                return;
            }

            PropertyDefsAdmin propDefs = vault.PropertyDefOperations.GetPropertyDefsAdmin();

            foreach (PropertyDefAdmin pda in propDefs)
            {
                propertyComboBox.Items.Add(new PropertyComboBoxItem(pda.PropertyDef.Name, pda.PropertyDef.ID));
            }
        }
Esempio n. 4
0
        // Note: Will go through ALL property defs, even built-in ones (modify the code if different behavior
        // is needed).
        private void ClearSelectedPropertyDefAliases()
        {
            PropertyDefsAdmin propDefs = vault.PropertyDefOperations.GetPropertyDefsAdmin();

            foreach (PropertyDefAdmin pda in propDefs)
            {
                string pdName  = pda.PropertyDef.Name.Replace(" ", "");  //String.Empty);
                string aliases = pda.SemanticAliases.Value;

                // Remove the aliasPrefix if it exists.
                string updatedAliases = RemoveAlias(aliases, pdPrefix + pdName);

                if (aliases != updatedAliases)
                {
                    pda.SemanticAliases.Value = updatedAliases;
                    vault.PropertyDefOperations.UpdatePropertyDefAdmin(pda);
                }
            }
        }