Ejemplo n.º 1
0
        public static void RegisterType(string java_class, Type t)
        {
            string jniFromType = JNIEnv.GetJniName(t);

            lock (TypeManagerMapDictionaries.AccessLock) {
                if (!TypeManagerMapDictionaries.JniToManaged.TryGetValue(java_class, out var lookup))
                {
                    TypeManagerMapDictionaries.JniToManaged.Add(java_class, t);
                    if (String.Compare(jniFromType, java_class, StringComparison.OrdinalIgnoreCase) != 0)
                    {
                        TypeManagerMapDictionaries.ManagedToJni.Add(t, java_class);
                    }
                }
                else if (!JNIEnv.IsRunningOnDesktop || t != typeof(Java.Interop.TypeManager))
                {
                    // skip the registration and output a warning
                    Logger.Log(LogLevel.Warn, "monodroid", string.Format("Type Registration Skipped for {0} to {1} ", java_class, t.ToString()));
                }
            }
        }
Ejemplo n.º 2
0
        public static void RegisterType(string java_class, Type t)
        {
            string jniFromType = JNIEnv.GetJniName(t);

            lock (jniToManaged) {
                Type lookup;
                if (!jniToManaged.TryGetValue(java_class, out lookup))
                {
                    jniToManaged.Add(java_class, t);
                    if (jniFromType != java_class)
                    {
                        managedToJni.Add(t, java_class);
                    }
                }
                else if (!JNIEnv.IsRunningOnDesktop || t != typeof(Java.Interop.TypeManager))
                {
                    // skip the registration and output a warning
                    Logger.Log(LogLevel.Warn, "monodroid", string.Format("Type Registration Skipped for {0} to {1} ", java_class, t.ToString()));
                }
            }
        }