我正在使用http://www.codeproject.com/KB/IP/Facebook_API.aspx
调用线程必须是STA,因为许多UI组件都需要这个.
我不知道该怎么办.我想这样做:
FacebookApplication.FacebookFriendsList ffl = new FacebookFriendsList();
Run Code Online (Sandbox Code Playgroud)
但它给了我这个错误.
我添加了一个后台工作者:
static BackgroundWorker bw = new BackgroundWorker();
static void Main(string[] args)
{
bw.DoWork += bw_DoWork;
bw.RunWorkerAsync("Message to worker");
Console.ReadLine();
}
static void bw_DoWork(object sender, DoWorkEventArgs e)
{
// This is called on the worker thread
FacebookApplication.FacebookFriendsList ffl = new FacebookFriendsList();
Console.WriteLine(e.Argument); // Writes "Message to worker"
// Perform time-consuming task...
}
Run Code Online (Sandbox Code Playgroud) 我正在创建一个xps文档,如下所示.
Assembly assembly = Assembly.GetExecutingAssembly();
//read embedded xpsDocument file
Stream helpStream = assembly.GetManifestResourceStream(resourceNameOfContext);
if (helpStream != null)
{
Package package = Package.Open(helpStream);
string inMemoryPackageName = "memorystream://" + topicName + ".xps";
Uri packageUri = new Uri(inMemoryPackageName);
//Add package to PackageStore
PackageStore.AddPackage(packageUri, package);
docXps = new XpsDocument(package, CompressionOption.Maximum, inMemoryPackageName);
}
return docXps;
Run Code Online (Sandbox Code Playgroud)
当我想要获取docXps.GetFixedDocumentSequence(); 我收到了上述错误.有人可以帮忙吗?
谢谢,