Пример #1
0
        public void EnsureInitialized(Context applicationContext)
        {
            if (MvxSimpleIoCContainer.Instance != null)
            {
                return;
            }

            var ioc = MvxSimpleIoCContainer.Initialise();

            ioc.RegisterSingleton <IMvxPluginManager>(new MvxFilePluginManager(".Droid", ".dll"));

            ioc.RegisterSingleton <IMvxAndroidGlobals>(new AndroidGlobals(applicationContext, GetType().Namespace));

            var topActivity = new AndroidTopActivity();

            ioc.RegisterSingleton <ITopActivity>(topActivity);
            ioc.RegisterSingleton <IMvxMainThreadDispatcher>(topActivity);

            var builder = new MvxAndroidBindingBuilder();

            builder.DoRegistration();

            var viewCache = ioc.Resolve <IMvxTypeCache <View> >();

            viewCache.AddAssembly(typeof(View).Assembly);

            var namespaces = ioc.Resolve <IMvxNamespaceListViewTypeResolver>();

            namespaces.Add("Android.Views");
            namespaces.Add("Android.Widget");
            namespaces.Add("Android.Webkit");
        }
Пример #2
0
        public void EnsureInitialized(Context applicationContext)
        {
            if (MvxSimpleIoCContainer.Instance != null)
            {
                return;
            }

            var ioc = MvxSimpleIoCContainer.Initialize();

            ioc.RegisterSingleton <IMvxTrace>(new MvxDebugOnlyTrace());
            ioc.RegisterSingleton <IMvxPluginManager>(new MvxFilePluginManager(".Droid", ".dll"));

            ioc.RegisterSingleton <IMvxAndroidGlobals>(new AndroidGlobals(applicationContext, GetType().Namespace));

            var topActivity = new AndroidTopActivity();

            ioc.RegisterSingleton <ITopActivity>(topActivity);
            ioc.RegisterSingleton <IMvxMainThreadDispatcher>(topActivity);
        }