private static void UnregisterDeviceStateChangedEvent() { Native.RemoveDeviceStateChangedCallback(_deviceStateChangedId). ThrowIfError("Failed to remove the event handler."); _deviceStateChangedCallback = null; }
private static void RegisterDeviceStateChangedEvent() { _deviceStateChangedCallback = (type, state, _) => { _deviceStateChanged?.Invoke(null, new RecorderDeviceStateChangedEventArgs(type, state)); }; Native.AddDeviceStateChangedCallback(_deviceStateChangedCallback, IntPtr.Zero, out _deviceStateChangedId). ThrowIfError("Failed to add the event handler."); }