Example #1
0
 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);
     }
 }
Example #2
0
 public static IEnumerable <T> DataOfType <T>(IDataObject data)
 {
     if (data != null)
     {
         foreach (T obj in DragSourceHelper.DataOfType <T>(new SafeDataObject(data)))
         {
             yield return(obj);
         }
     }
 }
Example #3
0
 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);
 }