protected virtual void StopListeners(IDataObject data) { foreach (IDragSource dragSource in DragSourceHelper.DataOfType <IDragSource>(data)) { dragSource.DragCanceled -= new EventHandler <DragCanceledEventArgs>(this.DragSourceDragCanceled); dragSource.GiveFeedback -= new GiveFeedbackEventHandler(this.DragSourceGiveFeedback); dragSource.DragFinished -= new EventHandler <EventArgs>(this.DragSourceDragFinished); } }
public static IEnumerable <T> DataOfType <T>(IDataObject data) { if (data != null) { foreach (T obj in DragSourceHelper.DataOfType <T>(new SafeDataObject(data))) { yield return(obj); } } }
public static bool FirstDataOfType <T>(SafeDataObject data, ref T result) { using (IEnumerator <T> enumerator = DragSourceHelper.DataOfType <T>(data).GetEnumerator()) { if (enumerator.MoveNext()) { T current = enumerator.Current; result = current; return(true); } } return(false); }
public static IEnumerable <T> DataOfType <T>(SafeDataObject data) { if (data != null) { T result = default(T); foreach (string format in data.GetFormats()) { if (DragSourceHelper.InternalDataOfType <T>(data.GetData(format), ref result)) { yield return(result); } } } }