Exemplo n.º 1
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            app.StatusBarStyle = UIStatusBarStyle.LightContent;
            app.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
            LoadApplication(new App());                // method is new in 1.3
            app.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);

            return(base.FinishedLaunching(app, options));
        }
Exemplo n.º 2
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            RectangleF rect = UIScreen.MainScreen.ApplicationFrame;

            window.BackgroundColor = UIColor.Black;

            //Create the OpenGL drawing view and add it to the window
            drawingView = new PaintingView(new RectangleF(rect.Location, rect.Size));
            window.AddSubview(drawingView);

            // Create a segmented control so that the user can choose the brush color.
            UISegmentedControl segmentedControl = new UISegmentedControl(new[] {
                UIImage.FromFile("Images/Red.png"),
                UIImage.FromFile("Images/Yellow.png"),
                UIImage.FromFile("Images/Green.png"),
                UIImage.FromFile("Images/Blue.png"),
                UIImage.FromFile("Images/Purple.png"),
            });

            // Compute a rectangle that is positioned correctly for the segmented control you'll use as a brush color palette
            RectangleF frame = new RectangleF(rect.X + LeftMarginPadding, rect.Height - PaletteHeight - TopMarginPadding,
                                              rect.Width - (LeftMarginPadding + RightMarginPadding), PaletteHeight);

            segmentedControl.Frame = frame;
            // When the user chooses a color, the method changeBrushColor: is called.
            segmentedControl.ValueChanged += ChangeBrushColor;
            segmentedControl.ControlStyle  = UISegmentedControlStyle.Bar;
            // Make sure the color of the color complements the black background
            segmentedControl.TintColor = UIColor.DarkGray;
            // Set the third color (index values start at 0)
            segmentedControl.SelectedSegment = 2;

            // Add the control to the window
            window.AddSubview(segmentedControl);
            // Now that the control is added, you can release it
            // [segmentedControl release];

            float r, g, b;

            // Define a starting color
            HslToRgb(2.0f / PaletteSize, PaintingView.Saturation, PaintingView.Luminosity, out r, out g, out b);
            // Set the color using OpenGL
            GL.Color4(r, g, b, PaintingView.BrushOpacity);


            // Look in the Info.plist file and you'll see the status bar is hidden
            // Set the style to black so it matches the background of the application
            app.SetStatusBarStyle(UIStatusBarStyle.BlackTranslucent, false);
            // Now show the status bar, but animate to the style.
            app.SetStatusBarHidden(false, true);

            //Configure and enable the accelerometer
            UIAccelerometer.SharedAccelerometer.UpdateInterval = 1.0f / AccelerometerFrequency;
            UIAccelerometer.SharedAccelerometer.Acceleration  += OnAccelerated;

            //Show the window
            window.MakeKeyAndVisible();

            return(true);
        }
Exemplo n.º 3
0
 public override bool FinishedLaunching(UIApplication app, NSDictionary options)
 {
     global::Xamarin.Forms.Forms.Init();
     app.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);
     ConfigureInsights();
     LoadApplication(new App());
     return(base.FinishedLaunching(app, options));
 }
Exemplo n.º 4
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.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            app.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);

            UINavigationBar.Appearance.BarTintColor = UIColor.White;

            global::Xamarin.Forms.Forms.Init();
            ImageCircleRenderer.Init();
            CachedImageRenderer.Init();
            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            // Code for starting up the Xamarin Test Cloud Agent
                        #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
                        #endif

            app.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);
            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
Exemplo n.º 6
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.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new ModuloReloaded6.App());

            app.SetStatusBarStyle(UIStatusBarStyle.BlackOpaque, false);
            //UINavigationBar.Appearance.BarTintColor = UIColor.Red; //bar background
            //UINavigationBar.Appearance.TintColor = UIColor.White; //Tint color of button items
            //UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes() {
            //	//Font = UIFont.FromName("HelveticaNeue-Light", (nfloat)20f),
            //	TextColor = UIColor.White
            //});

            return(base.FinishedLaunching(app, options));
        }
