public IntPtr AddEvent(ContactInfo contact, Icon icon, string serviceToCall, IntPtr lParamToPass, IntPtr eventToken, ContactListEventProperties properties, string toolTip) { if (contact == null) throw new ArgumentNullException("contact"); if (icon == null) throw new ArgumentNullException("icon"); ContactListEvent clistEvent = new ContactListEvent(); clistEvent.ContactHandle = contact.MirandaHandle; clistEvent.EventHandle = eventToken; clistEvent.Flags = (uint)properties; clistEvent.IconHandle = icon.Handle; clistEvent.LParam = lParamToPass; clistEvent.ServiceName = serviceToCall; clistEvent.Tooltip = toolTip; UnmanagedStructHandle<ContactListEvent> nativeStruct = UnmanagedStructHandle<ContactListEvent>.Empty; try { nativeStruct = new UnmanagedStructHandle<ContactListEvent>(ref clistEvent); IntPtr eventHandle = (IntPtr)MirandaContext.Current.CallService(MS_CLIST_ADDEVENT, UIntPtr.Zero, nativeStruct.IntPtr); if (eventHandle != IntPtr.Zero) throw new MirandaException(String.Format(TextResources.ExceptionMsg_Formatable2_MirandaServiceReturnedFailure, MS_CLIST_ADDEVENT, eventHandle.ToString())); return clistEvent.EventHandle; } finally { nativeStruct.Free(); } }
public IntPtr AddEvent(ContactInfo contact, Icon icon, string serviceToCall, ContactListEventProperties properties, string toolTip) { if (contact == null) throw new ArgumentNullException("contact"); return AddEvent(contact, icon, serviceToCall, IntPtr.Zero, contact.MirandaHandle, properties, toolTip); }