private void RegisterMtpStateChangedEvent() { _mtpStateChangedCallback = (int eventType, int eventParameter, IntPtr userData) => { MtpEventType _eventType = (MtpEventType)eventType; int _eventParameter = eventParameter; MtpStateChangedEventArgs e = new MtpStateChangedEventArgs(_eventType, _eventParameter); _mtpStateChanged.SafeInvoke(null, e); }; int ret = Interop.Mtp.AddMtpStateChangedCallback(_mtpStateChangedCallback, IntPtr.Zero); if (ret != (int)MtpError.None) { Log.Error(Globals.LogTag, "Failed to add mtp state changed callback, Error - " + (MtpError)ret); } }
internal MtpStateChangedEventArgs(MtpEventType type, int eventParameter) { _type = type; _eventParameter = eventParameter; }