예제 #1
0
        protected override void OnLaunched(UI.Xaml.LaunchActivatedEventArgs args)
        {
            // Windows running on a different thread will "launch" the app again
            if (Application != null)
            {
                Services.InvokeLifecycleEvents <WindowsLifecycle.OnLaunching>(del => del(this, args));
                Services.InvokeLifecycleEvents <WindowsLifecycle.OnLaunched>(del => del(this, args));
                return;
            }

            var mauiApp = CreateMauiApp();

            var rootContext = new MauiContext(mauiApp.Services);

            var applicationContext = rootContext.MakeApplicationScope(this);

            Services = applicationContext.Services;

            Services.InvokeLifecycleEvents <WindowsLifecycle.OnLaunching>(del => del(this, args));

            Application = Services.GetRequiredService <IApplication>();

            this.SetApplicationHandler(Application, applicationContext);

            this.CreateNativeWindow(Application, args);

            Services.InvokeLifecycleEvents <WindowsLifecycle.OnLaunched>(del => del(this, args));
        }
예제 #2
0
        public override bool WillFinishLaunching(UIApplication application, NSDictionary launchOptions)
        {
            var mauiApp = CreateMauiApp();

            var rootContext = new MauiContext(mauiApp.Services);

            _applicationContext = rootContext.MakeApplicationScope(this);

            Services = _applicationContext.Services;

            Services?.InvokeLifecycleEvents <iOSLifecycle.WillFinishLaunching>(del => del(application, launchOptions));

            return(true);
        }
예제 #3
0
        public override void OnCreate()
        {
            RegisterActivityLifecycleCallbacks(new ActivityLifecycleCallbacks());

            var mauiApp = CreateMauiApp();

            var rootContext = new MauiContext(mauiApp.Services, this);

            var applicationContext = rootContext.MakeApplicationScope(this);

            Services = applicationContext.Services;

            Current.Services?.InvokeLifecycleEvents <AndroidLifecycle.OnApplicationCreating>(del => del(this));

            Application = Services.GetRequiredService <IApplication>();

            this.SetApplicationHandler(Application, applicationContext);

            Current.Services?.InvokeLifecycleEvents <AndroidLifecycle.OnApplicationCreate>(del => del(this));

            base.OnCreate();
        }
예제 #4
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));
        }