// Begins a "group" which groups several Highlights together. public static void OpenGroup(OpenGroupParams openGroupParams) { if (!instanceCreated) { Debug.LogError("ERROR: Cannot open a group. The SDK has not been initialized."); return; } OpenGroupParamsInternal ogp = new OpenGroupParamsInternal(); ogp.id = openGroupParams.Id; StringBuilder sb = new StringBuilder(); foreach (TranslationEntry te in openGroupParams.GroupDescriptionTable) { sb.Append(te.Language).Append("\a").Append(te.Translation).Append("\a"); } ogp.groupDescriptionTable = sb.ToString(); IntPtr pnt = Marshal.AllocHGlobal(Marshal.SizeOf(ogp)); try { Marshal.StructureToPtr(ogp, pnt, false); Highlights_OpenGroupAsync(pnt); } finally { Marshal.FreeHGlobal(pnt); } }
// Begins a "group" which groups several Highlights together. public static void OpenGroup(OpenGroupParams openGroupParams, EmptyCallbackDelegate callback) { if (!instanceCreated) { Console.WriteLine("ERROR: Cannot open a group. The SDK has not been initialized."); return; } OpenGroupParamsInternal ogp = new OpenGroupParamsInternal(); ogp.id = openGroupParams.Id; StringBuilder sb = new StringBuilder(); foreach (TranslationEntry te in openGroupParams.GroupDescriptionTable) { sb.Append(te.Language).Append("\a").Append(te.Translation).Append("\a"); } ogp.groupDescriptionTable = sb.ToString(); IntPtr pnt = Marshal.AllocHGlobal(Marshal.SizeOf(ogp)); EmptyCallbackId cid = new EmptyCallbackId(); cid.id = GetCallbackId(); cid.callback = callback; IntPtr asyncOp = Marshal.AllocHGlobal(Marshal.SizeOf(cid)); try { Marshal.StructureToPtr(ogp, pnt, false); Marshal.StructureToPtr(cid, asyncOp, false); Highlights_OpenGroupAsync(pnt, asyncOp); } finally { Marshal.FreeHGlobal(pnt); Marshal.FreeHGlobal(asyncOp); } }