コード例 #1
0
 public IControlFactory Make(GenerateFormModel generateFormModel, PropertyInformationViewModel propertyInformationViewModel)
 {
     return(new CheckBoxFactory(generateFormModel, propertyInformationViewModel));
 }
コード例 #2
0
        void LoadPropertyInformation(TypeDefinition typeDefinition, ClassEntity classEntity, Hashtable assembliesToLoad, ProjectType projectFrameworkType, String parentPropertyName = "")
        {
            foreach (var property in GetAllPropertiesForType(typeDefinition, assembliesToLoad, projectFrameworkType))
            {
                TypeDefinition td = property.PropertyType as TypeDefinition;
                if (td == null)
                {
                    var tr = property.PropertyType;
                    if (tr != null)
                    {
                        // Only Silverlight requires this try/catch.
                        try {
                            td = tr.Resolve();
                        } catch {
                            Debug.WriteLine(property.Name);
                        }
                    }
                }

                var isEnumerable = IsTypeNameEnumerable(property.PropertyType.FullName);
                if (!isEnumerable)
                {
                    if (td?.BaseType != null)
                    {
                        isEnumerable = IsTypeNameEnumerable(td.BaseType.FullName);
                    }
                }

                var pi = new PropertyInformationViewModel(CanWrite(property), property.Name, FormatPropertyTypeName(property), property.PropertyType.Namespace, classEntity.ProjectType, classEntity.ClassName, isEnumerable, false, parentPropertyName);

                if (property.PropertyType is Mono.Cecil.GenericInstanceType)
                {
                    var obj = (GenericInstanceType)property.PropertyType;
                    if (obj.HasGenericArguments)
                    {
                        foreach (TypeReference genericTr in obj.GenericArguments)
                        {
                            pi.GenericArguments.Add(genericTr.Name);
                            if (!genericTr.Namespace.Contains("System") && !genericTr.Namespace.Contains("Xamarin."))
                            {
                                var genericTd = genericTr as TypeDefinition;
                                if (genericTd == null)
                                {
                                    try {
                                        genericTd = genericTr.Resolve();
                                    } catch {
                                        Debug.WriteLine(genericTr.Name);
                                        continue;
                                    }
                                }

                                if (genericTd != null)
                                {
                                    if (genericTd.HasProperties && genericTd.IsPublic && genericTd.IsClass && !genericTd.IsAbstract && !genericTd.Namespace.Contains("System") && !genericTd.Namespace.Contains("Xamarin."))
                                    {
                                        foreach (var prop in genericTd.Properties)
                                        {
                                            pi.GenericCollectionClassPropertyNames.Add(prop.Name);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                if (property.HasParameters)
                {
                    foreach (var pd in property.Parameters)
                    {
                        pi.PropertyParameters.Add(new PropertyParameter(pd.Name, pd.ParameterType.Name));
                    }
                }
                classEntity.PropertyInformationCollection.Add(pi);

                if (td != null)
                {
                    if (td.HasProperties && td.IsPublic && td.IsClass && !td.IsAbstract && !td.Namespace.Contains("System") && !td.Namespace.Contains("Xamarin."))
                    {
                        var childTypeDefinition     = td;
                        var childAssemblyDefinition = td.Module.Assembly;
                        pi.ClassEntity = new ClassEntity(childAssemblyDefinition, childTypeDefinition, classEntity.ProjectType, "");
                        LoadPropertyInformation(childTypeDefinition, pi.ClassEntity, assembliesToLoad, projectFrameworkType, pi.Name);
                    }
                }
            }
        }
コード例 #3
0
 Boolean CanDrillIntoCommandExecute(PropertyInformationViewModel propertyInformationViewModel)
 {
     return(propertyInformationViewModel.IsDrillableProperty);
 }
コード例 #4
0
 public ControlTemplateModel(GenerateFormModel generateFormModel, PropertyInformationViewModel viewModel)
     : base(generateFormModel, viewModel)
 {
     this.EditorProperties = (T)viewModel.ControlSpecificProperties;
 }
コード例 #5
0
 public FormComponentModel(GenerateFormModel generateFormModel, PropertyInformationViewModel viewModel)
     : base(generateFormModel, viewModel)
 {
     this.ControlFactory = viewModel.GetTemplateFactory().Make(generateFormModel, viewModel);
 }
コード例 #6
0
 public bool Post([FromBody] PropertyInformationViewModel property)
 {
     return(_propertyRepository.Upsert(property));
 }
コード例 #7
0
 public IControlFactory Make(GenerateFormModel generateFormModel, PropertyInformationViewModel propertyInformationViewModel)
 {
     return(new BindablePickerFactory(generateFormModel, propertyInformationViewModel));
 }
コード例 #8
0
        void LoadPropertyInformation(AssemblyDefinition assemblyDefinition, TypeDefinition typeDefinition, ClassEntity classEntity, String parentPropertyName = "")
        {
            foreach (var property in GetAllPropertiesForType(assemblyDefinition, typeDefinition))
            {
                var isEnumerable = IsTypeNameEnumerable(property.PropertyType.FullName);
                if (!isEnumerable)
                {
                    var td = property.PropertyType as TypeDefinition;
                    if (td?.BaseType != null)
                    {
                        isEnumerable = IsTypeNameEnumerable(td.BaseType.FullName);
                    }
                }

                var pi = new PropertyInformationViewModel(CanWrite(property), property.Name, FormatPropertyTypeName(property), property.PropertyType.Namespace, classEntity.ProjectType, classEntity.ClassName, isEnumerable, false, parentPropertyName);

                if (property.PropertyType is Mono.Cecil.GenericInstanceType)
                {
                    var obj = (GenericInstanceType)property.PropertyType;
                    if (obj.HasGenericArguments)
                    {
                        foreach (TypeReference genericTr in obj.GenericArguments)
                        {
                            pi.GenericArguments.Add(genericTr.Name);
                            if (!genericTr.Namespace.Contains("System"))
                            {
                                TypeDefinition genericTd = genericTr as TypeDefinition;
                                if (genericTd == null)
                                {
                                    genericTd = genericTr.Resolve();
                                }

                                if (genericTd != null)
                                {
                                    if (genericTd.HasProperties && genericTd.IsPublic && genericTd.IsClass && !genericTd.IsAbstract && !genericTd.Namespace.Contains("System"))
                                    {
                                        foreach (var prop in genericTd.Properties)
                                        {
                                            pi.GenericCollectionClassPropertyNames.Add(prop.Name);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                if (property.HasParameters)
                {
                    foreach (var pd in property.Parameters)
                    {
                        pi.PropertyParameters.Add(new PropertyParameter(pd.Name, pd.ParameterType.Name));
                    }
                }
                classEntity.PropertyInformationCollection.Add(pi);

                if (property.PropertyType is TypeDefinition)
                {
                    var td = (TypeDefinition)property.PropertyType;
                    if (td.HasProperties && td.IsPublic && td.IsClass && !td.IsAbstract)
                    {
                        var childTypeDefinition = assemblyDefinition.MainModule.GetType(td.FullName);
                        pi.ClassEntity = new ClassEntity(assemblyDefinition, childTypeDefinition, classEntity.ProjectType, "");
                        LoadPropertyInformation(assemblyDefinition, childTypeDefinition, pi.ClassEntity, pi.Name);
                    }
                }
            }
        }