internal static void Store(NSPasteboard pboard, object data, int id) { if (id == 0) { pboard.ClearContents(); managed.Clear(); providers.Clear(); return; } if (data == null) { return; } var name = DataFormats.GetFormat(id)?.Name ?? String.Empty; if (name == Clipboard.IDataObjectFormat) { managed[name] = data; var provider = new DataObjectProvider((IDataObject)data); var item = new NSPasteboardItem(); item.SetDataProviderForTypes(provider, provider.Types); pboard.WriteObject(item); providers.Add(provider); // Set flag that clipboard contains our data // Do it as the last step, to avoid fooling the FileMaker (and possibly other apps). pboard.SetStringForType(name, name); } }