// In the status dictionary: // "FoundBarcodes" key is a NSSet of all discovered barcodes this scan session // "NewFoundBarcodes" is a NSSet of barcodes discovered in the most recent pass. // When a barcode is found, it is added to both sets. The NewFoundBarcodes // set is cleaned out each pass. // "Guidance" can be used to help guide the user through the process of discovering // a long barcode in sections. Currently only works for Code 39. // "Valid" is TRUE once there are valid barcode results. // "InRange" is TRUE if there's currently a barcode detected the viewfinder. The barcode // may not have been decoded yet. public override void StatusUpdated(BarcodePickerController picker, NSDictionary status) { NSNumber isValid = (NSNumber)status.ObjectForKey(new NSString("Valid")); NSNumber inRange = (NSNumber)status.ObjectForKey(new NSString("InRange")); SetArrows(inRange.BoolValue, true); if (isValid.BoolValue) { BeepOrVibrate(); ParentPicker.DoneScanning(); } NSNumber guidanceLevel = (NSNumber)status.ObjectForKey(new NSString("Guidance")); if (guidanceLevel != null) { if (guidanceLevel.IntValue == 1) { textCue.Text = "Try moving the camera close to each part of the barcode"; } else if (guidanceLevel.IntValue == 2) { textCue.Text = (NSString)status.ObjectForKey(new NSString("PartialBarcode")); } else { textCue.Text = ""; } } }
void setLandscapeLayout() { // Set landscape ParentPicker.Orientation = UIImageOrientation.Right; // Set the active scanning region for portrait mode ParentPicker.ActiveRegion = new RectangleF(100, 0, 120, 436); // Activate the new settings ParentPicker.ResumeScanning(); // Animate the UI changes CGAffineTransform transform = CGAffineTransform.MakeRotation(3.14159f / 2.0f); //this.View.Transform = transform; UIView.BeginAnimations("rotateToLandscape"); //UIView.SetAnimationDelegate = this; UIView.SetAnimationCurve(UIViewAnimationCurve.Linear); UIView.SetAnimationDuration(0.5f); redlaserLogo.Transform = transform; setActiveRegionRect(); UIView.CommitAnimations(); // Animate! }
partial void cancelPressed(MonoTouch.UIKit.UIBarButtonItem sender) { if (ParentPicker != null) { // Tell the picker we're done ParentPicker.DoneScanning(); } }