Exemplo n.º 7
0
        public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
        {
            ZXing.Net.Mobile.Forms.iOS.Platform.Init();

            XFGloss.iOS.Library.Init();
            XamEffects.iOS.Effects.Init();
            RoundedBoxViewRenderer.Init();
            ProgressRingRenderer.Init();
            Xamarin.FormsMaps.Init();
            Xamarin.FormsGoogleMaps.Init("AIzaSyDnC69vNlEd0nv9-nnI5NDFY2zj6WChPOw");
            Stormlion.PhotoBrowser.iOS.Platform.Init();

            global::Xamarin.Forms.Forms.Init();

            RegisterServiceContainers();

            //Countly initialization
            var config = new CountlyConfig()
            {
                AppKey = Config.CountlyAppKey,
                Host   = Config.CountlyServerURL,
                //EnableDebug = true,
                Features = new NSObject[] { CountlySDK.Constants.CLYCrashReporting }
            };

            Countly.SharedInstance().StartWithConfig(config);
            Countly.SharedInstance().BeginSession();

            LoadApplication(new App());

            uiApplication.SetStatusBarStyle(UIStatusBarStyle.BlackOpaque, false);

            uiApplication.SetMinimumBackgroundFetchInterval(3600);

            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes(
                    UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null
                    );

                uiApplication.RegisterUserNotificationSettings(notificationSettings);
            }

            RegisterRemoteNotifications();

            return(base.FinishedLaunching(uiApplication, launchOptions));
        }
Exemplo n.º 8
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            app.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);

                        #if RELEASE
            ConfigureInsights();
                        #endif

                        #if TEST
            Xamarin.Calabash.Start();
            Console.WriteLine("Calabash component started");
                        #endif

            LoadApplication(new App());
            return(base.FinishedLaunching(app, options));
        }
Exemplo n.º 9
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window           = new UIWindow(UIScreen.MainScreen.Bounds);
            tabBarController = new PBTabBarController();

            var prayers      = new UINavigationController(new PrayersViewController());
            var verses       = new UINavigationController(new VersesViewController());
            var memorization = new UINavigationController(new MemorizationViewController());

            var prayersItem = new UITabBarItem();

            prayersItem.Image = UIImage.FromFile("Images/Tabs/Prayers.png");
            var versesItem = new UITabBarItem();

            versesItem.Image = UIImage.FromFile("Images/Tabs/Verses.png");
            var memorizationItem = new UITabBarItem();

            memorizationItem.Image = UIImage.FromFile("Images/Tabs/Memorization.png");

            verses.TabBarItem       = versesItem;
            prayers.TabBarItem      = prayersItem;
            memorization.TabBarItem = memorizationItem;

            tabBarController.ViewControllers = new UIViewController[] {
                prayers,
                verses,
                memorization
            };
            tabBarController.TabBar.BackgroundImage = Images.TabBarBackground;
            tabBarController.SelectedIndex          = 1;

            ConfigureDatabase();
            ConfigureAppearanceSettings();
            ConfigureThirdPartyLibraries();
            ConfigureiRate();

            window.RootViewController = tabBarController;
            window.MakeKeyAndVisible();

            UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge
                                                                               | UIRemoteNotificationType.Sound);
            app.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);

            return(true);
        }
Exemplo n.º 10
0
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			window = new UIWindow (UIScreen.MainScreen.Bounds);
			if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
				app.SetStatusBarStyle (UIStatusBarStyle.LightContent, false);
				var frame = window.Frame;
				frame.Y = 20;
				window.Frame = frame;
			}

			PinchLayout pinchLayout = new PinchLayout ();
			pinchLayout.ItemSize = new CGSize (100.0f, 100.0f);

			window.RootViewController = (new ViewController (pinchLayout));
			window.MakeKeyAndVisible ();

			return true;
		}
		//public static bool HideStatusBar {get {return false;}}

		//
		// 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.
		//
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			// Applies theme styles globally
			GunmetalTheme.Apply ();

			//UIButton.Appearance.TintColor = UIColor.White;

			var idiom = UIDevice.CurrentDevice.UserInterfaceIdiom;

			if (idiom == UIUserInterfaceIdiom.Pad) 
				InitPad ();
			else 
				ConfigureiPhoneTabBar ();

			app.SetStatusBarStyle (UIStatusBarStyle.LightContent, true);
			UIApplication.SharedApplication.StatusBarHidden = HideStatusBar;
			
			// Override point for customization after application launch.
			return true;
		}
