WPFC#.net 跨线程更新UI 线程测试 解决界面卡死

上传者: sos88888 | 上传时间: 2019-12-21 21:09:18 | 文件大小: 63KB | 文件类型: rar
Demo测试跨线更新UI 第一种 : Thread 达到跨线程更新UI 虽然使用Dispatcher.Invoke 和模拟winform 里面的DoEvent 但是运行中关闭还是会有异常,而且耗资源高; 第二种 : DispatcherTimer 失败:UI还是会卡顿; 第三种 : Timer 建议使用、资源占用少,关闭启动自如。

文件下载

资源详情

[{"title":"( 43 个子文件 63KB ) WPFC#.net 跨线程更新UI 线程测试 解决界面卡死","children":[{"title":"WpfApplication1","children":[{"title":"WpfApplication1","children":[{"title":"bin","children":[{"title":"Debug","children":[{"title":"WpfApplication1.vshost.exe.config <span style='color:#111;'> 187B </span>","children":null,"spread":false},{"title":"WpfApplication1.exe <span style='color:#111;'> 12.50KB </span>","children":null,"spread":false},{"title":"WpfApplication1.vshost.exe.manifest <span style='color:#111;'> 490B </span>","children":null,"spread":false},{"title":"WpfApplication1.vshost.exe <span style='color:#111;'> 22.45KB </span>","children":null,"spread":false},{"title":"WpfApplication1.pdb <span style='color:#111;'> 43.50KB </span>","children":null,"spread":false},{"title":"WpfApplication1.exe.config <span style='color:#111;'> 187B </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"App.xaml <span style='color:#111;'> 326B </span>","children":null,"spread":false},{"title":"obj","children":[{"title":"Debug","children":[{"title":"WpfApplication1_MarkupCompile.i.cache <span style='color:#111;'> 337B </span>","children":null,"spread":false},{"title":"App.g.i.cs <span style='color:#111;'> 2.27KB </span>","children":null,"spread":false},{"title":"WpfApplication1.csproj.FileListAbsolute.txt <span style='color:#111;'> 1.61KB </span>","children":null,"spread":false},{"title":"WpfApplication1.g.resources <span style='color:#111;'> 1.85KB </span>","children":null,"spread":false},{"title":"TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs <span style='color:#111;'> 0B </span>","children":null,"spread":false},{"title":"App.g.cs <span style='color:#111;'> 2.27KB </span>","children":null,"spread":false},{"title":"Window1.g.i.cs <span style='color:#111;'> 2.94KB </span>","children":null,"spread":false},{"title":"Window1.g.cs <span style='color:#111;'> 2.94KB </span>","children":null,"spread":false},{"title":"WpfApplication1.exe <span style='color:#111;'> 12.50KB </span>","children":null,"spread":false},{"title":"WpfApplication1.Properties.Resources.resources <span style='color:#111;'> 180B </span>","children":null,"spread":false},{"title":"DesignTimeResolveAssemblyReferencesInput.cache <span style='color:#111;'> 7.03KB </span>","children":null,"spread":false},{"title":"MainWindow.g.cs <span style='color:#111;'> 3.99KB </span>","children":null,"spread":false},{"title":"TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs <span style='color:#111;'> 0B </span>","children":null,"spread":false},{"title":"WpfApplication1_MarkupCompile.cache <span style='color:#111;'> 337B </span>","children":null,"spread":false},{"title":"WpfApplication1.csproj.GenerateResource.Cache <span style='color:#111;'> 917B </span>","children":null,"spread":false},{"title":"TempPE","children":null,"spread":false},{"title":"WpfApplication1.csprojResolveAssemblyReference.cache <span style='color:#111;'> 2.30KB </span>","children":null,"spread":false},{"title":"WpfApplication1.pdb <span style='color:#111;'> 43.50KB </span>","children":null,"spread":false},{"title":"TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs <span style='color:#111;'> 0B </span>","children":null,"spread":false},{"title":"Window1.baml <span style='color:#111;'> 694B </span>","children":null,"spread":false},{"title":"MainWindow.g.i.cs <span style='color:#111;'> 3.99KB </span>","children":null,"spread":false},{"title":"MainWindow.baml <span style='color:#111;'> 933B </span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"Window1.xaml <span style='color:#111;'> 282B </span>","children":null,"spread":false},{"title":"App.xaml.cs <span style='color:#111;'> 342B </span>","children":null,"spread":false},{"title":"Window1.xaml.cs <span style='color:#111;'> 618B </span>","children":null,"spread":false},{"title":"WpfApplication1.csproj <span style='color:#111;'> 4.60KB </span>","children":null,"spread":false},{"title":"App.config <span style='color:#111;'> 187B </span>","children":null,"spread":false},{"title":"MainWindow.xaml <span style='color:#111;'> 522B </span>","children":null,"spread":false},{"title":"Properties","children":[{"title":"Resources.resx <span style='color:#111;'> 5.48KB </span>","children":null,"spread":false},{"title":"Settings.settings <span style='color:#111;'> 201B </span>","children":null,"spread":false},{"title":"AssemblyInfo.cs <span style='color:#111;'> 2.13KB </span>","children":null,"spread":false},{"title":"Settings.Designer.cs <span style='color:#111;'> 1.08KB </span>","children":null,"spread":false},{"title":"Resources.Designer.cs <span style='color:#111;'> 2.81KB </span>","children":null,"spread":false}],"spread":true},{"title":"MainWindow.xaml.cs <span style='color:#111;'> 3.18KB </span>","children":null,"spread":false},{"title":"DispatcherHelper.cs <span style='color:#111;'> 899B </span>","children":null,"spread":false}],"spread":false},{"title":"WpfApplication1.v11.suo <span style='color:#111;'> 21.50KB </span>","children":null,"spread":false},{"title":"WpfApplication1.sln <span style='color:#111;'> 935B </span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

  • qq_39110534 :
    就这 你也让别人下载?
    2020-04-03
  • 记录自我迭代的苦与乐 :
    CSDN下载的代码质量越来越差了。例子中的第一条:托管启用非托管的,当然耗资源;第二条: DispatcherTimer 与 Dispatcher 运行于相同的线程,也就是:DispatcherTim
    2020-03-24
  • kelyon :
    例子简单易懂,刚好用上。其实类似于UI更新和线程之类的问题,可以加一个sleep就可以减少卡顿或资源抢夺的问题
    2016-10-14
  • dhm166 :
    很好的解决了我的问题
    2016-06-23
  • momian4374 :
    学习了,刚好近期用得上
    2016-05-25

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明