-1
我創建了一個小應用程序。我創建可觀察收集的字符串和工作(石英)每5秒我添加新的項目在我的收藏,但用戶界面不更新。請幫助c#石英更新UI
public partial class MainWindow : Window
{
public ObservableCollection<string> Products { get; set; }
//my logic.....
public void UpdateCol()
{
Products.Add("2");
}
}
public class Test:IJob
{
public void Execute(IJobExecutionContext context)
{
//How call method from UpdateCol from MainWindow????
}
}
另一個類(測試),如果我創建的窗口,我得到exeption約線程ST Execute調用一個 – user3351644
該窗口應該首先在主界面線程中創建。 – ghord
可以給我看樣品嗎? – user3351644