Beispiel #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);
     }
 }
Beispiel #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);
         }
     }
 }
Beispiel #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);
 }
Beispiel #4
0
 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);
             }
         }
     }
 }