private static void SetInputModeCallbackImpl(IntPtr ptr, Result result) { GCHandle h = GCHandle.FromIntPtr(ptr); SetInputModeHandler callback = (SetInputModeHandler)h.Target; h.Free(); callback(result); }
/// <summary> /// Sets a new voice input mode for the user. Refer to /// <a href="https://discord.com/developers/docs/game-sdk/discord-voice#data-models-shortcut-keys">Shortcut Keys</a> /// for a table of valid values for shortcuts. /// </summary> /// <param name="inputMode"></param> /// <param name="callback"></param> public void SetInputMode(InputMode inputMode, SetInputModeHandler callback) { GCHandle wrapped = GCHandle.Alloc(callback); Methods.SetInputMode(methodsPtr, inputMode, GCHandle.ToIntPtr(wrapped), SetInputModeCallbackImpl); }