Пример #1
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Couchbase.Lite.Support.iOS.Activate();

            // Setup the application
            Xamarin.Forms.Forms.Init();
            Window = new UIWindow(UIScreen.MainScreen.Bounds);
            var setup = new Setup(this, Window);

            setup.Initialize();

            // Register platform specific implementations
            Mvx.RegisterSingleton <IDevice>(() => AppleDevice.CurrentDevice);
            Mvx.RegisterSingleton <IImageService>(() => new ImageService());

            //Start the application
            var startup = new CoreAppStart();
            var hint    = CoreAppStart.CreateHint();

            startup.Start(hint);

            LoadApplication(setup.FormsApplication);

            Window.MakeKeyAndVisible();

            return(true);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);


            Couchbase.Lite.Support.Droid.Activate(ApplicationContext);

            // Setup the application
            Xamarin.Forms.Forms.Init(this, bundle);
            UserDialogs.Init(this);
            var setup = MvxAndroidSetupSingleton.EnsureSingletonAvailable(ApplicationContext);

            setup.EnsureInitialized();

            // Register platform specific implementations
            Mvx.RegisterSingleton <IDevice>(() => AndroidDevice.CurrentDevice);
            Mvx.RegisterSingleton <IImageService>(() => new ImageService());

            //Start the application
            var startup = new CoreAppStart();
            var hint    = CoreAppStart.CreateHint();

            startup.Start(hint);

            LoadApplication(FormsApplication);
        }
Пример #3
0
        private void DoSetup()
        {
            LoadMvxAssemblyResources();

            var presenter = new MvxWpfViewPresenter(MainWindow);

            var setup = new Setup(Dispatcher, presenter);

            setup.Initialize();

            UserDialogs.Instance = new UserDialogsImpl();
            Mvx.RegisterSingleton <IImageService>(() => new ImageService());
            Mvx.RegisterSingleton <IDevice>(new Device());

            var start = new CoreAppStart();
            var hint  = CoreAppStart.CreateHint();

            start.Start(hint);

            _setupComplete = true;
        }
Пример #4
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    var setup = new Setup(rootFrame);
                    setup.Initialize();

                    Mvx.RegisterSingleton <IDevice>(() => new Device());
                    Mvx.RegisterSingleton <IImageService>(() => new ImageService());

                    var start = new CoreAppStart();
                    var hint  = CoreAppStart.CreateHint();
                    start.Start(hint);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Init Forms and presenter
            Xamarin.Forms.Forms.Init(this, bundle);
            var mvxFormsApp = new MvxFormsApp();

            LoadApplication(mvxFormsApp);
            var presenter = Mvx.Resolve <IMvxViewPresenter>() as MvxFormsDroidPagePresenter;

            presenter.MvxFormsApp = mvxFormsApp;

            // Register platform specific implementations
            UserDialogs.Init(() => (Activity)Xamarin.Forms.Forms.Context);
            Mvx.RegisterSingleton <IDevice>(() => AndroidDevice.CurrentDevice);
            Mvx.RegisterSingleton <IImageService>(() => new ImageService());

            // Start the app
            var appStart = new CoreAppStart();
            var hint     = CoreAppStart.CreateHint();

            appStart.Start(hint);
        }