void OleInterop.IDataObject.DUnadvise(uint dwConnection) { if (null != oleData) { oleData.DUnadvise(dwConnection); } else { bclData.DUnadvise((int)dwConnection); } }
/// <summary> /// Unregisters a drag source from the internal cache. /// </summary> /// <param name="control">The drag source Control.</param> public static void UnregisterDefaultDragSource(Control control) { if (s_dataContext.ContainsKey(control)) { DragSourceEntry entry = s_dataContext[control]; ComTypes.IDataObject dataObjectCOM = (ComTypes.IDataObject)entry.data; // Stop listening to drop description changes dataObjectCOM.DUnadvise(entry.adviseConnection); // Unhook the default drag source event handlers control.GiveFeedback -= new GiveFeedbackEventHandler(DefaultGiveFeedbackHandler); control.QueryContinueDrag -= new QueryContinueDragEventHandler(DefaultQueryContinueDragHandler); // Remove the entries from our context caches s_dataContext.Remove(control); s_dropDescriptions.Remove(entry.data); } }