Exemplo n.º 12
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);
            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                app.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);
                var frame = window.Frame;
                frame.Y      = 20;
                window.Frame = frame;
            }

            PinchLayout pinchLayout = new PinchLayout();

            pinchLayout.ItemSize = new SizeF(100.0f, 100.0f);

            window.RootViewController = (new ViewController(pinchLayout));
            window.MakeKeyAndVisible();

            return(true);
        }
Exemplo n.º 13
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Current          = this;
            TabBarController = new PBTabBarController();

            window = new UIWindow(UIScreen.MainScreen.Bounds);

            ConfigureDatabase();
            ConfigureAppearanceSettings();
            ConfigureThirdPartyLibraries();
            ConfigureiRate();

            var verses       = new UINavigationController(new VersesTableViewController());
            var memorization = new UINavigationController(new MemorizationViewController());

            var versesItem = new UITabBarItem {
                Image = UIImage.FromFile(Images.VersesTab)
            };
            var memorizationItem = new UITabBarItem {
                Image = UIImage.FromFile(Images.MemorizationTab)
            };

            verses.TabBarItem       = versesItem;
            memorization.TabBarItem = memorizationItem;

            TabBarController.ViewControllers = new UIViewController[] {
                verses,
                memorization
            };
            TabBarController.TabBar.BackgroundImage = UIImage.FromFile(Images.TabBarBackground);

            window.RootViewController = TabBarController;
            window.MakeKeyAndVisible();

            UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge
                                                                               | UIRemoteNotificationType.Sound);
            app.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);

            return(true);
        }
Exemplo n.º 14
0
        //public static EKEventStore eventStore { get; } = new EKEventStore();
        //
        // 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.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            //BackgroundAggregator.Init(this);
            //FFImageLoading.Forms.Platform.CachedImageRenderer.Init();
            //global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
            Forms.Init();
            FormsMaterial.Init();
            if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
            {
                // Ask the user for permission to get notifications on iOS 10.0+
                UNUserNotificationCenter.Current.RequestAuthorization(
                    UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound,
                    (approved, error) => { Debug.WriteLine($"approved {approved}, error:{error}"); });

                // Watch for notifications while app is active
                UNUserNotificationCenter.Current.Delegate = new UserNotificationCenterDelegate();
            }
            else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                // Ask the user for permission to get notifications on iOS 8.0+
                var settings = UIUserNotificationSettings.GetSettingsForTypes(
                    UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound,
                    new NSSet());

                UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
            }
            CrossMediaManager.Current.Init();
            //this.ShinyFinishedLaunching(new Startup(), services => services.UseNotifications());
            //iOSShinyHost.Init(platformBuild: services => services.UseNotifications());/*new Startup(),*/
            // Ask the user for permission to show notifications on iOS 10.0+ at startup.
            // If not asked at startup, user will be asked when showing the first notification.
            //Plugin.LocalNotification.NotificationCenter.AskPermission();
            LoadApplication(new App());

            DependencyService.Register <IAlarmService, AlarmService>();
            SetAlarms();
            app.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
            return(base.FinishedLaunching(app, options));
        }
