I am working on a universal Windows 10 application. At the moment I have a background task that starts after the user receives a notification. The purpose of this BG task is to copy the contents of the notification. The problem is that the Clipboard.setcontent method looks like a single-threaded rather than a multi-threaded BG task. I tried using the corewindow manager, but it didn’t work, I also tried using tasks. Can someone point me to a solution?
eg. The following code in a background task throws an Activating a single-threaded class from MTA is not supported (Exception from HRESULT: 0x8000001D) .
var dataPackage = new DataPackage { RequestedOperation = DataPackageOperation.Copy }; dataPackage.SetText("Hello World!"); Clipboard.SetContent(dataPackage);
source share