Exemple #1
0
        internal void Update()
        {
            if (!needsUpdating)
            {
                return;
            }

            foreach (var r in dom.References)
            {
                var info = infoService.GetProjectInfo(r);
                if (info != null)
                {
                    info.Update();
                }
            }

            objcTypes.Clear();
            cliTypes.Clear();

            foreach (var type in infoService.GetRegisteredObjects(dom))
            {
                objcTypes.Add(type.ObjCName, type);
                cliTypes.Add(type.CliName, type);
            }

            foreach (var type in cliTypes.Values)
            {
                ResolveCliToObjc(type);
            }

            needsUpdating = false;
        }
        internal void Update()
        {
            if (!needsUpdating)
            {
                return;
            }
            foreach (DotNetProject r in dom.ReferencedProjects)
            {
                var info = infoService.GetProjectInfo(r);
                if (info != null)
                {
                    info.Update();
                }
            }
            TypeSystemService.ForceUpdate(dom);
            objcTypes.Clear();
            cliTypes.Clear();
            refObjcTypes.Clear();
            refCliTypes.Clear();

            foreach (var type in infoService.GetRegisteredObjects(dom, dom.Compilation.MainAssembly))
            {
                if (objcTypes.ContainsKey(type.ObjCName))
                {
                    var other = objcTypes[type.ObjCName];
                    throw new ArgumentException(string.Format("Multiple types ({0} and {1}) registered with the same Objective-C name: {2}", type.CliName, other.CliName, type.ObjCName));
                }

                objcTypes.Add(type.ObjCName, type);
                cliTypes.Add(type.CliName, type);
            }

            foreach (var refAssembly in dom.Compilation.ReferencedAssemblies)
            {
                foreach (var type in infoService.GetRegisteredObjects(dom, refAssembly))
                {
                    if (refObjcTypes.ContainsKey(type.ObjCName))
                    {
                        var other = refObjcTypes[type.ObjCName];
                        throw new ArgumentException(string.Format("Multiple types ({0} and {1}) registered with the same Objective-C name: {2}", type.CliName, other.CliName, type.ObjCName));
                    }

                    refObjcTypes.Add(type.ObjCName, type);
                    refCliTypes.Add(type.CliName, type);
                }
            }

            foreach (var type in cliTypes.Values)
            {
                ResolveCliToObjc(type);
            }

            needsUpdating = false;
        }
 bool TryResolveCliToObjc(string cliType, out NSObjectTypeInfo resolved)
 {
     if (cliTypes.TryGetValue(cliType, out resolved))
     {
         return(true);
     }
     foreach (var r in dom.References)
     {
         var rDom = NSObjectInfoService.GetProjectInfo(r);
         if (rDom != null && rDom.cliTypes.TryGetValue(cliType, out resolved))
         {
             return(true);
         }
     }
     resolved = null;
     return(false);
 }