public static IList <string> GetUrlListFromEventRef(IntPtr eventRef) { AEDesc list = GetEventParameter <AEDesc> (eventRef, CarbonEventParameterName.DirectObject, CarbonEventParameterType.AEList); try { return(AppleEvent.GetUtf8StringListFromAEDesc(ref list, true)); } finally { Carbon.CheckReturn((int)AppleEvent.AEDisposeDesc(ref list)); } }
static CarbonEventHandlerStatus HandleOpenUrls(IntPtr callRef, IntPtr eventRef, IntPtr user_data) { try { var urls = Carbon.GetUrlListFromEventRef(eventRef); var args = new ApplicationUrlEventArgs(urls); openUrls(null, args); return(args.HandledStatus); } catch (Exception ex) { System.Console.WriteLine(ex); return(CarbonEventHandlerStatus.NotHandled); } }
static CarbonEventHandlerStatus HandleOpenDocuments(IntPtr callRef, IntPtr eventRef, IntPtr user_data) { try { var docs = Carbon.GetFileListFromEventRef(eventRef); var args = new ApplicationDocumentEventArgs(docs); openDocuments?.Invoke(null, args); return(args.HandledStatus); } catch (Exception ex) { System.Console.WriteLine(ex); return(CarbonEventHandlerStatus.NotHandled); } }
public OSType(string fourcc) { value = Carbon.ConvertCharCode(fourcc); }