void RegionOfInterestChanged (object sender, EventArgs e)
{
var pv = (PreviewView)sender;
CGRect newRegion = pv.RegionOfInterest;
// Update the AVCaptureMetadataOutput with the new region of interest.
sessionQueue.DispatchAsync (() => {
// Translate the preview view's region of interest to the metadata output's coordinate system.
metadataOutput.RectOfInterest = PreviewView.VideoPreviewLayer.MapToMetadataOutputCoordinates (newRegion);
// Ensure we are not drawing old metadata object overlays.
DispatchQueue.MainQueue.DispatchAsync (RemoveMetadataObjectOverlayLayers);
});
}