当前位置: 首页>>代码示例>>C#>>正文


C# TransferDataType.ToWpfDataFormat方法代码示例

本文整理汇总了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);

		}
开发者ID:TheBrainTech,项目名称:xwt,代码行数:26,代码来源:ClipboardBackend.cs

示例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 ());
			}
		}
开发者ID:m13253,项目名称:xwt,代码行数:12,代码来源:ClipboardBackend.cs

示例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 ());
        }
开发者ID:garuma,项目名称:xwt,代码行数:10,代码来源:ClipboardBackend.cs

示例4: IsTypeAvailable

		public override bool IsTypeAvailable (TransferDataType type)
		{
			if (type == null)
				throw new ArgumentNullException ("type");

			return WindowsClipboard.ContainsData (type.ToWpfDataFormat ());
		}
开发者ID:m13253,项目名称:xwt,代码行数:7,代码来源:ClipboardBackend.cs

示例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 ());
        }
开发者ID:garuma,项目名称:xwt,代码行数:9,代码来源:ClipboardBackend.cs

示例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
		}
开发者ID:TheBrainTech,项目名称:xwt,代码行数:32,代码来源:ClipboardBackend.cs

示例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 ());
		}
开发者ID:TheBrainTech,项目名称:xwt,代码行数:15,代码来源:ClipboardBackend.cs

示例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;
        }
开发者ID:akrisiun,项目名称:xwt,代码行数:14,代码来源:ClipboardBackend.cs

示例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 ());
     }
 }
开发者ID:akrisiun,项目名称:xwt,代码行数:19,代码来源:ClipboardBackend.cs


注:本文中的TransferDataType.ToWpfDataFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。