partial void OpenDocument(NSObject sender)
        {
            var url = DocumentStorageUrl.Append("Untitled.txt", false);

            // TODO: if you do not have a corresponding file provider, you must ensure that the URL returned here is backed by a file
            DismissGrantingAccess(url);
        }
Example #2
0
        partial void OpenDocument(NSObject sender)
        {
            Console.WriteLine("DocumentPickerViewController OpenDocument");
            // DocumentStorageUrl - is read-only property contains the value returned by
            // your File Provider extension’s DocumentStorageURL property.
            // If you do not provide a File Provider extension, it returns null
            var documentURL = DocumentStorageUrl.Append("TextDocument.txt", false);

            Console.WriteLine("documentURL {0}", documentURL);

            // TODO: if you do not have a corresponding file provider, you must ensure that the URL returned here is backed by a file
            DismissGrantingAccess(documentURL);
        }
Example #3
0
        partial void OnExportMoveClicked(NSObject sender)
        {
            Console.WriteLine("DocumentPickerViewController MoveExportClicked");

            // Export/Move Document Picker mode:
            // Before calling DismissGrantingAccess method, copy the file to the selected destination.
            // Your extensions also need to track the file and make sure it is synced to your server (if needed).
            // After the copy is complete, call DismissGrantingAccess method, and provide the URL to the new copy

            NSError error;
            var     destinationUrl = DocumentStorageUrl.Append(OriginalUrl.LastPathComponent, false);

            NSFileManager.DefaultManager.Copy(OriginalUrl.Path, destinationUrl.Path, out error);

            // Provide here a destination Url
            DismissGrantingAccess(destinationUrl);
        }
Example #4
0
        public override void ProvidePlaceholderAtUrl(NSUrl url, Action <NSError> completionHandler)
        {
            Console.WriteLine("FileProvider ProvidePlaceholderAtUrl");

            var fileName    = Path.GetFileName(url.Path);
            var placeholder = NSFileProviderExtension.GetPlaceholderUrl(DocumentStorageUrl.Append(fileName, false));

            // get file size for file at <url> from model
            NSError err = null;

            var metadata = new NSDictionary(NSUrl.FileSizeKey, 0);

            NSFileProviderExtension.WritePlaceholder(placeholder, metadata, ref err);

            if (completionHandler != null)
            {
                completionHandler(null);
            }
        }
        public override void ProvidePlaceholderAtUrl(NSUrl url, Action <NSError> completionHandler)
        {
            var      fileName    = Path.GetFileName(url.Path);
            var      placeholder = NSFileProviderExtension.GetPlaceholderUrl(DocumentStorageUrl.Append(fileName, false));
            NSNumber size        = new NSNumber(0);
            NSError  error;

            // TODO: get file size for file at <url> from model

            FileCoordinator.CoordinateWrite(placeholder, 0, out error, (newUrl) => {
                var metadata = new NSMutableDictionary();
                NSError err  = null;

                metadata.Add(NSUrl.FileSizeKey, size);

                NSFileProviderExtension.WritePlaceholder(placeholder, metadata, ref err);
            });

            if (completionHandler != null)
            {
                completionHandler(null);
            }
        }
        partial void OpenDocument(NSObject sender)
        {
            var url = DocumentStorageUrl.Append("Untitled.txt", false);

            DismissGrantingAccess(url);
        }