コード例 #1
0
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			#if DEBUG
			Xamarin.Calabash.Start();
			#endif


			// create our window
			window = new UIWindow (UIScreen.MainScreen.Bounds);
			window.MakeKeyAndVisible ();

			home = new Screens.iPhone.Home.Home_iPhone();
			home.View.Frame = new CoreGraphics.CGRect (0, UIApplication.SharedApplication.StatusBarFrame.Height, UIScreen.MainScreen.ApplicationFrame.Width, UIScreen.MainScreen.ApplicationFrame.Height);
			window.RootViewController = home;

			// check for a notification
			if(options != null) {

				// check for a local notification
				if(options.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey)) {

					UILocalNotification localNotification = options[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification;
					if(localNotification != null) {

						new UIAlertView(localNotification.AlertAction, localNotification.AlertBody, null, "OK", null).Show();
						// reset our badge
						UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
					}
				}

				// check for a remote notification
				if(options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey)) {

					NSDictionary remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
					if(remoteNotification != null) {
						//new UIAlertView(remoteNotification.AlertAction, remoteNotification.AlertBody, null, "OK", null).Show();
					}
				}
			}

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

				app.RegisterUserNotificationSettings (notificationSettings);
				app.RegisterForRemoteNotifications ();
			} else {
				//==== register for remote notifications and get the device token
				// set what kind of notification types we want
				UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge;
				// register for remote notifications
				UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
			}

			return true;
		}
コード例 #2
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create our window
            window = new UIWindow(UIScreen.MainScreen.Bounds);
            window.MakeKeyAndVisible();

            home                      = new Screens.iPhone.Home.Home_iPhone();
            home.View.Frame           = new CoreGraphics.CGRect(0, UIApplication.SharedApplication.StatusBarFrame.Height, UIScreen.MainScreen.ApplicationFrame.Width, UIScreen.MainScreen.ApplicationFrame.Height);
            window.RootViewController = home;

            // check for a notification
            if (options != null)
            {
                // check for a local notification
                if (options.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey))
                {
                    UILocalNotification localNotification = options[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification;
                    if (localNotification != null)
                    {
                        new UIAlertView(localNotification.AlertAction, localNotification.AlertBody, null, "OK", null).Show();
                        // reset our badge
                        UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
                    }
                }

                // check for a remote notification
                if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
                {
                    NSDictionary remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
                    if (remoteNotification != null)
                    {
                        //new UIAlertView(remoteNotification.AlertAction, remoteNotification.AlertBody, null, "OK", null).Show();
                    }
                }
            }

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

                app.RegisterUserNotificationSettings(notificationSettings);
                app.RegisterForRemoteNotifications();
            }
            else
            {
                //==== register for remote notifications and get the device token
                // set what kind of notification types we want
                UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge;
                // register for remote notifications
                UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
            }

            return(true);
        }
        //========================================================================

        //========================================================================
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            //---- create our window
            this._window = new UIWindow(UIScreen.MainScreen.Bounds);
            this._window.MakeKeyAndVisible();

            this._home            = new Screens.iPhone.Home.Home_iPhone();
            this._home.View.Frame = new System.Drawing.RectangleF(0, UIApplication.SharedApplication.StatusBarFrame.Height, UIScreen.MainScreen.ApplicationFrame.Width, UIScreen.MainScreen.ApplicationFrame.Height);
            this._window.AddSubview(this._home.View);

            //---- check for a local notification
            if (options != null)
            {
                if (options.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey))
                {
                    UILocalNotification localNotification = options[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification;
                    if (localNotification != null)
                    {
                        new UIAlertView(localNotification.AlertAction, localNotification.AlertBody, null, "OK", null).Show();
                        //---- reset our badge
                        UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
                    }
                }

                //---- check for a remote notification
                if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
                {
                    NSDictionary remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
                    if (remoteNotification != null)
                    {
                        //new UIAlertView(remoteNotification.AlertAction, remoteNotification.AlertBody, null, "OK", null).Show();
                    }
                }
            }

            //==== register for remote notifications and get the device token
            //---- set what kind of notification types we want
            UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge;

            //---- register for remote notifications
            UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);

            //----
            return(true);
        }
コード例 #4
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create our window
            window = new UIWindow (UIScreen.MainScreen.Bounds);
            window.MakeKeyAndVisible ();

            home = new Screens.iPhone.Home.Home_iPhone ();
            home.View.Frame = new System.Drawing.RectangleF (0, UIApplication.SharedApplication.StatusBarFrame.Height, UIScreen.MainScreen.ApplicationFrame.Width, UIScreen.MainScreen.ApplicationFrame.Height);
            window.RootViewController = home;

            // check for a notification
            if (options != null) {

                // check for a local notification
                if (options.ContainsKey (UIApplication.LaunchOptionsLocalNotificationKey)) {

                    UILocalNotification localNotification = options [UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification;
                    if (localNotification != null) {

                        new UIAlertView (localNotification.AlertAction, localNotification.AlertBody, null, "OK", null).Show ();
                        // reset our badge
                        UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
                    }
                }

                // check for a remote notification
                if (options.ContainsKey (UIApplication.LaunchOptionsRemoteNotificationKey)) {

                    NSDictionary remoteNotification = options [UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
                    if (remoteNotification != null) {
                        //new UIAlertView(remoteNotification.AlertAction, remoteNotification.AlertBody, null, "OK", null).Show();
                    }
                }
            }

            //==== register for remote notifications and get the device token
            // set what kind of notification types we want
            UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge;
            // register for remote notifications
            UIApplication.SharedApplication.RegisterForRemoteNotificationTypes (notificationTypes);

            //
            return true;
        }