/// <summary> /// Creates the new document. /// </summary> public void CreateNewDocument() { // Create path to new file // var docsFolder = Environment.GetFolderPath (Environment.SpecialFolder.Personal); var docsFolder = Path.Combine(iCloudUrl.Path, "Documents"); var docPath = Path.Combine(docsFolder, TestFilename); var ubiq = new NSUrl(docPath, false); // Create new document at path Console.WriteLine("Creating Document at:" + ubiq.AbsoluteString); Document = new GenericTextDocument(ubiq); // Set the default value Document.Contents = "(default value)"; // Save document to path Document.Save(Document.FileUrl, UIDocumentSaveOperation.ForCreating, (saveSuccess) => { Console.WriteLine("Save completion:" + saveSuccess); if (saveSuccess) { Console.WriteLine("Document Saved"); } else { Console.WriteLine("Unable to Save Document"); } }); // Inform caller RaiseDocumentLoaded(Document); }
/// <summary> /// Raises the document loaded event. /// </summary> /// <param name="document">Document.</param> internal void RaiseDocumentLoaded(GenericTextDocument document) { // Inform caller if (this.DocumentLoaded != null) { this.DocumentLoaded(document); } }
/// <summary> /// Opens the document. /// </summary> /// <param name="url">URL.</param> public void OpenDocument(NSUrl url) { Console.WriteLine("Attempting to open: {0}", url); Document = new GenericTextDocument(url); // Open the document Document.Open((success) => { if (success) { Console.WriteLine("Document Opened"); } else { Console.WriteLine("Failed to Open Document"); } }); // Inform caller RaiseDocumentLoaded(Document); }
/// <summary> /// Raises the document modified event. /// </summary> internal void RaiseDocumentModified(GenericTextDocument document) { // Inform caller if (this.DocumentModified != null) { this.DocumentModified (document); } }
/// <summary> /// Creates the new document. /// </summary> public void CreateNewDocument() { // Create path to new file // var docsFolder = Environment.GetFolderPath (Environment.SpecialFolder.Personal); var docsFolder = Path.Combine(iCloudUrl.Path, "Documents"); var docPath = Path.Combine (docsFolder, TestFilename); var ubiq = new NSUrl (docPath, false); // Create new document at path Console.WriteLine ("Creating Document at:" + ubiq.AbsoluteString); Document = new GenericTextDocument (ubiq); // Set the default value Document.Contents = "(default value)"; // Save document to path Document.Save (Document.FileUrl, UIDocumentSaveOperation.ForCreating, (saveSuccess) => { Console.WriteLine ("Save completion:" + saveSuccess); if (saveSuccess) { Console.WriteLine ("Document Saved"); } else { Console.WriteLine ("Unable to Save Document"); } }); // Inform caller RaiseDocumentLoaded (Document); }
/// <summary> /// Opens the document. /// </summary> /// <param name="url">URL.</param> public void OpenDocument(NSUrl url) { Console.WriteLine ("Attempting to open: {0}", url); Document = new GenericTextDocument (url); // Open the document Document.Open ( (success) => { if (success) { Console.WriteLine ("Document Opened"); } else Console.WriteLine ("Failed to Open Document"); }); // Inform caller RaiseDocumentLoaded (Document); }