加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

.net – 通过远程桌面提高WPF应用程序速度?

发布时间:2020-12-14 02:06:53 所属栏目:Windows 来源:网络整理
导读:在我们的场景中,我们有一个用户通过远程桌面使用的wpf应用程序,我们发现用户体验非常慢. 有关在这种情况下改善用户体验的任何建议吗?一点可能是禁用任何动画/故事板,并避免在UI中使用渐变.感谢更多的想法. 解决方法 对于渐变,它不像多个渲染层那么多,例如,
在我们的场景中,我们有一个用户通过远程桌面使用的wpf应用程序,我们发现用户体验非常慢.

有关在这种情况下改善用户体验的任何建议吗?一点可能是禁用任何动画/故事板,并避免在UI中使用渐变.感谢更多的想法.

解决方法

对于渐变,它不像多个渲染层那么多,例如,如果你有一堆嵌套控件都是部分不透明的.查看 WPF Performance Optimization指南.那里有很多信息需要消化,但是有了渲染的提示和 performance tools,你一定能够做出一些改进.

更新:
Jamie Rodriguez将在微软发布一些关于WPF的内部讨论.今天有一个新帖子,其中包括performance when remoting的提示和讨论.

All versions of WPF since WPF 3.5 SP1 have remoted (both with Remote Desktop and Terminal Server) using Bitmap Remoting.

Bitmap remoting works as follows:

  • The application is rendered on the server using WPF’s software rasterizer
  • As the application runs,the server keeps track of which regions of the application’s window are newly dirty and need to be updated
  • When a region needs to be updated,the server creates a compressed bitmap of just the dirty region and sends that to the client
  • Once the client has drawn that bitmap to the appropriate place on its own window,the client window is up-to-date

Given how this remoting mechanism works,performance can be maximized in several ways:

  • Dirty regions should be kept as small as possible so the least amount of data is sent over the wire
  • Ambient animations should be turned off
    • For instance,setting a window background to an animating gradient would cause the entire window to be invalidated / redrawn every frame
  • The system does not optimize away occluded parts of the application
    • For instance,an animation that is completely hidden behind some other opaque element will still cause dirty region invalidation / bitmap generation to occur. Remove these from your application.
  • Dirty regions should be created as infrequently as possible
    • Turn off as many animations as possible
    • For those animations that can’t be eliminated completely,lower the animation framerate using the DesiredFramerate property
  • Dirty Region Bitmaps should be as simple as possible to maximize their compression
    • Application running over TS should favor solid colors over gradients or other exotic fills (unnecessary images,etc),especially for application pieces that will be redrawn frequently
  • Avoid operations that are especially slow when rendered in software
    • BitmapEffects / Effects / ShaderEffects,especially blurs and drop shadows with large radii,are quite slow in software
    • 3D – the 3D software rasterizer is substantially slower than rendering in hardware

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读