static Task PlatformOpenAsync(OpenFileRequest request) { var fileUrl = NSUrl.FromFilename(request.File.FullPath); documentController = UIDocumentInteractionController.FromUrl(fileUrl); documentController.Delegate = new DocumentControllerDelegate { DismissHandler = () => { documentController?.Dispose(); documentController = null; } }; documentController.Uti = request.File.ContentType; var vc = Platform.GetCurrentViewController(); CoreGraphics.CGRect?rect = null; if (DeviceInfo.Idiom == DeviceIdiom.Tablet) { rect = new CoreGraphics.CGRect(new CoreGraphics.CGPoint(vc.View.Bounds.Width / 2, vc.View.Bounds.Height), CoreGraphics.CGRect.Empty.Size); } else { rect = vc.View.Bounds; } documentController.PresentOpenInMenu(rect.Value, vc.View, true); return(Task.CompletedTask); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); documentInteractionController.Dispose(); documentInteractionController = null; }