Exemplo n.º 15
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.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // Copy the database across (if it doesn't exist)
            var appdir   = NSBundle.MainBundle.ResourcePath;
            var seedFile = Path.Combine(appdir, "Base/DukappDB.db3");

            if (!File.Exists(DukappCore.DAL.DukappRepository.DatabaseFilePath))
            {
                File.Copy(seedFile, DukappCore.DAL.DukappRepository.DatabaseFilePath);
            }
            // create a new window instance based on the screen size
            DukappCore.DAL.DukappRepository.Open();
            RectangleF mrect = UIScreen.MainScreen.Bounds;

            window   = new UIWindow(mrect);
            home_scr = new HomeVC();
            RectangleF rct = home_scr.View.Bounds;
            var        rootNavigationController = new UINavigationController();

            rootNavigationController.NavigationBarHidden    = true;
            rootNavigationController.NavigationBar.BarStyle = UIBarStyle.Black;
            rootNavigationController.PushViewController(home_scr, true);
            window.RootViewController = rootNavigationController;

            app.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
            // window.RootViewController = home_scr;
            // make the window visible
            window.MakeKeyAndVisible();
            PrefsRecord rec = PrefsManager.GetPrefsRecordValue("isDietStarted");

            if (rec.PrefValue == "0")
            {
                welcome_scr = new WelcomeVC(home_scr);
                //rootNavigationController.PushViewController(welcome_scr, true);
                home_scr.PresentViewController(welcome_scr, true, null);
            }
            return(true);
        }
Exemplo n.º 16
0
        private void ApplyStyle(UIApplication application)
        {
            //UIStatusBar
            application.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);

            //UINavigationBar
            UINavigationBar.Appearance.BarTintColor = UIColor.Red;
            UINavigationBar.Appearance.BarStyle     = UIBarStyle.Default;
            UINavigationBar.Appearance.Translucent  = false; //Precisa NavigationBarHidden = true; em cada Tab

            UINavigationBar.Appearance.TintColor = UIColor.White;
            var navigationBarTextAttributes = UINavigationBar.Appearance.GetTitleTextAttributes();

            navigationBarTextAttributes.TextColor = UIColor.White;
            UINavigationBar.Appearance.SetTitleTextAttributes(navigationBarTextAttributes);

            //UITableView
            UITableView.Appearance.BackgroundColor = UIColor.White;
            UITableView.Appearance.SeparatorInset  = UIEdgeInsets.Zero;

            //UITableViewCell
            //UITableViewCell.Appearance.BackgroundColor = UIColor.White;
        }
Exemplo n.º 17
0
        //public static bool HideStatusBar {get {return false;}}

        //
        // 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.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // Applies theme styles globally
            GunmetalTheme.Apply();

            //UIButton.Appearance.TintColor = UIColor.White;

            var idiom = UIDevice.CurrentDevice.UserInterfaceIdiom;

            if (idiom == UIUserInterfaceIdiom.Pad)
            {
                InitPad();
            }
            else
            {
                ConfigureiPhoneTabBar();
            }

            app.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
            UIApplication.SharedApplication.StatusBarHidden = HideStatusBar;

            // Override point for customization after application launch.
            return(true);
        }
Exemplo n.º 18
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Current = this;
            TabBarController = new PBTabBarController ();

            window = new UIWindow (UIScreen.MainScreen.Bounds);

            ConfigureDatabase ();
            ConfigureAppearanceSettings ();
            ConfigureThirdPartyLibraries ();
            ConfigureiRate ();

            var verses = new UINavigationController (new VersesTableViewController ());
            var memorization = new UINavigationController (new MemorizationViewController ());

            var versesItem = new UITabBarItem { Image = UIImage.FromFile (Images.VersesTab) };
            var memorizationItem = new UITabBarItem { Image = UIImage.FromFile (Images.MemorizationTab) };

            verses.TabBarItem = versesItem;
            memorization.TabBarItem = memorizationItem;

            TabBarController.ViewControllers = new UIViewController[] {
                verses,
                memorization
            };
            TabBarController.TabBar.BackgroundImage = UIImage.FromFile (Images.TabBarBackground);

            window.RootViewController = TabBarController;
            window.MakeKeyAndVisible ();

            UIApplication.SharedApplication.RegisterForRemoteNotificationTypes (UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge
                | UIRemoteNotificationType.Sound);
            app.SetStatusBarStyle (UIStatusBarStyle.LightContent, true);

            return true;
        }
