Example #1
0
        protected void InitExtensions(MoSync.Core core, MoSync.Runtime runtime)
        {
            try
            {
                MoSync.ExtensionsLoader.Load();
            }
            catch (Exception e)
            {
                MoSync.Util.CriticalError("Couldn't load extension: " + e.ToString());
            }

            MoSync.ExtensionModule       extMod     = runtime.GetModule <MoSync.ExtensionModule>();
            System.Reflection.Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
            foreach (System.Reflection.Assembly a in assemblies)
            {
                try
                {
                    foreach (Type t in a.GetTypes())
                    {
                        IExtensionModule extensionGroupInstance = null;
                        if (t.GetInterface("MoSync.IExtensionModule", false) != null)
                        {
                            extensionGroupInstance = Activator.CreateInstance(t) as IExtensionModule;
                            extMod.AddModule(extensionGroupInstance);
                            extensionGroupInstance.Init(core, runtime);
                        }
                    }
                }
                catch { }
            }
        }