public override NSDictionary GetFileAttributesToWrite(NSUrl forUrl, UIDocumentSaveOperation saveOperation, out NSError outError) { try { var imageScale = (nfloat)1.0; var size = new SizeF(1024, 1024); UIGraphics.BeginImageContextWithOptions(new CoreGraphics.CGSize(size.Width, size.Height), true, imageScale); var c = UIGraphics.GetCurrentContext(); var g = new Graphics.CoreGraphicsGraphics(c, true); DocumentAppDelegate.Shared.App.DrawThumbnail(this, g, size, DocumentAppDelegate.Shared.Theme, readOnlyDoc: true); var image = UIGraphics.GetImageFromCurrentImageContext(); UIGraphics.EndImageContext(); outError = null; var images = NSDictionary.FromObjectsAndKeys( new NSObject[] { image }, new NSObject[] { new NSString("NSThumbnail1024x1024SizeKey") }); return(NSDictionary.FromObjectsAndKeys( new NSObject[] { NSNumber.FromBoolean(true), images }, new NSObject[] { NSUrl.HasHiddenExtensionKey, NSUrl.ThumbnailDictionaryKey })); } catch (Exception ex) { Log.Error(ex); return(base.GetFileAttributesToWrite(forUrl, saveOperation, out outError)); } }
public override bool WriteContents(NSObject contents, NSUrl toUrl, UIDocumentSaveOperation saveOperation, NSUrl originalContentsURL, out NSError outError) { if (contents != null) { Console.WriteLine("IN WRITE CONTENTS"); return(base.WriteContents(contents, toUrl, saveOperation, originalContentsURL, out outError)); } outError = new NSError(new NSString("CONTENTS NULL"), 999); return(false); }
public virtual bool WriteContents(AnyObject contents, NSURL toURL, UIDocumentSaveOperation forSaveOperation, [Optional] NSURL originalContentsURL, NSErrorPointer error) { return(default(bool)); }
public virtual bool WriteContents(AnyObject contents, Dictionary <NSObject, AnyObject> andAttributes, NSURL safelyToURL, UIDocumentSaveOperation forSaveOperation, NSErrorPointer error) { return(default(bool)); }
public virtual void SaveToURL(NSURL url, UIDocumentSaveOperation forSaveOperation, Action <bool> completionHandler) { }
public virtual void UpdateChangeCountWithToken(AnyObject changeCountToken, UIDocumentSaveOperation forSaveOperation) { }
public virtual AnyObject ChangeCountTokenForSaveOperation(UIDocumentSaveOperation saveOperation) { return(default(AnyObject)); }
public virtual string FileNameExtensionForType(string typeName, UIDocumentSaveOperation saveOperation) { return(default(string)); }
public virtual Dictionary <NSObject, AnyObject> FileAttributesToWriteToURL(NSURL url, UIDocumentSaveOperation forSaveOperation, NSErrorPointer error) { return(default(Dictionary <NSObject, AnyObject>)); }