form to edit Type's name
Inheritance: System.Windows.Forms.Form
Exemple #1
0
        /// <summary>
        /// hidden subclass' method;
        /// display EditTypeNameForm to get type name;
        /// then duplicate FamilySymbol
        /// </summary>
        public new DialogResult ShowDialog()
        {
            try
            {
                // generate the duplicate one's initial Name
                string initialTypeName = m_typesMgr.GenerateSymbolName(m_copiedSymbol.Name);
                // provide UI for user to edit the duplicate one's name
                using (EditTypeNameForm typeNameFrm = new EditTypeNameForm(initialTypeName))
                {
                    // cancel the command of duplicate
                    if (typeNameFrm.ShowDialog() != DialogResult.OK)
                    {
                        return(DialogResult.Cancel);
                    }

                    // generate the duplicate one's Name used to create with Name edited in EditTypeNameForm
                    string finalTypeName = m_typesMgr.GenerateSymbolName(typeNameFrm.TypeName);
                    // duplicate FamilySymbol
                    m_newSymbol = m_typesMgr.DuplicateSymbol(m_copiedSymbol, finalTypeName);
                }
            }
            catch
            {
                TaskDialog.Show("Revit", "Failed to duplicate Type.");
                TaskDialog.Show("Revit", "Failed to duplicate Type.");
                return(DialogResult.Abort);
            }
            return(base.ShowDialog());
        }
Exemple #2
0
        /// <summary>
        /// hidden subclass' method;
        /// display EditTypeNameForm to get type name;
        /// then duplicate FamilySymbol
        /// </summary>
        public new DialogResult ShowDialog()
        {
            try
            {
                // generate the duplicate one's initial Name
                string initialTypeName = m_typesMgr.GenerateSymbolName(m_copiedSymbol.Name);
                // provide UI for user to edit the duplicate one's name
                using (EditTypeNameForm typeNameFrm = new EditTypeNameForm(initialTypeName))
                {
                    // cancel the command of duplicate
                    if (typeNameFrm.ShowDialog() != DialogResult.OK)
                    {
                        return DialogResult.Cancel;
                    }

                    // generate the duplicate one's Name used to create with Name edited in EditTypeNameForm
                    string finalTypeName = m_typesMgr.GenerateSymbolName(typeNameFrm.TypeName);
                    // duplicate FamilySymbol
                    m_newSymbol = m_typesMgr.DuplicateSymbol(m_copiedSymbol, finalTypeName);
                }
            }
            catch
            {
                MessageBox.Show("Failed to duplicate Type.", "Revit");
                return DialogResult.Abort;
            }
            return base.ShowDialog();
        }