private static Methods GetMethods(NSObject obj, string selector) { if (!_callbacks.TryGetValue(obj.Handle, out Dictionary <IntPtr, Methods> value)) { value = (_callbacks[obj.Handle] = new Dictionary <IntPtr, Methods>()); } IntPtr selector2 = ObjC.GetSelector(selector); if (!value.TryGetValue(selector2, out Methods value2)) { value2 = (value[selector2] = new Methods(obj)); } return(value2); }
public void SaveToPhotosAlbum(Action <NSError> callback = null) { if (callback == null) { UIImageWriteToSavedPhotosAlbum(Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); } else { UIImageDispatcher dispatcher = new UIImageDispatcher(callback); Callbacks.Subscribe(dispatcher, "__onSaveToPhotoAlbum:", delegate(IntPtr obj, IntPtr e, IntPtr ctx) { callback((e == IntPtr.Zero) ? null : Runtime.GetNSObject <NSError>(e)); dispatcher.Dispose(); }); UIImageWriteToSavedPhotosAlbum(Handle, dispatcher.Handle, ObjC.GetSelector("__onSaveToPhotoAlbum:"), IntPtr.Zero); } }
private static Methods GetMethods(NSObject obj, string selector) { Dictionary <IntPtr, Methods> dictionary; if (!_callbacks.TryGetValue(obj.Handle, out dictionary)) { _callbacks[obj.Handle] = dictionary = new Dictionary <IntPtr, Methods>(); } IntPtr selectorHandle = ObjC.GetSelector(selector); Methods methods; if (!dictionary.TryGetValue(selectorHandle, out methods)) { dictionary[selectorHandle] = methods = new Methods(obj); } return(methods); }