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));
            }
        }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 public virtual bool WriteContents(AnyObject contents, NSURL toURL, UIDocumentSaveOperation forSaveOperation, [Optional] NSURL originalContentsURL, NSErrorPointer error)
 {
     return(default(bool));
 }
Esempio n. 4
0
 public virtual bool WriteContents(AnyObject contents, Dictionary <NSObject, AnyObject> andAttributes, NSURL safelyToURL, UIDocumentSaveOperation forSaveOperation, NSErrorPointer error)
 {
     return(default(bool));
 }
Esempio n. 5
0
 public virtual void SaveToURL(NSURL url, UIDocumentSaveOperation forSaveOperation, Action <bool> completionHandler)
 {
 }
Esempio n. 6
0
 public virtual void UpdateChangeCountWithToken(AnyObject changeCountToken, UIDocumentSaveOperation forSaveOperation)
 {
 }
Esempio n. 7
0
 public virtual AnyObject ChangeCountTokenForSaveOperation(UIDocumentSaveOperation saveOperation)
 {
     return(default(AnyObject));
 }
Esempio n. 8
0
 public virtual string FileNameExtensionForType(string typeName, UIDocumentSaveOperation saveOperation)
 {
     return(default(string));
 }
Esempio n. 9
0
 public virtual Dictionary <NSObject, AnyObject> FileAttributesToWriteToURL(NSURL url, UIDocumentSaveOperation forSaveOperation, NSErrorPointer error)
 {
     return(default(Dictionary <NSObject, AnyObject>));
 }