示例#1
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        // @todo Check for camera availability and set in GlobalStatusSingleton
        public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
        {
            this.uiApplication = uiApplication;
            Forms.Init();
            CarouselViewRenderer.Init();
            //var cv = typeof(Xamarin.Forms.CarouselView);
            //var assembly = Assembly.Load(cv.FullName);

            Debug.WriteLine("DHB:AppDelegate:FinishedLaunching pre imgPath.");
            GlobalStatusSingleton.imgPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            Debug.WriteLine("DHB:AppDelegate:FinishedLaunching imgPath=" + GlobalStatusSingleton.imgPath);

            LoadApplication(new App());

            if ((!Xamarin.Forms.Application.Current.Properties.ContainsKey(App.PROPERTY_UUID)) ||
                (Xamarin.Forms.Application.Current.Properties[App.PROPERTY_UUID].Equals("")))
            {
                NSUuid generator = new NSUuid();
                generator.Init();
                GlobalStatusSingleton.UUID = generator.ToString();
                // this gives the device id.
                //UIKit.UIDevice.CurrentDevice.IdentifierForVendor.AsString();
            }
            Debug.WriteLine("DHB:AppDelegate:FinishedLaunching guid set to:" + GlobalStatusSingleton.UUID);

            //notificationTest();
            notify.RequestAuthorization();

            fbLogin.Init();
            FacebookLogin_iOS.uiApplication = uiApplication;
            CameraServices_iOS myCamera = new CameraServices_iOS();

            ((ICamera)(((IExposeCamera)(Xamarin.Forms.Application.Current as App).MainPage).getCamera())).ShouldTakePicture += () => {
                Debug.WriteLine("pre launch");
                uiApplication.KeyWindow.RootViewController.PresentViewController(myCamera, true, null);
                Debug.WriteLine("present called already");
            };

            //< FinishedPickingMedia
            myCamera.FinishedPickingMedia += OnCameraFinished;

            //> FinishedPickingMedia

            //< Canceled
            // i don't have a cancel button...
            //imagePicker.Canceled += (sender, e) => uiApplication.KeyWindow.RootViewController.DismissViewController(true, null);
            //> Canceled

            return(base.FinishedLaunching(uiApplication, launchOptions));
        }