protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName == nameof(_view.LocalFilePath)) { try { var docViewController = new DocumentVC(1, "Document", _view.LocalFilePath.Replace("file://", string.Empty)); if (docViewController.View == null) { return; } _nativeView = docViewController.View; SetNativeControl(_nativeView); _view.SetFinished(); } catch { _view.SetError(); } } }
protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName == nameof(_view.LocalFilePath)) { // Open the file with an intent var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var pdfFilePath = Path.Combine(documentsPath, _view.LocalFilePath.Replace("file://", "")); var result = OpenFileWithIntent(pdfFilePath); if (result) { _view.SetFinished(); } else { _view.SetError(); } } }