Пример #1
0
        public static LabelFactory construct(IRootElement selectedElement)
        {
            LabelFactory labelFactory;

            if (selectedElement is ITable)
            {
                labelFactory = new LabelFactory_Table();
            }
            else if (selectedElement  is ITableExtension)
            {
                labelFactory = new LabelFactory_TableExtension();
            }
            else if (selectedElement is IMenuItem || selectedElement is IMenuItemExtension)
            {
                labelFactory = new LabelFactory_IMenuItem();
            }
            else if (selectedElement is IForm)
            {
                labelFactory = new LabelFactory_Form();
            }
            else if (selectedElement is ISecurityDuty)
            {
                labelFactory = new LabelFactory_ISecurityDuty();
            }
            else if (selectedElement is ISecurityPrivilege)
            {
                labelFactory = new LabelFactory_ISecurityPrivilege();
            }
            else if (selectedElement is ISecurityRole)
            {
                labelFactory = new LabelFactory_ISecurityRole();
            }
            else if (selectedElement is IEdtBase)
            {
                labelFactory = new LabelFactory_IEdtBase();
            }
            else if (selectedElement is IBaseEnum)
            {
                labelFactory = new LabelFactory_IBaseEnum();
            }
            // add additional elseifs here
            else
            {
                throw new Exception($"Type {selectedElement.GetMetadataType().Name} not implemented yet");
            }

            labelFactory.setElement(selectedElement);

            return(labelFactory);
        }
Пример #2
0
        public static LabelFactory construct(IRootElement selectedElement)
        {
            LabelFactory labelFactory = null;

            if (selectedElement is ITable)
            {
                labelFactory = new LabelFactory_Table();
            }
            else if (selectedElement is ITableExtension)
            {
                labelFactory = new LabelFactory_TableExtension();
            }
            else if (selectedElement is IDataEntity)
            {
                labelFactory = new LabelFactory_DataEntity();
            }
            else if (selectedElement is Microsoft.Dynamics.Framework.Tools.MetaModel.Automation.DataEntityViews.IDataEntityViewExtension)
            {
                labelFactory = new LabelFactory_DataEntityExtension();
            }
            else if (selectedElement is IMenuItem || selectedElement is IMenuItemExtension)
            {
                labelFactory = new LabelFactory_IMenuItem();
            }
            else if (selectedElement is IForm)
            {
                labelFactory = new LabelFactory_Form();
            }
            else if (selectedElement is ISecurityDuty)
            {
                labelFactory = new LabelFactory_ISecurityDuty();
            }
            else if (selectedElement is ISecurityPrivilege)
            {
                labelFactory = new LabelFactory_ISecurityPrivilege();
            }
            else if (selectedElement is ISecurityRole)
            {
                labelFactory = new LabelFactory_ISecurityRole();
            }
            else if (selectedElement is IEdtBase)
            {
                labelFactory = new LabelFactory_IEdtBase();
            }
            else if (selectedElement is IBaseEnum)
            {
                labelFactory = new LabelFactory_IBaseEnum();
            }
            else if (selectedElement is IBaseEnumExtension)
            {
                labelFactory = new LabelFactory_IBaseEnumExtension();
            }
            else if (selectedElement is IConfigurationKey)
            {
                labelFactory = new LabelFactory_IConfigurationKey();
            }
            // add additional elseifs here
            else
            {
                throw new Exception($"Type {selectedElement.GetMetadataType().Name} not implemented yet");
            }

            labelFactory.setElement(selectedElement);

            return(labelFactory);
        }