本文整理汇总了C#中TransferDataType.ToWpfDataFormat方法的典型用法代码示例。如果您正苦于以下问题:C# TransferDataType.ToWpfDataFormat方法的具体用法?C# TransferDataType.ToWpfDataFormat怎么用?C# TransferDataType.ToWpfDataFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransferDataType
的用法示例。
在下文中一共展示了TransferDataType.ToWpfDataFormat方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetData
public override void SetData (TransferDataType type, Func<object> dataSource)
{
if (type == null)
throw new ArgumentNullException ("type");
if (dataSource == null)
throw new ArgumentNullException ("dataSource");
if (type == TransferDataType.Html) {
WindowsClipboard.SetData (type.ToWpfDataFormat (), GenerateCFHtml (dataSource ().ToString ()));
} else if (type == TransferDataType.Image) {
var img = dataSource() as Xwt.Drawing.Image;
if (img != null)
{
var src = img.ToBitmap().GetBackend() as WpfImage;
WindowsClipboard.SetData (type.ToWpfDataFormat (), src.MainFrame);
}
>>>>>>> f981e414c3bfee29f5dc508cd099be9b67e0bc9e
} else {
if(type == TransferDataType.Uri) {
currentDataObject.SetFileDropList((StringCollection)(dataSource()));
} else {
currentDataObject.SetData(type.ToWpfDataFormat(), dataSource());
}
}
WindowsClipboard.SetDataObject(currentDataObject);
}
示例2: SetData
public override void SetData (TransferDataType type, Func<object> dataSource)
{
if (type == null)
throw new ArgumentNullException ("type");
if (dataSource == null)
throw new ArgumentNullException ("dataSource");
if (type == TransferDataType.Html) {
WindowsClipboard.SetData (type.ToWpfDataFormat (), GenerateCFHtml (dataSource ().ToString ()));
} else {
WindowsClipboard.SetData (type.ToWpfDataFormat (), dataSource ());
}
}
示例3: GetData
public override object GetData(TransferDataType type)
{
if (type == null)
throw new ArgumentNullException ("type");
while (!IsTypeAvailable (type))
Thread.Sleep (1);
return WindowsClipboard.GetData (type.ToWpfDataFormat ());
}
示例4: IsTypeAvailable
public override bool IsTypeAvailable (TransferDataType type)
{
if (type == null)
throw new ArgumentNullException ("type");
return WindowsClipboard.ContainsData (type.ToWpfDataFormat ());
}
示例5: SetData
public override void SetData(TransferDataType type, Func<object> dataSource)
{
if (type == null)
throw new ArgumentNullException ("type");
if (dataSource == null)
throw new ArgumentNullException ("dataSource");
WindowsClipboard.SetData (type.ToWpfDataFormat (), dataSource ());
}
示例6: GetData
public override object GetData (TransferDataType type)
{
if (type == null)
throw new ArgumentNullException ("type");
if (!IsTypeAvailable (type))
return null;
<<<<<<< HEAD
if (type == TransferDataType.Text) {
if (WindowsClipboard.ContainsFileDropList()) {
foreach (string s in WindowsClipboard.GetFileDropList()) {
return "file://" + s;
}
}
}
if(type == TransferDataType.Image) {
var ob = WindowsClipboard.GetDataObject();
var bmp = GetBestPossibletAlphaBitmapFromDataObject(ob);
return ApplicationContext.Toolkit.WrapImage(bmp);
}
return WindowsClipboard.GetData (type.ToWpfDataFormat ());
=======
var data = WindowsClipboard.GetData (type.ToWpfDataFormat ());
if (type == TransferDataType.Image)
return ApplicationContext.Toolkit.WrapImage(ImageHandler.LoadFromImageSource((System.Windows.Media.ImageSource)data));
return data;
>>>>>>> f981e414c3bfee29f5dc508cd099be9b67e0bc9e
}
示例7: IsTypeAvailable
public override bool IsTypeAvailable (TransferDataType type)
{
if (type == null)
throw new ArgumentNullException ("type");
if (type == TransferDataType.Text) {
if (WindowsClipboard.ContainsFileDropList()) {
foreach (string s in WindowsClipboard.GetFileDropList()) {
return true;
}
}
}
return WindowsClipboard.ContainsData (type.ToWpfDataFormat ());
}
示例8: GetData
public override object GetData(TransferDataType type)
{
if (type == null)
throw new ArgumentNullException ("type");
if (!IsTypeAvailable (type))
return null;
var data = WindowsClipboard.GetData (type.ToWpfDataFormat ());
if (type == TransferDataType.Image)
return ApplicationContext.Toolkit.WrapImage(ImageHandler.LoadFromImageSource((System.Windows.Media.ImageSource)data));
return data;
}
示例9: SetData
public override void SetData(TransferDataType type, Func<object> dataSource)
{
if (type == null)
throw new ArgumentNullException ("type");
if (dataSource == null)
throw new ArgumentNullException ("dataSource");
if (type == TransferDataType.Html) {
WindowsClipboard.SetData (type.ToWpfDataFormat (), GenerateCFHtml (dataSource ().ToString ()));
} else if (type == TransferDataType.Image) {
var img = dataSource() as Xwt.Drawing.Image;
if (img != null)
{
var src = img.ToBitmap().GetBackend() as WpfImage;
WindowsClipboard.SetData (type.ToWpfDataFormat (), src.MainFrame);
}
} else {
WindowsClipboard.SetData (type.ToWpfDataFormat (), dataSource ());
}
}