bool RegisterFieldtypeRegistry(IFieldTypeRegistry fieldtypeRegistry) { foreach (var ctr in FContainerRegs) { if (ctr.ContainerType == fieldtypeRegistry.ContainerType) { fieldtypeRegistry.ContainerRegistry = ctr; FDeclarationFactory.AddFieldTypeRegistry(fieldtypeRegistry); return(true); } } return(false); }
//public string ToJson(Declaration declaration) //{ // return declaration.ToString();//DeclarationSerializer.Write(declaration); //} //------------- void UpdateField(IFieldTypeRegistry fieldtypeRegistry, string typestring) { foreach (var k in FFields.Keys) { if (FFields[k].Typestring == typestring) { Type t = null; if (fieldtypeRegistry.StringToType(typestring, out t)) { FFields[k].FieldType = t; FFields[k].ContainerType = fieldtypeRegistry.ContainerType; FFields[k].ContainerRegistry = fieldtypeRegistry.ContainerRegistry; fieldtypeRegistry.TypeToString(t, out typestring); FFields[k].Typestring = typestring; FFields[k].InvokeChanged(); } } } }
void AssemblyAdded(IFieldTypeRegistry fieldtypeRegistry) { foreach (var k in FFields.Keys) { if (FFields[k].ContainerType == "Null") { Type t = null; if (fieldtypeRegistry.StringToType(FFields[k].Typestring, out t) && t != FFields[k].FieldType) { FFields[k].FieldType = t; FFields[k].ContainerType = fieldtypeRegistry.ContainerType; FFields[k].ContainerRegistry = fieldtypeRegistry.ContainerRegistry; var typestring = FFields[k].Typestring; fieldtypeRegistry.TypeToString(t, out typestring); //normalize typestring FFields[k].Typestring = typestring; FFields[k].InvokeChanged(); } } } }
public void AddFieldTypeRegistry(IFieldTypeRegistry registry) { FFieldTypeRegs.Add(registry); registry.TypeUpdated += (o, e) => { UpdateField(registry, e); }; }