public void NSPasteboardTests_WriteObjectTests() { NSPasteboard b = NSPasteboard.CreateWithUniqueName(); b.WriteObjects(new INSPasteboardWriting [] { (NSString)"asfd" }); b.WriteObjects(new NSPasteboardWriting [] { new MyPasteboard() }); }
public void NSPasteboardTests_WriteObjectTests() { NSPasteboard b = NSPasteboard.CreateWithUniqueName(); b.WriteObjects(new INSPasteboardWriting [] { (NSString)"asfd" }); b.WriteObjects(new NSPasteboardWriting [] { new MyPasteboard() }); #if !XAMCORE_2_0 // Awesome backwards compat API b.WriteObjects(new NSPasteboardReading [] { new MyPasteboard2() }); #endif }
public void NSPasteboardTests_WriteObjectTests() { NSPasteboard b = NSPasteboard.CreateWithUniqueName(); if (b == null) { Assert.Inconclusive("NSPasteboard could not be provided by the OS."); } b.WriteObjects(new INSPasteboardWriting [] { (NSString)"asfd" }); b.WriteObjects(new NSPasteboardWriting [] { new MyPasteboard() }); // from the docs: the lifetime of a unique pasteboard is not related to the lifetime of the creating app, // you must release a unique pasteboard by calling releaseGlobally to avoid possible leaks. b.ReleaseGlobally(); }
public static void CopyToClipboard(string text) { NSPasteboard clipboard = NSPasteboard.GeneralPasteboard; clipboard.ClearContents(); clipboard.WriteObjects(new NSString[] { (NSString)text }); }
/// <summary> /// Sets the clipboard. /// </summary> /// <returns>The clipboard.</returns> /// <param name="str">String.</param> public static void SetClipboard(string str) { NSString stri = (NSString)str; NSPasteboard pasteBoard = NSPasteboard.GeneralPasteboard; pasteBoard.ClearContents(); pasteBoard.WriteObjects(new INSPasteboardWriting [] { stri }); }
public override bool WriteRows(NSTableView tableView, NSIndexSet rowIndexes, NSPasteboard pboard) { var item = new NSPasteboardItem(); item.SetDataForType(NSKeyedArchiver.ArchivedDataWithRootObject(rowIndexes), DataTypeName); pboard.WriteObjects(new[] { item }); return(true); }
public void CopyToClipboard(NbtClipboardData data) { NbtClipboardDataMac dataItem = new NbtClipboardDataMac(data); NSPasteboard pasteboard = NSPasteboard.GeneralPasteboard; pasteboard.ClearContents(); pasteboard.WriteObjects(new NSPasteboardReading[] { dataItem }); }
private bool setToPasteboard(IntPtr handle) { if (handle == IntPtr.Zero) { return(false); } generalPasteboard.ClearContents(); generalPasteboard.WriteObjects(NSArray.ArrayWithObject(handle)); return(true); }
public static void WriteObject(this NSPasteboard pboard, INSPasteboardWriting pasteboardWriting) { pboard.WriteObjects(new INSPasteboardWriting[] { pasteboardWriting }); }
public override void SetText(string selectedText) { generalPasteboard.ClearContents(); generalPasteboard.WriteObjects(NSArray.ArrayWithObject(Cocoa.ToNSString(selectedText))); }
public override void Apply(NSPasteboard pasteboard, string type) => pasteboard.WriteObjects(Values);