Exemplo n.º 19
0
 public override bool FinishedLaunching(UIApplication app, NSDictionary options)
 {
     OnFinishedLaunching(options);
     app.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
     return(base.FinishedLaunching(app, options));
 }
Exemplo n.º 20
0
		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			RectangleF rect = UIScreen.MainScreen.ApplicationFrame;

			window.BackgroundColor = UIColor.Black;

			//Create the OpenGL drawing view and add it to the window
			drawingView = new PaintingView (new RectangleF (rect.Location, rect.Size));
			window.AddSubview (drawingView);

			// Create a segmented control so that the user can choose the brush color.
			var images = new[] {
				UIImage.FromFile ("Images/Red.png"),
				UIImage.FromFile ("Images/Yellow.png"),
				UIImage.FromFile ("Images/Green.png"),
				UIImage.FromFile ("Images/Blue.png"),
				UIImage.FromFile ("Images/Purple.png")
			};
			if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
				// we want the original colors, which is not the default iOS7 behaviour, so we need to
				// replace them with ones having the right UIImageRenderingMode
				for (int i = 0; i < images.Length; i++)
					images [i] = images [i].ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal);
			}
			var segmentedControl = new UISegmentedControl (images);

			// Compute a rectangle that is positioned correctly for the segmented control you'll use as a brush color palette
			var frame = new RectangleF (rect.X + LeftMarginPadding, rect.Height - PaletteHeight - TopMarginPadding,
				rect.Width - (LeftMarginPadding + RightMarginPadding), PaletteHeight);
			segmentedControl.Frame = frame;
			// When the user chooses a color, the method changeBrushColor: is called.
			segmentedControl.ValueChanged += ChangeBrushColor;
			// Make sure the color of the color complements the black background
			segmentedControl.TintColor = UIColor.DarkGray;
			// Set the third color (index values start at 0)
			segmentedControl.SelectedSegment = 2;

			// Add the control to the window
			window.AddSubview (segmentedControl);
			// Now that the control is added, you can release it
			// [segmentedControl release];

			float r, g, b;
			// Define a starting color
			HslToRgb (2.0f / PaletteSize, PaintingView.Saturation, PaintingView.Luminosity, out r, out g, out b);
			// Set the color using OpenGL
			GL.Color4 (r, g, b, PaintingView.BrushOpacity);

			
			// Look in the Info.plist file and you'll see the status bar is hidden
			// Set the style to black so it matches the background of the application
			app.SetStatusBarStyle (UIStatusBarStyle.Default, false);
			// Now show the status bar, but animate to the style.
			app.SetStatusBarHidden (false, true);

			//Configure and enable the accelerometer
			UIAccelerometer.SharedAccelerometer.UpdateInterval = 1.0f / AccelerometerFrequency;
			UIAccelerometer.SharedAccelerometer.Acceleration += OnAccelerated;
			
			//Show the window
			window.MakeKeyAndVisible ();
	
			return true;
		}
