/// <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; }
public static void SetData <T> (T data) { if (data == null) { throw new ArgumentNullException("data"); } SetData(TransferDataType.FromType(data.GetType()), data); }
public void AddValue(object value) { if (value == null) { throw new ArgumentNullException("value"); } data [TransferDataType.FromType(value.GetType())] = value; }
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); }
public static T GetData <T> () { return((T)Backend.GetData(TransferDataType.FromType(typeof(T)))); }
public static bool ContainsData <T> () { return(Backend.IsTypeAvailable(TransferDataType.FromType(typeof(T)))); }
public static void SetData <T> (Func <T> dataSource) { Backend.SetData(TransferDataType.FromType(typeof(T)), delegate() { return(dataSource()); }); }
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&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; }
public void SetDragSource(DragDropAction dragAction, params Type[] types) { Backend.SetDragSource(types.Select(t => TransferDataType.FromType(t)).ToArray(), dragAction); }
public void SetDragDropTarget(params Type[] types) { Backend.SetDragTarget(types.Select(t => TransferDataType.FromType(t)).ToArray(), DragDropAction.All); }