方法A:
Action f = () =>
{
txtProcess.Text = "开始更新程序...";
};
方法B:
this.Dispatcher.Invoke((Action)delegate
{
this.loginBusyIndicator.IsBusy = false;
loginImg.Opacity = 1;
});
或
this.Dispatcher.Invoke((Action)(()=>
{
this.loginBusyIndicator.IsBusy = false;
loginImg.Opacity = 1;
}));
总结:Action与delegate或Lambda表达式的组合,可以方便的处理跨线程操作的问题。