Exemplo n.º 21
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            CGRect rect = UIScreen.MainScreen.ApplicationFrame;

            window.BackgroundColor = UIColor.Black;

            //Create the OpenGL drawing view and add it to the window
            drawingView = new PaintingView(new CGRect(rect.Location, rect.Size));
            window.AddSubview(drawingView);

            // Create a segmented control so that the user can choose the brush color.
            var images = new[] {
                UIImage.FromFile("Images/Red.png"),
                UIImage.FromFile("Images/Yellow.png"),
                UIImage.FromFile("Images/Green.png"),
                UIImage.FromFile("Images/Blue.png"),
                UIImage.FromFile("Images/Purple.png")
            };

            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                // we want the original colors, which is not the default iOS7 behaviour, so we need to
                // replace them with ones having the right UIImageRenderingMode
                for (int i = 0; i < images.Length; i++)
                {
                    images [i] = images [i].ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
                }
            }
            var segmentedControl = new UISegmentedControl(images);

            // Compute a rectangle that is positioned correctly for the segmented control you'll use as a brush color palette
            var frame = new CGRect(rect.X + LeftMarginPadding, rect.Height - PaletteHeight - TopMarginPadding,
                                   rect.Width - (LeftMarginPadding + RightMarginPadding), PaletteHeight);

            segmentedControl.Frame = frame;
            // When the user chooses a color, the method changeBrushColor: is called.
            segmentedControl.ValueChanged += ChangeBrushColor;
            // Make sure the color of the color complements the black background
            segmentedControl.TintColor = UIColor.DarkGray;
            // Set the third color (index values start at 0)
            segmentedControl.SelectedSegment = 2;

            // Add the control to the window
            window.AddSubview(segmentedControl);
            // Now that the control is added, you can release it
            // [segmentedControl release];

            float r, g, b;

            // Define a starting color
            HslToRgb(2.0f / PaletteSize, PaintingView.Saturation, PaintingView.Luminosity, out r, out g, out b);
            // Set the color using OpenGL
            GL.Color4(r, g, b, PaintingView.BrushOpacity);

            // Look in the Info.plist file and you'll see the status bar is hidden
            // Set the style to black so it matches the background of the application
            app.SetStatusBarStyle(UIStatusBarStyle.Default, false);
            // Now show the status bar, but animate to the style.
            app.SetStatusBarHidden(false, true);

            //Configure and enable the accelerometer
            UIAccelerometer.SharedAccelerometer.UpdateInterval = 1.0f / AccelerometerFrequency;
            UIAccelerometer.SharedAccelerometer.Acceleration  += OnAccelerated;

            //Show the window
            window.MakeKeyAndVisible();

            return(true);
        }
Exemplo n.º 22
0
		public override void FinishedLaunching (UIApplication app)
		{
			RectangleF rect = UIScreen.MainScreen.ApplicationFrame;

			//Create a full-screen window
			window = new UIWindow (UIScreen.MainScreen.Bounds);
			window.BackgroundColor = UIColor.Black;

			//Create the OpenGL drawing view and add it to the window
			drawingView = new PaintingView (new RectangleF (rect.Location, rect.Size));
			window.AddSubview (drawingView);

			// Create a segmented control so that the user can choose the brush color.
			UISegmentedControl segmentedControl = new UISegmentedControl (new[]{
					UIImage.FromFile ("Red.png"),
					UIImage.FromFile ("Yellow.png"),
					UIImage.FromFile ("Green.png"),
					UIImage.FromFile ("Blue.png"),
					UIImage.FromFile ("Purple.png"),
			});

			// Compute a rectangle that is positioned correctly for the segmented control you'll use as a brush color palette
			RectangleF frame = new RectangleF (rect.X + LeftMarginPadding, rect.Height - PaletteHeight - TopMarginPadding,
				rect.Width - (LeftMarginPadding + RightMarginPadding), PaletteHeight);
			segmentedControl.Frame = frame;
			// When the user chooses a color, the method changeBrushColor: is called.
			segmentedControl.ValueChanged += ChangeBrushColor;
			segmentedControl.ControlStyle = UISegmentedControlStyle.Bar;
			// Make sure the color of the color complements the black background
			segmentedControl.TintColor = UIColor.DarkGray;
			// Set the third color (index values start at 0)
			segmentedControl.SelectedSegment = 2;

			// Add the control to the window
			window.AddSubview (segmentedControl);
			// Now that the control is added, you can release it
			// [segmentedControl release];

			float r, g, b;
			// Define a starting color
			HslToRgb (2.0f / PaletteSize, PaintingView.Saturation, PaintingView.Luminosity, out r, out g, out b);
			// Set the color using OpenGL
			GL.Color4 (r, g, b, PaintingView.BrushOpacity);

			//Show the window
			window.MakeKeyAndVisible ();
			// Look in the Info.plist file and you'll see the status bar is hidden
			// Set the style to black so it matches the background of the application
			app.SetStatusBarStyle (UIStatusBarStyle.BlackTranslucent, false);
			// Now show the status bar, but animate to the style.
			app.SetStatusBarHidden (false, true);

			//Configure and enable the accelerometer
			UIAccelerometer.SharedAccelerometer.UpdateInterval = 1.0f / AccelerometerFrequency;
			UIAccelerometer.SharedAccelerometer.Acceleration += OnAccelerated;
		}
