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

标签 .net wpf windows remote-desktop

在我们的场景中,我们有一个用户通过远程桌面使用的 wpf 应用程序,我们发现用户体验非常慢。

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

最佳答案

对于渐变,它不像多个渲染层那么严重,例如,如果您有一堆嵌套控件,它们都是部分不透明的。通过WPF看一看Performance Optimization提供指南。那里有很多信息需要消化,但有关于渲染的提示和 performance tools您绝对应该能够做出一些改进。

更新:
Jamie Rodriguez将在 Microsoft 发布一些关于 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

关于.net - 通过远程桌面提高 WPF 应用程序速度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1005497/

相关文章:

java - 最流行的 Android 主机操作系统是什么?

wpf - 按钮对 .Net 4 日历无响应(错误?)

c# - WPF 创建自己的类型

c - 获取当前控制台大小

c# - 有没有 BDD 的成功案例?

c# - 在.NET中在运行时合并自定义配置节

mysql - 在 mysql 中随机检索项目时使用什么确切的代码?

.net - 更改选定和不集中的列表框样式,使其不灰显

c++ - 在 ATL 项目中将 NULL 指针传递给进程外 COM 方法的正确方法

windows - 获取文件的扇区位置