/// <summary> /// Plays the streaming fullscreen movie. /// </summary> /// <param name="url">URL.</param> /// <param name="autoPlay">If set to <c>true</c> auto play.</param> /// <param name="style">Style.</param> public static void PlayStreamingFullscreenMovie(string url, bool autoPlay = true, MPMovieControlStyle style=MPMovieControlStyle.Fullscreen) { contentURL = new NSURL(url); if (_playerVC == null) { _playerVC = new MPMoviePlayerViewController(); _playerVC.moviePlayer.movieSourceType = MPMovieSourceType.Streaming; _playerVC.moviePlayer.contentURL = contentURL; // _playerVC.moviePlayer.SetFullscreen(true, false); _playerVC.moviePlayer.shouldAutoplay = autoPlay; _playerVC.moviePlayer.controlStyle = style; _playerVC.moviePlayer.LoadStateDidChange += _defaultMoviePlayerNotificationHandler; _playerVC.moviePlayer.DidExitFullscreen += _defaultMoviePlayerExitFullscreen; _playerVC.moviePlayer.PlaybackDidFinish += _defaultMoviePlayerFinishHandler; _playerVC.moviePlayer.PrepareToPlay(); } else { _playerVC.moviePlayer.contentURL = contentURL; _playerVC.moviePlayer.PrepareToPlay(); } // UIApplication.deviceRootViewController.AddChildViewController(_playerVC); UIApplication.deviceRootViewController.PresentViewController(_playerVC, false, null); }
// Create a new image from a file at the given url // Returns null if unsuccessful. public static ImageInfo IICreateImage(NSURL url) { ImageInfo ii = new ImageInfo(); // Try to create an image source to the image passed to us IntPtr imageSrc = CGImageSource.CreateWithURL(url, null); if (imageSrc != IntPtr.Zero) { // And if we can, try to obtain the first image available IntPtr image = CGImageSource.CreateImageAtIndex(imageSrc, 0, null); if (image != IntPtr.Zero) { // and if we could, create the ImageInfo struct with default values ii.fRotation = 0.0f; ii.fScaleX = 1.0f; ii.fScaleY = 1.0f; ii.fTranslateX = 0.0f; ii.fTranslateY = 0.0f; // the ImageInfo struct owns this CGImageRef now, so no need for a retain. ii.fImageRef = image; // the ImageInfo struct owns this CFDictionaryRef, so no need for a retain. ii.fProperties = CGImageSource.CopyPropertiesAtIndex(imageSrc, 0, null); // Setup the orientation transformation matrix so that the image will display with the proper orientation IIGetOrientationTransform(ref ii); } // cleanup the image source CFType.CFRelease(imageSrc); } return ii; }
public NSObject openDocumentWithContentsOfURL_display_error(NSURL absoluteURL, bool displayDocument, IntPtr outError) { NSObject result = null; string path = absoluteURL.path().ToString(); if (System.IO.Directory.Exists(path)) { try { Boss boss = ObjectModel.Create("DirectoryEditorPlugin"); var open = boss.Get<IOpen>(); result = open.Open(path).To<NSObject>(); } catch (Exception e) { NSMutableDictionary userInfo = NSMutableDictionary.Create(); userInfo.setObject_forKey(NSString.Create("Couldn't open '{0}", path), Externs.NSLocalizedDescriptionKey); userInfo.setObject_forKey(NSString.Create(e.Message), Externs.NSLocalizedFailureReasonErrorKey); NSObject error = NSError.errorWithDomain_code_userInfo(Externs.Cocoa3Domain, 2, userInfo); Marshal.WriteIntPtr(outError, error); } } else { result = SuperCall(NSDocumentController.Class, "openDocumentWithContentsOfURL:display:error:", absoluteURL, displayDocument, outError).To<NSDocument>(); } return result; }
public void setURL(string url) { lock(_webview){ _url = new NSURL(url); _request = new NSURLRequest( _url ); _webview.LoadRequest(_request); } }
void OnDestroy() { // load a blank page before removing it _webview.StopLoading(); _webview.LoadHTMLString("", new NSURL("")); _webview.RemoveFromSuperview(); // _webview.hidden = true; _webview = null; _request = null; _url = null; }
private MediaResult CreateResult(PickerOperation operation, NSDictionary <NSString, iOSObjectProxy> info) { if (info == null) { return(null); } switch (Operation) { case PickerOperation.PickGallery: // User can either pick an image or a video NSURL pickedURL = null; if (TryGetUrl(info, UIImagePickerController.UIImagePickerControllerImageURL, out pickedURL)) { return(new MediaResult(MediaType.Image, null, pickedURL.AbsoluteString.UTF8String)); } else if (TryGetUrl(info, UIImagePickerController.UIImagePickerControllerMediaURL, out pickedURL)) { return(new MediaResult(MediaType.Video, null, pickedURL.AbsoluteString.UTF8String)); } else { return(null); } case PickerOperation.TakePicture: // Get the newly taken image, save it into the into user temporary folder and return the URL. // The image name will be "IMG_" + timestamp and format is JPG. UIImage picture = (UIImage)info.ValueForKey(UIImagePickerController.UIImagePickerControllerOriginalImage, ptr => PInvokeUtil.IsNull(ptr) ? null : new UIImage(ptr)); if (picture == null) { Debug.LogError("Couldn't get the taken picture."); return(null); } // Save the image into user temporary folder and return the URL. NSString tempDir = NSFileManager.NSTemporaryDirectory(); if (tempDir == null) { Debug.LogError("Couldn't find the path of user's temporary directory."); return(null); } // The image name is "IMG_" + timestamp and format is JPG. NSString pictureName = NSString.StringWithUTF8String("IMG_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".jpg"); NSURL pictureURL = NSURL.FileURLWithPath(tempDir).URLByAppendingPathComponent(pictureName); if (pictureURL != null) { NSData imageData = UIFunctions.UIImageJPEGRepresentation(picture, 1f); NSFileManager.DefaultManager.CreateFileAtPath(pictureURL.Path, imageData, null); return(new MediaResult(MediaType.Image, null, pictureURL.AbsoluteString.UTF8String)); } else { return(null); } case PickerOperation.RecordVideo: NSURL videoURL = null; if (TryGetUrl(info, UIImagePickerController.UIImagePickerControllerMediaURL, out videoURL)) { return(new MediaResult(MediaType.Video, null, videoURL.AbsoluteString.UTF8String)); } else { return(null); } default: return(null); } }
public NSArray TableViewNamesOfPromisedFilesDroppedAtDestinationForDraggedRowsWithIndexes(NSTableView aTableView, NSURL dropDestination, NSIndexSet indexSet) { throw new NotImplementedException (); }
public virtual void AwakeFromNib() { this.SelectedFinderItem = null; }
public virtual void DismissGrantingAccessToURL([Unwrapped] NSURL url) { }
public void captureOutputDidFinishRecordingToOutputFileAtURLForConnectionsDueToError(QTCaptureFileOutput captureOutput, NSURL outputFileURL, NSArray connections, NSError error) { NSWorkspace.SharedWorkspace.OpenURL(outputFileURL); }
public virtual Dictionary <NSObject, AnyObject> FileAttributesToWriteToURL(NSURL url, UIDocumentSaveOperation forSaveOperation, NSErrorPointer error) { return(default(Dictionary <NSObject, AnyObject>)); }
/// <summary> /// Initializes a new instance of the <see cref="U3DXT.iOS.GUI.MediaPickedEventArgs"/> class. /// </summary> /// <param name="image">Image.</param> /// <param name="url">URL.</param> public MediaPickedEventArgs(UIImage image, NSURL url) { this.image = image; this.url = url; }
// // Custom members // bool loadDocumentFromURL(NSURL url) { data = new FooDocumentData withURL(url); return(data != null); }
public override bool writeToURL(NSURL !url) ofType(NSString !typeName) forSaveOperation(NSSaveOperationType aveOperation) originalContentsURL(NSURL? absoluteOriginalContentsURL) error(ref NSError error)
public override bool readFromURL(NSURL !url) ofType(NSString !typeName) error(ref NSError error)
/// <summary> /// Shows the native UIActivityViewController to share message, images, and URLs /// via Facebook, Twitter, Weibo, email, SMS, print, copy, save to camera roll, or /// assign to contact. /// Raises ShareCompleted event when completed. /// </summary> /// <remarks> /// This is available in iOS 6.0 and later.</remarks> /// /// <param name="items"> An array of items to share. Each item can be a string, NSURL, Texture2D, or UIImage. /// Strings starting with http:// or https:// will be automatically converted to URLs.</param> /// <param name="excludedActivityTypes"> An array of strings representing the activity types to exclude from sharing. /// See <see cref="UIActivity">Constants in UIActivity</see>.</param> public static void Share(object[] items, string[] excludedActivityTypes = null) { var nativeItems = new object[items.Length]; for (int i=0; i<items.Length; i++) { var item = items[i]; if (item is string) { string str = item as string; if (str.StartsWith("http://") || str.StartsWith("https://")) nativeItems[i] = new NSURL(str); else nativeItems[i] = str; } else if (item is Texture2D) nativeItems[i] = UIImage.FromTexture2D(item as Texture2D); else if (item is UIImage) nativeItems[i] = item; else if (item is NSURL) nativeItems[i] = item; else throw new U3DXTException("Unexpected item type: " + item.GetType()); } var vc = new UIActivityViewController(nativeItems, null); if (vc.IsNil) return; vc.completionHandler = _activityViewCompleted; if (excludedActivityTypes != null) vc.excludedActivityTypes = excludedActivityTypes; var rootVc = UIApplication.deviceRootViewController; if (CoreXT.IsiPad) { if (_popover == null) _popover = new UIPopoverController(vc); else _popover.contentViewController = vc; var rect = rootVc.view.bounds; rect.x = rect.width / 2; rect.y = rect.height; rect.width = 1; rect.height = 1; _popover.PresentPopover( rect, rootVc.view, UIPopoverArrowDirection.Down, true); } else { rootVc.PresentViewController(vc, true, null); } }
private void ProcessRequests() { while (true) { // wait for an artwork request iPendingRequests.Wait(); // get the first request in the queue - leave the request in the queue for now so that if // the main thread requests it again, it will not get re-added and downloaded again string uri; ScalingUriConverter uriConverter; lock (iLock) { uri = iPendingRequests.FirstRequest; uriConverter = iUriConverter; } Trace.WriteLine(Trace.kKinskyDesktop, "ArtworkCache requesting " + uri); // download the image NSAutoreleasePool pool = new NSAutoreleasePool(); pool.Init(); NSImage image = null; try { string requestUri = uri; if (uriConverter != null) { requestUri = uriConverter.Convert(requestUri); } NSString s = NSString.StringWithUTF8String(Uri.UnescapeDataString(requestUri)); NSURL url = NSURL.URLWithString(s.StringByAddingPercentEscapesUsingEncoding(NSStringEncoding.NSUTF8StringEncoding)); image = new NSImage(url); } catch (Exception e) { UserLog.WriteLine("ArtworkCache.ProcessRequests: " + uri + " (" + e.Message + ")"); } pool.Release(); // insert the image into the cache List <Item> staleItems; lock (iLock) { // add to the cache Item item = new Item(uri, image); staleItems = iCacheData.Add(item); // remove the request iPendingRequests.Remove(uri); } // send notification that the image was added to the cache if (EventImageAdded != null) { EventImageAdded(this, new EventArgsArtwork(uri)); } // clean up all stale items outside of the lock foreach (Item item in staleItems) { if (item.Image != null) { item.Image.Release(); } } } }
public static bool CanPrintURL(NSURL url) { return(default(bool)); }
private static void _OnWriteCompletion(NSURL assetURL, NSError error) { if (error == null) { if (_exportCompletedHandlers != null) _exportCompletedHandlers(null, new PhotosLibraryExportedEventArgs(assetURL.AbsoluteString())); } else { if (_exportFailedHandlers != null) _exportFailedHandlers(null, new U3DXTErrorEventArgs(error)); } }
public UIPrinter([Unwrapped] NSURL URL) { }
/// <summary> /// Tell OSX Speech Synthesizer to speak some text. /// </summary> /// <param name="utterance"></param> /// <param name="outputfile"></param> internal void Speak(QueuedSpeech utterance, string outputfile) { string message; // Remove any embedded command delimiters. string sayThis = Regex.Replace( utterance.message, @"\[\[", "" ); if (utterance.isAction) // Action statements are spoken all together. Such as // "/me looks nervous." The "/me" will have been substituted // with the correct name earlier. message = utterance.speaker + " " + sayThis; else // Normal speech has the name spoken quickly and slightly softer. message = "[[rate +1.0;volm -10.0]]" + utterance.speaker + "[[rate -1.0;volm +10.0;slnc 200]]" + // 200ms pause after name sayThis; syn.SetVoice(utterance.voice.root.Name); NSURL fileURL = new NSURL("file://" + outputfile); syn.StartSpeakingStringToURL(message, fileURL); // Wait for it to finish. This proceeds at faster than // speaking speed because output is to a file. // TODO use a callback to detect this. while (syn.IsSpeaking) { Thread.Sleep(200); // Check 5x per second. } }
public virtual bool ConfigurePersistentStoreCoordinatorForURL([Unwrapped] NSURL storeURL, [Unwrapped] string ofType, [Optional] string modelConfiguration, Dictionary <NSObject, AnyObject> storeOptions, NSErrorPointer error) { return(default(bool)); }
// This is called every time the document is saved... public new void setFileURL(NSURL url) { Unused.Value = SuperCall(NSDocument.Class, "setFileURL:", url); if (m_controller != null && url != m_url) { DoResetURL(url); m_controller.OnPathChanged(); Broadcaster.Invoke("document path changed", m_controller.Boss); } }
/// <summary> /// Alls the inbox files. /// </summary> /// <returns></returns> public List <UPInboxFile> AllInboxFiles() { List <UPInboxFile> files = new List <UPInboxFile>(); #if PORTING Exception error; List <string> pathNames = NSFileManager.DefaultManager().ContentsOfDirectoryAtPathError(this.InboxPath, error); if (error) { if (error.Code() == NSFileReadNoSuchFileError) { DDLogInfo("Inbox directory %@ does not exist.", this.InboxPath); } else { DDLogError("Could not load files from inbox: %@", error); } } foreach (string path in pathNames) { UPInboxFile file = new UPInboxFile(this.InboxPath.StringByAppendingPathComponent(path), NSURL.FileURLWithPathIsDirectory(this.InboxPath.StringByAppendingPathComponent(path), false)); files.Add(file); } #endif return(files); }
public virtual void RevertToContentsOfURL(NSURL url, Action <bool> completionHandler) { }
/// <summary> /// Returns true if it is able to reveal the indicated item in a Finder window. The Finder will be switched into the forground during the processing of this call. Returns NO if an error occurs during processing. /// </summary> public bool FinderRevealFileURL(NSURL theFileURL) { bool result = false; try { // Retrieve the Finder application Scripting Bridge object. FinderApplication finder = SBApplication.ApplicationWithBundleIdentifier ("com.apple.finder").CastAs<FinderApplication> (); // Retrieve a reference to our finder item asking for it by location FinderItem theItem = finder.Items.ObjectAtLocation (theFileURL).CastAs<FinderItem> (); // Display the item theItem.Reveal (); // Activate the Finder application finder.Activate (); // successful result result = true; } catch (Exception e) { Console.WriteLine (e); result = false; } // Return YES on success return result; }
public virtual bool ReadAdditionalContentFromURL(NSURL absoluteURL, NSErrorPointer error) { return(default(bool)); }
public NSArray TableViewNamesOfPromisedFilesDroppedAtDestinationForDraggedRowsWithIndexes(NSTableView aTableView, NSURL dropDestination, NSIndexSet indexSet) { throw new NotImplementedException(); }
public virtual AnyObject AdditionalContentForURL(NSURL absoluteURL, NSErrorPointer error) { return(default(AnyObject)); }
/// <summary> /// Returns an NSString containing the referenced item's finder comment (aka Spotlight comment) an item referenced by the file url. Returns nil if an error occurs during processing. /// </summary> public NSString FinderCommentForFileURL(NSURL theFileURL) { NSString result = null; try { // Retrieve the Finder application Scripting Bridge object. FinderApplication finder = SBApplication.ApplicationWithBundleIdentifier ("com.apple.finder").CastAs<FinderApplication> (); // Retrieve a reference to our finder item asking for it by location FinderItem theItem = finder.Items.ObjectAtLocation (theFileURL).CastAs<FinderItem> (); // Set the result. result = theItem.Comment; } catch (Exception e) { Console.WriteLine (e); result = null; } // return YES on success return result; }
public virtual bool WriteAdditionalContent([Unwrapped] AnyObject content, [Unwrapped] NSURL toURL, [Unwrapped] NSURL originalContentsURL, NSErrorPointer error) { return(default(bool)); }
partial void SelectFileForComment(Id sender) { NSOpenPanel theOpenPanel; NSInteger opResult; // Create an open panel theOpenPanel = NSOpenPanel.OpenPanel; theOpenPanel.Delegate = this; // Set the prompt and title theOpenPanel.Message = "Select a file or folder for comment editing."; theOpenPanel.Title = "Choose File or Folder"; // Directories okay, only one at a time theOpenPanel.CanChooseDirectories = true; theOpenPanel.AllowsMultipleSelection = false; // Run the panel opResult = theOpenPanel.RunModalForDirectoryFileTypes (FoundationFramework.NSHomeDirectory (), null, null); if (NSPanel.NSOKButton == opResult) { // Get and save the path this.SelectedFinderItem = theOpenPanel.URLs.ObjectAtIndex (0).CastTo<NSURL> (); // Attempt to retrieve the comment NSString theComment = this.FinderCommentForFileURL (this.SelectedFinderItem); if (theComment != null) { // set the path in the display this.fileNameField.StringValue = this.SelectedFinderItem.Path; // Retrieve the finder comment NSUInteger p = this.commentField.TextStorage.String.Length; this.commentField.SetSelectedRange (new NSRange (0, p)); this.commentField.InsertText (theComment); } else { this.ShowErrorMessageWithTitle ("Unable to update the finder comment for the selected item.", "Error getting comment"); } } }
public bool PanelIsValiFilename(Id sender, NSString filename) { bool result = true; NSURL url = new NSURL(filename); if ((url.NativePointer != IntPtr.Zero) && url.IsFileURL) { NSArray pathPieces = url.Path.PathComponents; NSString actualFilename = pathPieces.ObjectAtIndex(pathPieces.Count - 1).CastTo<NSString>(); if (actualFilename.IsEqualToString("text.txt")) { NSAlert alert = NSAlert.AlertWithMessageTextDefaultButtonAlternateButtonOtherButtonInformativeTextWithFormat(NSString.String, "OK", null, null, "Please pick a new name."); alert.RunModal(); result = false; } } return result; }
/// <summary> /// Returns YES if it is able to change the finder comment (aka Spotlight comment) for an item referenced by the file url. Returns NO if an error occurs during processing. /// </summary> public bool ChangeFinderCommentForFileURL(NSString comment, NSURL theFileURL) { bool result = false; try { // Retrieve the Finder application Scripting Bridge object. FinderApplication finder = SBApplication.ApplicationWithBundleIdentifier ("com.apple.finder").CastAs<FinderApplication> (); // Retrieve a reference to our finder item asking for it by location FinderItem theItem = finder.Items.ObjectAtLocation (theFileURL).CastAs<FinderItem> (); // Attempt to set the comment for the Finder item. theItem.Comment = comment; // Successful result result = true; } catch (Exception e) { Console.WriteLine (e); result = false; } // Return YES on success return result; }
public virtual void ProvidePlaceholderAtURL(NSURL url, Action <NSError> completionHandler) { }
private bool TryGetUrl(NSDictionary <NSString, iOSObjectProxy> info, NSString key, out NSURL url) { try { NSURL nsurl = (NSURL)info.ValueForKey(key, ptr => { if (ptr.Equals(IntPtr.Zero)) { return(null); } return(new NSURL(ptr)); }); url = nsurl; return(nsurl != null); } catch (Exception) { url = null; return(false); } }
public virtual void StartProvidingItemAtURL(NSURL url, Action <NSError> completionHandler) { }
public virtual bool OpenURL(NSURL url) { return(default(bool)); }
public virtual void StopProvidingItemAtURL(NSURL url) { }
/// <summary> /// Shows the native UIActivityViewController to share message, images, and URLs /// via Facebook, Twitter, Weibo, email, SMS, print, copy, save to camera roll, or /// assign to contact. /// Raises ShareCompleted event when completed. /// </summary> /// <remarks> /// This is available in iOS 6.0 and later.</remarks> /// /// <param name="items"> An array of items to share. Each item can be a string, NSURL, Texture2D, or UIImage. /// Strings starting with http:// or https:// will be automatically converted to URLs.</param> /// <param name="excludedActivityTypes"> An array of strings representing the activity types to exclude from sharing. /// See <see cref="UIActivity">Constants in UIActivity</see>.</param> public static void Share(object[] items, string[] excludedActivityTypes = null) { var nativeItems = new object[items.Length]; for (int i = 0; i < items.Length; i++) { var item = items[i]; if (item is string) { string str = item as string; if (str.StartsWith("http://") || str.StartsWith("https://")) { nativeItems[i] = new NSURL(str); } else { nativeItems[i] = str; } } else if (item is Texture2D) { nativeItems[i] = UIImage.FromTexture2D(item as Texture2D); } else if (item is UIImage) { nativeItems[i] = item; } else if (item is NSURL) { nativeItems[i] = item; } else { throw new U3DXTException("Unexpected item type: " + item.GetType()); } } var vc = new UIActivityViewController(nativeItems, null); if (vc.IsNil) { return; } vc.completionHandler = _activityViewCompleted; if (excludedActivityTypes != null) { vc.excludedActivityTypes = excludedActivityTypes; } var rootVc = UIApplication.deviceRootViewController; if (CoreXT.IsiPad) { if (_popover == null) { _popover = new UIPopoverController(vc); } else { _popover.contentViewController = vc; } var rect = rootVc.view.bounds; rect.x = rect.width / 2; rect.y = rect.height; rect.width = 1; rect.height = 1; _popover.PresentPopover( rect, rootVc.view, UIPopoverArrowDirection.Down, true); } else { rootVc.PresentViewController(vc, true, null); } }
public static NSURL PlaceholderURLForURL(NSURL url) { return(default(NSURL)); }
// Save the given image to a file at the given url. // Returns true if successful, false otherwise. public static bool IISaveImage(ImageView view, NSURL url, uint width, uint height) { ImageInfo image = view.Image; bool result = false; // If there is no image, no destination, or the width/height is 0, then fail early. if ((url != null) && (width != 0) && (height != 0)) { // Try to create a jpeg image destination at the url given to us IntPtr imageDest = CGImageDestination.CreateWithURL(url, UTType.kUTTypeJPEG, 1, null); if (imageDest != IntPtr.Zero) { // And if we can, then we can start building our final image. // We begin by creating a CGBitmapContext to host our desintation image. // Allocate enough space to hold our pixels IntPtr imageData = Marshal.AllocHGlobal((int) (Marshal.SizeOf(typeof (UInt32))*width*height)); // Create the bitmap context IntPtr bitmapContext = CGBitmapContext.Create( imageData, // image data we just allocated... width, // width height, // height 8, // 8 bits per component sizeof (UInt32)*width, // bytes per pixel times number of pixels wide CGImage.GetColorSpace(image.fImageRef), // use the same colorspace as the original image (CGBitmapInfo) CGImageAlphaInfo.kCGImageAlphaPremultipliedFirst); // use premultiplied alpha // Check that all that went well if (bitmapContext != IntPtr.Zero) { // Now, we draw the image to the bitmap context IIDrawImageTransformed(ref image, bitmapContext, CGRect.CGRectMake(0.0f, 0.0f, width, height)); // We have now gotten our image data to the bitmap context, and correspondingly // into imageData. If we wanted to, we could look at any of the pixels of the image // and manipulate them in any way that we desire, but for this case, we're just // going to ask ImageIO to write this out to disk. // Obtain a CGImageRef from the bitmap context for ImageIO IntPtr imageIOImage = CGBitmapContext.CreateImage(bitmapContext); // Check if we have additional properties from the original image if (image.fProperties != null) { // If we do, then we want to inspect the orientation property. // If it exists and is not the default orientation, then we // want to replace that orientation in the destination file int orientation = IIGetImageOrientation(ref image); if (orientation != 1) { // If the orientation in the original image was not the default, // then we need to replace that key in a duplicate of that dictionary // and then pass that dictionary to ImageIO when adding the image. NSMutableDictionary prop = new NSMutableDictionary(image.fProperties); orientation = 1; prop.SetValueForKey(NSNumber.NumberWithInt(orientation), CGImageProperties.kCGImagePropertyOrientation); // And add the image with the new properties CGImageDestination.AddImage(imageDest, imageIOImage, prop); // Clean up after ourselves prop.Release(); } else { // Otherwise, the image was already in the default orientation and we can just save // it with the original properties. CGImageDestination.AddImage(imageDest, imageIOImage, image.fProperties); } } else { // If we don't, then just add the image without properties CGImageDestination.AddImage(imageDest, imageIOImage, null); } // Release the image and the context, since we are done with both. CGImage.Release(imageIOImage); CGContext.Release(bitmapContext); } // Deallocate the image data Marshal.FreeHGlobal(imageData); // Finalize the image destination result = CGImageDestination.Finalize(imageDest); CFType.CFRelease(imageDest); } } return result; }
public static bool WritePlaceholderAtURL(NSURL placeholderURL, Dictionary <NSObject, AnyObject> withMetadata, NSErrorPointer error) { return(default(bool)); }
public UIDocumentInteractionController(NSURL URL) { }
public virtual string PersistentIdentifierForItemAtURL(NSURL url) { return(default(string)); }
private void DoResetURL(NSURL url) { if (url != m_url) { if (m_url != null) m_url.release(); m_url = url; if (m_url != null) m_url.retain(); } }
public virtual void ItemChangedAtURL(NSURL url) { }
public virtual bool ReadFromURL(NSURL url, NSErrorPointer error) { return(default(bool)); }
public void StartSpeakingTextViewToURL(NSURL url) { if (this._speechSynthesizer.IsSpeaking) { this._speechSynthesizer.StopSpeaking(); } else { // Grab the selection substring, or if no selection then grab entire text. this._orgSelectionRange = this._textToSpeechExampleTextView.SelectedRange; NSString theViewText; if (this._orgSelectionRange.length == 0) { theViewText = this._textToSpeechExampleTextView.String; this._offsetToSpokenText = 0; } else { theViewText = this._textToSpeechExampleTextView.String.SubstringWithRange(this._orgSelectionRange); this._offsetToSpokenText = this._orgSelectionRange.location; } if (this._voicePop.IndexOfSelectedItem == 0) { // Pass NULL as the voice to use the system voice. this._speechSynthesizer.SetVoice(null); } else { this._speechSynthesizer.SetVoice(NSSpeechSynthesizer.AvailableVoices.ObjectAtIndex((uint) this._voicePop.IndexOfSelectedItem - kNumOfFixedMenuItemsInVoicePopup).CastTo<NSString>()); } if (url != null) { this._speechSynthesizer.StartSpeakingStringToURL(theViewText, url); this._textToSpeechExampleSpeakButton.IsEnabled = false; this._saveButton.Title = FoundationFramework.NSLocalizedString("Stop Saving", "Save file button name (stop)"); } else { this._speechSynthesizer.StartSpeakingString(theViewText); this._textToSpeechExampleSpeakButton.Title = FoundationFramework.NSLocalizedString("Stop Speaking", "Speaking button name (stop)"); this._saveButton.IsEnabled = false; } this._voicePop.IsEnabled = false; } }
public UIDocument(NSURL fileURL) { }
/// <exclude/> public NSDirectoryEnumerator enumeratorAtURL_includingPropertiesForKeys_options_errorHandler( NSURL url, NSArray keys, uint mask, Func<NSURL, NSError, bool> callback) { Func<IntPtr, IntPtr, IntPtr, byte> thunk = (IntPtr context, IntPtr urlPtr, IntPtr errorPtr) => { var url2 = NSObject.Lookup(urlPtr).To<NSURL>(); var error = NSObject.Lookup(errorPtr).To<NSError>(); bool stopped = callback(url2, error); return stopped ? (byte) 1 : (byte) 0; }; var block = new ExtendedBlock(thunk); var e = Call("enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:", url, keys, mask, block).To<NSDirectoryEnumerator>(); GC.KeepAlive(block); return e; }