Ejemplo n.º 1
0
		public static IMauiContext MakeWindowScope(this IMauiContext mauiContext, NativeWindow platformWindow, out IServiceScope scope)
		{
			scope = mauiContext.Services.CreateScope();

#if __ANDROID__
			var scopedContext = new MauiContext(scope.ServiceProvider, platformWindow);
#else
			var scopedContext = new MauiContext(scope.ServiceProvider);
#endif

			scopedContext.AddWeakSpecific(platformWindow);

#if WINDOWS || __ANDROID__
			scopedContext.AddSpecific(new NavigationRootManager(scopedContext));
#endif

			return scopedContext;
		}
Ejemplo n.º 2
0
        protected override void OnPreCreate()
        {
            base.OnPreCreate();

            Elementary.Initialize();
            Elementary.ThemeOverlay();

            var mauiApp = CreateMauiApp();

            var rootContext = new MauiContext(mauiApp.Services);

            var platformWindow = CoreAppExtensions.GetDefaultWindow();

            platformWindow.Initialize();
            rootContext.AddWeakSpecific(platformWindow);

            _applicationContext = rootContext.MakeApplicationScope(this);

            Services = _applicationContext.Services;

            Current.Services?.InvokeLifecycleEvents <TizenLifecycle.OnPreCreate>(del => del(this));
        }