FromType() 공개 정적인 메소드

Creates a transfer data type from a CLR type
This is the data type to be used when transferring whole objects through drag & drop or copy & paste
public static FromType ( Type type ) : TransferDataType
type System.Type /// A type ///
리턴 TransferDataType
예제 #1
0
 /// <summary>
 /// Adds a value to the data source
 /// </summary>
 /// <param name='value'>
 /// Value.
 /// </param>
 public void AddValue <T> (T value) where T : class
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     data [TransferDataType.FromType(typeof(T))] = value;
 }
예제 #2
0
 public static void SetData <T> (T data)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     SetData(TransferDataType.FromType(data.GetType()), data);
 }
예제 #3
0
 public void AddValue(object value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     data [TransferDataType.FromType(value.GetType())] = value;
 }
예제 #4
0
        T ITransferData.GetValue <T> ()
        {
            object ob = GetValue(TransferDataType.FromType(typeof(T)));

            if (ob == null || ob.GetType() == typeof(Type))
            {
                return((T)ob);
            }
            if (ob is byte[])
            {
                T val = (T)TransferDataSource.DeserializeValue((byte[])ob);
                data[TransferDataType.FromType(typeof(T))] = val;
                return(val);
            }
            return((T)ob);
        }
예제 #5
0
 public static T GetData <T> ()
 {
     return((T)Backend.GetData(TransferDataType.FromType(typeof(T))));
 }
예제 #6
0
 public static bool ContainsData <T> ()
 {
     return(Backend.IsTypeAvailable(TransferDataType.FromType(typeof(T))));
 }
예제 #7
0
 public static void SetData <T> (Func <T> dataSource)
 {
     Backend.SetData(TransferDataType.FromType(typeof(T)), delegate() {
         return(dataSource());
     });
 }
예제 #8
0
 public static IAsyncResult BeginGetData <T> (AsyncCallback callback, object state)
 {
     return(Backend.BeginGetData(TransferDataType.FromType(typeof(T)), callback, state));
 }
 /// <summary>
 /// Registers that the data store contains data of the provided type
 /// </summary>
 /// <param name='type'>
 /// A type
 /// </param>
 /// <remarks>
 /// This method can be used in combination with DataRequestCallback to
 /// generate the data on demand. In some scenarios, the drop/paste
 /// side of a drag&amp;drop or clipboard operation can decide if a drop/paste
 /// is allowed or not by checking the available data type in this
 /// data source. Once the operation is accepted, the DataRequestCallback
 /// callback will be invoked to get the data for the type.
 /// </remarks>
 public void AddType(Type type)
 {
     data [TransferDataType.FromType(type)] = null;
 }
예제 #10
0
 public void SetDragSource(DragDropAction dragAction, params Type[] types)
 {
     Backend.SetDragSource(types.Select(t => TransferDataType.FromType(t)).ToArray(), dragAction);
 }
예제 #11
0
 public void SetDragDropTarget(params Type[] types)
 {
     Backend.SetDragTarget(types.Select(t => TransferDataType.FromType(t)).ToArray(), DragDropAction.All);
 }