Ejemplo n.º 1
0
        public void NSPasteboardTests_WriteObjectTests()
        {
            NSPasteboard b = NSPasteboard.CreateWithUniqueName();

            b.WriteObjects(new INSPasteboardWriting [] { (NSString)"asfd" });
            b.WriteObjects(new NSPasteboardWriting [] { new MyPasteboard() });
        }
Ejemplo n.º 2
0
        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
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        public static void CopyToClipboard(string text)
        {
            NSPasteboard clipboard = NSPasteboard.GeneralPasteboard;

            clipboard.ClearContents();
            clipboard.WriteObjects(new NSString[] { (NSString)text });
        }
Ejemplo n.º 5
0
        /// <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 });
        }
Ejemplo n.º 8
0
        private bool setToPasteboard(IntPtr handle)
        {
            if (handle == IntPtr.Zero)
            {
                return(false);
            }

            generalPasteboard.ClearContents();
            generalPasteboard.WriteObjects(NSArray.ArrayWithObject(handle));
            return(true);
        }
Ejemplo n.º 9
0
 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)));
 }
Ejemplo n.º 11
0
 public override void Apply(NSPasteboard pasteboard, string type) => pasteboard.WriteObjects(Values);