Tôi đang sử dụng http://www.codeproject.com/KB/IP/Facebook_API.aspxCác thread gọi phải STA, vì nhiều thành phần giao diện người dùng yêu cầu này
Tôi cố gắng để gọi XAML mà được tạo ra sử dụng WPF. Nhưng nó cho tôi một lỗi:
The calling thread must be STA, because many UI components require this.
Tôi không biết phải làm gì. Tôi đang cố gắng thực hiện việc này:
FacebookApplication.FacebookFriendsList ffl = new FacebookFriendsList();
Nhưng điều đó gây ra lỗi cho tôi.
tôi đã thêm một nhân viên nền:
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...
}
Tôi đã thử thêm nó, như trên, nhưng nó vẫn cho tôi lỗi:/ –
Tôi không phải là familliar với mã. Bạn có thể gỡ lỗi thông qua và tìm ra chính xác các dòng mã gây ra điều này? –