예제 #1
0
 bool RegisterFieldtypeRegistry(IFieldTypeRegistry fieldtypeRegistry)
 {
     foreach (var ctr in FContainerRegs)
     {
         if (ctr.ContainerType == fieldtypeRegistry.ContainerType)
         {
             fieldtypeRegistry.ContainerRegistry = ctr;
             FDeclarationFactory.AddFieldTypeRegistry(fieldtypeRegistry);
             return(true);
         }
     }
     return(false);
 }
예제 #2
0
        //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();
                    }
                }
            }
        }
예제 #3
0
        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();
                    }
                }
            }
        }
예제 #4
0
 public void AddFieldTypeRegistry(IFieldTypeRegistry registry)
 {
     FFieldTypeRegs.Add(registry);
     registry.TypeUpdated += (o, e) => { UpdateField(registry, e); };
 }