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


C# TransferDataType类代码示例

本文整理汇总了C#中TransferDataType的典型用法代码示例。如果您正苦于以下问题:C# TransferDataType类的具体用法?C# TransferDataType怎么用?C# TransferDataType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TransferDataType类属于命名空间,在下文中一共展示了TransferDataType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetData

		public override void SetData (TransferDataType type, Func<object> dataSource)
		{
			var pboard = NSPasteboard.GeneralPasteboard;
			pboard.ClearContents ();
			owner.DataSource = dataSource;
			pboard.AddTypes (new[] { type.ToUTI () }, owner);
		}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:7,代码来源:MacClipboardBackend.cs

示例2: BuildTargetTable

 public static Gtk.TargetList BuildTargetTable(TransferDataType[] types)
 {
     var tl = new Gtk.TargetList ();
     foreach (var tt in types)
         tl.AddTable (CreateTargetEntries (tt));
     return tl;
 }
开发者ID:samclarke,项目名称:xwt,代码行数:7,代码来源:Util.cs

示例3: 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

示例4: 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

示例5: 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:Gaushick,项目名称:xwt,代码行数:10,代码来源:ClipboardBackend.cs

示例6: BeginGetData

        public override IAsyncResult BeginGetData(TransferDataType type, AsyncCallback callback, object state)
        {
            if (type == null)
                throw new ArgumentNullException ("type");
            if (callback == null)
                throw new ArgumentNullException ("callback");

            return Task<object>.Factory.StartNew (s => GetData (type), state)
                .ContinueWith (t => callback (t));
        }
开发者ID:Gaushick,项目名称:xwt,代码行数:10,代码来源:ClipboardBackend.cs

示例7: SetData

		public override void SetData (TransferDataType type, Func<object> dataSource)
		{
			clipboard.SetWithData ((Gtk.TargetEntry[])Util.BuildTargetTable (new TransferDataType[] { type }), 
			  delegate (Gtk.Clipboard cb, Gtk.SelectionData data, uint id) {
				TransferDataType ttype = Util.AtomToType (data.Target.Name);
				if (ttype == type)
					Util.SetSelectionData (data, data.Target.Name, dataSource ());
			},
			delegate {
			});
		}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:11,代码来源:ClipboardBackend.cs

示例8: SetData

		public override void SetData (TransferDataType type, Func<object> dataSource, bool cleanClipboardFirst = true)
		{
			var pboard = NSPasteboard.GeneralPasteboard;
			if(cleanClipboardFirst) {
				pboard.ClearContents();
			}
			var owner = new PasteboardOwner();
			owner.DataSource = dataSource;

			pboard.AddTypes (new[] { type.ToUTI () }, owner);
		}
开发者ID:TheBrainTech,项目名称:xwt,代码行数:11,代码来源:MacClipboardBackend.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 {
				WindowsClipboard.SetData (type.ToWpfDataFormat (), dataSource ());
			}
		}
开发者ID:m13253,项目名称:xwt,代码行数:12,代码来源:ClipboardBackend.cs

示例10: IsTypeAvailable

		public override bool IsTypeAvailable (TransferDataType type)
		{
			if (type == TransferDataType.Text)
				return clipboard.WaitIsTextAvailable ();
			if (type == TransferDataType.Image)
				return clipboard.WaitIsImageAvailable ();
			
			foreach (var at in GetAtomsForType (type)) {
				if (clipboard.WaitIsTargetAvailable (at))
					return true;
			}
			return false;
		}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:13,代码来源:ClipboardBackend.cs

示例11: 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

示例12: GetData

		public override object GetData (TransferDataType type)
		{
			if (type == TransferDataType.Text)
				return clipboard.WaitForText ();
			if (type == TransferDataType.Text)
				return clipboard.WaitForImage ();
			
			TransferDataStore store = new TransferDataStore ();
			
			foreach (var at in GetAtomsForType (type)) {
				var data = clipboard.WaitForContents (at);
				Util.GetSelectionData (ApplicationContext, data, store);
			}
			return ((ITransferData)store).GetValue (type);
		}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:15,代码来源:ClipboardBackend.cs

示例13: GetData

        public object GetData(TransferDataType type)
        {
            if (type == null)
                throw new ArgumentNullException ("type");

            while (!IsTypeAvailable (type))
                Thread.Sleep (1);

            if (type == TransferDataType.Image)
                return WindowsClipboard.GetImage ();
            if (type == TransferDataType.Rtf)
                return WindowsClipboard.GetText (TextDataFormat.Rtf);
            if (type == TransferDataType.Text) {
                if (WindowsClipboard.ContainsText (TextDataFormat.UnicodeText))
                    return WindowsClipboard.GetText();

                return WindowsClipboard.GetText (TextDataFormat.Text);
            }

            throw new NotImplementedException();
        }
开发者ID:joncham,项目名称:xwt,代码行数:21,代码来源:ClipboardBackend.cs

示例14: GetData

		public override object GetData (TransferDataType type)
		{
			if (type == TransferDataType.Uri)
				return (Uri)NSUrl.FromPasteboard (NSPasteboard.GeneralPasteboard);

			var data = NSPasteboard.GeneralPasteboard.GetDataForType (type.ToUTI ());
			if (data == null)
				return null;

			if (type == TransferDataType.Text)
				return data.ToString ();
			if (type == TransferDataType.Image)
				return new NSImage (data);

			unsafe {
				var bytes = new byte [data.Length];
				using (var stream = new UnmanagedMemoryStream ((byte*)data.Bytes, bytes.Length))
					stream.Read (bytes, 0, bytes.Length);
				return TransferDataSource.DeserializeValue (bytes);
			}
		}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:21,代码来源:MacClipboardBackend.cs

示例15: IsTypeAvailable

 public override bool IsTypeAvailable(TransferDataType type)
 {
     return NSPasteboard.GeneralPasteboard.Types.Contains (type.ToUTI ());
 }
开发者ID:akrisiun,项目名称:xwt,代码行数:4,代码来源:MacClipboardBackend.cs


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