Пример #1
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            if (inProgress)
            {
                return;
            }

            CLBeacon       beacon = beacons [GetNonEmptySection(indexPath.Section)] [indexPath.Row];
            CLBeaconRegion region = Helpers.CreateRegion(beacon.ProximityUuid, beacon.Major, beacon.Minor);

            if (region == null)
            {
                return;
            }

            // We can stop ranging to display beacons available for calibration.
            StopRangingAllRegions();
            // And we'll start the calibration process.
            calculator = new CalibrationCalculator(region, CompletionHandler);
            calculator.PerformCalibration((sender, e) => {
                progressBar.SetProgress(e.PercentComplete, true);
            });

            progressBar.Progress = 0.0f;
            inProgress           = true;
            TableView.ReloadData();
        }
Пример #2
0
        void CompletionHandler(object sender, CalibrationCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                if (View.Window != null)
                {
                    var message = e.Error.UserInfo [NSError.LocalizedDescriptionKey].ToString();
                    new UIAlertView("Unable to calibrate device", message, null, "OK", null).Show();
                    StartRangingAllRegions();
                }
            }
            else
            {
                endViewController = new CalibrationEndViewController(e.MeasurePower);
                NavigationController.PushViewController(endViewController, true);
            }

            inProgress = false;
            calculator = null;
            TableView.ReloadData();
        }
		void CompletionHandler (object sender, CalibrationCompletedEventArgs e)
		{
			if (e.Error != null) {
				if (View.Window != null) {
					var message = e.Error.UserInfo [NSError.LocalizedDescriptionKey].ToString ();
					new UIAlertView ("Unable to calibrate device", message, null, "OK", null).Show ();
					StartRangingAllRegions ();		
				}
			} else {
				endViewController = new CalibrationEndViewController (e.MeasurePower);
				NavigationController.PushViewController (endViewController, true);
			}

			inProgress = false;
			calculator = null;
			TableView.ReloadData ();
		}
		public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
		{
			if (inProgress)
				return;

			CLBeacon beacon = beacons [GetNonEmptySection (indexPath.Section)] [indexPath.Row];
			CLBeaconRegion region = Helpers.CreateRegion (beacon.ProximityUuid, beacon.Major, beacon.Minor);
			if (region == null)
				return;

			// We can stop ranging to display beacons available for calibration.
			StopRangingAllRegions ();
			// And we'll start the calibration process.
			calculator = new CalibrationCalculator (region, CompletionHandler);
			calculator.PerformCalibration ((sender,e) => {
				progressBar.SetProgress (e.PercentComplete, true);
			});

			progressBar.Progress = 0.0f;
			inProgress = true;
			TableView.ReloadData ();
		}