Ejemplo n.º 1
0
        public void EnsureInit(IMvxAndroidGlobals androidGlobals)
        {
            if (MvxSimpleIoCContainer.Instance != null)
            {
                return;
            }

            MvxSimpleIoCContainer.Initialize();

            Mvx.RegisterSingleton <IMvxTrace>(new MvxDebugTrace());
            MvxTrace.Initialize();

            Mvx.RegisterSingleton <IMvxAndroidGlobals>(androidGlobals);

            new MvxAndroidBindingBuilder().DoRegistration();

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

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

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

            namespaces.Add("Android.Views");
            namespaces.Add("Android.Widget");
            namespaces.Add("Android.Webkit");
        }
Ejemplo n.º 2
0
        public void EnsureInitialized(Context applicationContext)
        {
            if (MvxSimpleIoCContainer.Instance != null)
            {
                return;
            }

            var ioc = MvxSimpleIoCContainer.Initialize();

            ioc.RegisterSingleton <IMvxTrace>(new MvxDebugOnlyTrace());
            MvxTrace.Initialize();

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

            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");
        }
Ejemplo n.º 3
0
        protected virtual void InitializeDebugServices()
        {
            var debugTrace = CreateDebugTrace();

            Mvx.RegisterSingleton <IMvxTrace>(debugTrace);
            MvxTrace.Initialize();
        }
Ejemplo n.º 4
0
 protected virtual void ClearAll()
 {
     // fake set up of the IoC
     MvxSingleton.ClearAllSingletons();
     _ioc = MvxSimpleIoCContainer.Initialise();
     _ioc.RegisterSingleton(_ioc);
     _ioc.RegisterSingleton <IMvxTrace>(new TestTrace());
     MvxTrace.Initialize();
     MvxBindingStatics.ClearCaches();
     AdditionalSetup();
 }
Ejemplo n.º 5
0
        public static void ResetContext()
        {
            MvxSingleton.ClearAllSingletons();
            var ioc = MvxSimpleIoCContainer.Initialize(null);

            ioc.RegisterSingleton(ioc);
            ioc.RegisterSingleton <IMvxTrace>(new UnitTestTrace());
            MvxSingletonCache.Initialize();
            ioc.RegisterSingleton <IMvxSettings>(new MvxSettings());
            MvxTrace.Initialize();
        }
Ejemplo n.º 6
0
 protected virtual void ClearAll()
 {
     // fake set up of the IoC
     MvxSingleton.ClearAllSingletons();
     this._ioc = MvxSimpleIoCContainer.Initialize(this.CreateIocOptions());
     this._ioc.RegisterSingleton(this._ioc);
     this._ioc.RegisterSingleton <IMvxTrace>(new TestTrace());
     InitializeSingletonCache();
     this.InitializeMvxSettings();
     MvxTrace.Initialize();
     this.AdditionalSetup();
 }
        public virtual void Setup()
        {
            // fake set up of the IoC
            MvxSingleton.ClearAllSingletons();
            _ioc = new MvxSimpleIoCServiceProvider();
            var serviceProvider = new MvxServiceProvider(_ioc);

            _ioc.RegisterServiceInstance <IMvxServiceProviderRegistry>(serviceProvider);
            _ioc.RegisterServiceInstance <IMvxServiceProvider>(serviceProvider);
            _ioc.RegisterServiceInstance <IMvxTrace>(new MvxDebugTrace());
            MvxTrace.Initialize();
        }
Ejemplo n.º 8
0
 protected void ClearAll()
 {
     // fake set up of the IoC
     MvxSingleton.ClearAllSingletons();
     _ioc = MvxSimpleIoCContainer.Initialise();
     _ioc.RegisterSingleton(_ioc);
     _ioc.RegisterSingleton <IMvxTrace>(new TestTrace());
     RegisterAdditionalSingletons();
     InitialiseSingletonCache();
     InitialiseMvxSettings();
     MvxTrace.Initialize();
 }
Ejemplo n.º 9
0
        static BaseMvvmCrossTest()
        {
            if (MvxSimpleIoCContainer.Instance == null)
            {
                MvxSingletonCache.Initialize();
                MvxSimpleIoCContainer.Initialize();

                MvxSimpleIoCContainer.Instance.RegisterSingleton(MvxSimpleIoCContainer.Instance);
                MvxSimpleIoCContainer.Instance.RegisterSingleton <IMvxTrace>(new TestTrace());
                MvxSimpleIoCContainer.Instance.RegisterSingleton <IMvxSettings>(new MvxSettings());

                MvxTrace.Initialize();
            }
        }
Ejemplo n.º 10
0
        public void EnsureInit()
        {
            if (MvxSimpleIoCContainer.Instance != null)
            {
                return;
            }

            MvxSimpleIoCContainer.Initialize();

            Mvx.RegisterSingleton <IMvxTrace>(new MvxDebugTrace());
            MvxTrace.Initialize();

            new MvxTouchBindingBuilder().DoRegistration();
        }
Ejemplo n.º 11
0
        static BaseMvvmCrossTests()
        {
            if (MvxSingleton <IMvxIoCProvider> .Instance != null)
            {
                return;
            }

            MvxSingletonCache.Initialize();
            MvxSimpleIoCContainer.Initialize();

            MvxSingleton <IMvxIoCProvider> .Instance.RegisterSingleton <IMvxTrace>(new TestTrace());

            MvxSingleton <IMvxIoCProvider> .Instance.RegisterSingleton <IMvxSettings>(new MvxSettings());

            MvxTrace.Initialize();
        }
Ejemplo n.º 12
0
        protected virtual void ClearAll()
        {
            // fake set up of the IoC
            MvxSingleton.ClearAllSingletons();
            var withInject = new MvxPropertyInjectorOptions()
            {
                InjectIntoProperties          = MvxPropertyInjection.MvxInjectInterfaceProperties,
                ThrowIfPropertyInjectionFails = true
            };
            var options = new MvxIocOptions {
                PropertyInjectorOptions = withInject
            };

            _ioc = MvxSimpleIoCContainer.Initialize(options);
            _ioc.RegisterSingleton(_ioc);
            InitializeTrace();
            InitializeSingletonCache();
            InitializeMvxSettings();
            MvxTrace.Initialize();
            AdditionalSetup();
        }
Ejemplo n.º 13
0
        //public static void Execute()
        //{
        //    Execute(new NullSingletonRegisterer());
        //}

        public static IMvxIoCProvider Execute()
        {
            MvxSingleton.ClearAllSingletons();
            var ioc = MvxSimpleIoCContainer.Initialize();

            var dispatcher = new InlineMockMainThreadDispatcher();

            ioc.RegisterSingleton(dispatcher);
            ioc.RegisterSingleton <IMvxMainThreadDispatcher>(dispatcher);

            // for navigation parsing
            ioc.RegisterSingleton <IMvxStringToTypeParser>(new MvxStringToTypeParser());

            ioc.RegisterSingleton(ioc);
            ioc.RegisterSingleton <IMvxTrace>(new TestTrace());
            //singletonRegisterer.RegisterSingletons(ioc);
            InitialiseSingletonCache();
            InitialiseMvxSettings(ioc);

            MvxTrace.Initialize();

            return(ioc);
        }
Ejemplo n.º 14
0
 protected virtual void InitializeDebugServices()
 {
     MvxTrace.Initialize();
 }