Exemplo n.º 23
0
 // class-level declarations
        public override UIWindow Window
        {
            get;
            set;
        }

        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            App.Initialize();
            var user = NSUserDefaults.StandardUserDefaults;
            if (user.BoolForKey("hasRunBefore") == false)
            {
                KeyChainHelper.DeleteKey("Usuario_Id");
                KeyChainHelper.DeleteKey("Usuario_Tipo");
                KeyChainHelper.DeleteKey("Empresa_Id");
                user.SetBool(true, "hasRunBefore");
                user.Synchronize();
            }

            UIApplication.SharedApplication.StatusBarHidden = false;
            application.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
            UINavigationBar.Appearance.BarTintColor = UIColor.Black;
            UINavigationBar.Appearance.TintColor = UIColor.White;
            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes() { TextColor = UIColor.White });
            UINavigationBar.Appearance.Translucent = false;

            var result = false;

            if (InternetConectionHelper.VerificarConexion())
     {
                MenuHelper.GetListConfiguraciones();
                if (MenuHelper.Configuraciones != null)
                {
                    var configuracionCorreo = MenuHelper.Configuraciones.Find(parametro => parametro.Parametro_Descripcion == "REGEX Y LONGITUD DE CORREO ELECTRONICO DEL USUARIO"); //new ConfigurationsController().GetConfiguraciones("REGEX Y LONGITUD DE CORREO ELECTRONICO DEL USUARIO");
                    var configuracionPassword = MenuHelper.Configuraciones.Find(parametro => parametro.Parametro_Descripcion == "REGEX Y LONGITUD DE CONTRASEÑA DEL USUARIO");//new ConfigurationsController().GetConfiguraciones("REGEX Y LONGITUD DE CONTRASEÑA DEL USUARIO");
                    if ((configuracionCorreo == null || configuracionPassword == null))
                    {
                        Window.RootViewController = UIStoryboard.FromName("Main", null).InstantiateViewController("NoConexion");
                    }
                    else
                    {
                        MenuHelper.UploadImagePath = MenuHelper.Configuraciones.Find(parametro => parametro.Parametro_Descripcion == "RUTA DE IMAGENES DE PUBLICACIONES").Parametro_Varchar_1;
                        MenuHelper.ProfileImagePath = MenuHelper.Configuraciones.Find(parametro => parametro.Parametro_Descripcion == "RUTA DE IMAGENES DE PERFILES DE USUARIOS").Parametro_Varchar_1;
                        result = KeyChainHelper.SetKey("EmailRegex", configuracionCorreo.Parametro_Varchar_1);
                        result = KeyChainHelper.SetKey("LongitudEmail", configuracionCorreo.Parametro_Varchar_2);
                        result = KeyChainHelper.SetKey("PasswordRegex", configuracionPassword.Parametro_Varchar_1);
                        result = KeyChainHelper.SetKey("LongitudPassword", configuracionPassword.Parametro_Varchar_2);
                    }
                    if (!string.IsNullOrEmpty(KeyChainHelper.GetKey("Usuario_Id")) && !string.IsNullOrEmpty(KeyChainHelper.GetKey("Usuario_Tipo")))
                    {
                        MenuHelper.GetUsuarioInfo();
                        Window.RootViewController = UIStoryboard.FromName("Main", null)
                            .InstantiateViewController("NavEscritorio");
                    }
                    else
                    {
                        var controller = UIStoryboard.FromName("Main", null).InstantiateViewController("LoginViewController");
                        controller.Title = "Iniciar Sesión";
                        Window.RootViewController = controller;
                    }
                }
                else
                {
                    Window.RootViewController = UIStoryboard.FromName("Main", null).InstantiateViewController("NoConexion");
                }
     }
     else
     {
                Window.RootViewController = UIStoryboard.FromName("Main", null).InstantiateViewController("NoConexion");
            }
            UIApplication.SharedApplication.RegisterForRemoteNotifications();
            var settings = UIUserNotificationSettings.GetSettingsForTypes(
                UIUserNotificationType.Alert, new NSSet());
            UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
            FirebasePushNotificationManager.Initialize(launchOptions, true);
            UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert, (approved, err) => {
                // Handle approval
            });
            // Get current notification settings
            UNUserNotificationCenter.Current.GetNotificationSettings ((set) => {
                var alertsAllowed = (set.AlertSetting == UNNotificationSetting.Enabled);
            }); 
                // Enable or disable features based on authorization.
            UNUserNotificationCenter.Current.Delegate = new UNUserNotificationCenterDelegate();

            return true;
        }

        public override void OnResignActivation(UIApplication application)
        {
            // Invoked when the application is about to move from active to inactive state.
            // This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) 
            // or when the user quits the application and it begins the transition to the background state.
            // Games should use this method to pause the game.
        }


        public override void WillEnterForeground(UIApplication application)
        {
            // Called as part of the transiton from background to active state.
            // Here you can undo many of the changes made on entering the background.
        }


        public override void WillTerminate(UIApplication application)
        {
            // Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
        }

        public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            FirebasePushNotificationManager.DidRegisterRemoteNotifications(deviceToken);
        }


        public override void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error)
        {
            FirebasePushNotificationManager.RemoteNotificationRegistrationFailed(error);


        }
        // To receive notifications in foregroung on iOS 9 and below.
        // To receive notifications in background in any iOS version
        public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
        {
Exemplo n.º 24
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            Profile.EnableUpdatesOnAccessTokenChange(true);


            application.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);

            Settings.AppID       = SocialConstants.fbClientId;
            Settings.DisplayName = SocialConstants.appName;


            DBInitializer.CreateDatabase();

            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            if (CommonHelper.IsUserLoggedIn())
            {
                //Window = new UIWindow(UIScreen.MainScreen.Bounds);

                //// If you have defined a root view controller, set it here:
                //Window.RootViewController = new RootViewController();

                //// make the window visible
                //Window.MakeKeyAndVisible();
                GlobalConstant.AccessToken = CommonHelper.GetAccessToken();
                var tabBarController = GetViewController(MainStoryboard, "RootViewController");
                SetRootViewController(tabBarController, false);
            }
            else
            {
                //User needs to log in, so show the Login View Controlller
                var loginViewController = GetViewController(MainStoryboard, "LoginInpowerViewController") as LoginInpowerViewController;
                loginViewController.OnLoginSuccess += LoginViewController_OnLoginSuccess;
                SetRootViewController(loginViewController, false);
            }
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method


            AppCenter.Start("890484fd-ac71-4775-9baf-fbe55397bbc6", typeof(Analytics), typeof(Crashes));

            App.Configure();



            // Register your app for remote notifications.
            if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                // For iOS 10 display notification (sent via APNS)
                UNUserNotificationCenter.Current.Delegate = this;

                var authOptions = UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound;
                UNUserNotificationCenter.Current.RequestAuthorization(authOptions, (granted, error) => {
                    Console.WriteLine(granted);
                });
            }
            else
            {
                //// iOS 9 or before
                //var allNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound;
                //var settings = UIUserNotificationSettings.GetSettingsForTypes(allNotificationTypes, null);
                //UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
            }
            // iOS 9 or before
            var allNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound;
            var settings             = UIUserNotificationSettings.GetSettingsForTypes(allNotificationTypes, null);

            UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
            UIApplication.SharedApplication.RegisterForRemoteNotifications();

            Messaging.SharedInstance.Delegate = this;

            // To connect with FCM. FCM manages the connection, closing it
            // when your app goes into the background and reopening it
            // whenever the app is foregrounded.
            Messaging.SharedInstance.ShouldEstablishDirectChannel = true;


            var token = Messaging.SharedInstance.FcmToken;

            UIApplication.SharedApplication.ApplicationIconBadgeNumber = -1;
            count_notofication = 0;
            return(true);
        }