this.Dispatcher.Invoke(
System.Windows.Threading.DispatcherPriority.Normal, //WPF中跨线程访问控件的方法
new Action(() =>
{
t_txt_cardnumber.Text = PublicClass.GetInstance().CardNumber;          //这两句是代码块
PublicClass.GetInstance().CardNumber = "";
}));

 

这段代码是看别人写的代码中,跨线程访问的方法,目前还没发现问题。如果有高手知道这样用的憋端,或正确的使用方法,还希望可以留言指正一下,谢谢啦。

相关文章:

  • 2022-02-08
  • 2022-12-23
  • 2021-10-12
  • 2022-02-06
  • 2021-10-26
  • 2021-05-18
  • 2021-11-24
猜你喜欢
  • 2021-09-19
  • 2021-10-18
  • 2021-11-27
  • 2021-08-02
  • 2022-12-23
  • 2021-11-03
相关资源
相似解决方案