提高WPF应用程序的速度比远程桌面?应用程序、远程桌面、速度、WPF

2023-09-03 11:40:57 作者:你是我的唯一

在我们的场景中,我们所使用的用户通过远程桌面WPF应用程序,我们发现用户体验是很慢的。

In our scenario, we have a wpf application that is used by users over remote desktop, and we found the user experience is very slow.

为改善这种情况下,用户的体验有什么建议?有一点可能是禁止任何动画/故事板,并避免使用梯度的UI。更多的想法是AP preciated。

Any suggestions for improving the user experience in this scenario? One point might be to disable any animation/storyboards, and avoid using gradients in the UI. More thoughts are appreciated.

推荐答案

有关梯度它不是尽可能多的一个问题,因为多个渲染层,例如,如果你有一堆嵌套控制所有部分不透明的。以通过WPF 性能优化指导可用来看看。有很多在那里的信息来消化,但对呈现在那里的提示和性能工具你一定能够做出一些改进。

For gradients it's not as much of an issue as multiple rendering layers, such as if you have a bunch of nested controls all partially opaque. Take a look through the WPF Performance Optimization guides available. There's a lot of information in there to digest, but with the tips on rendering in there and the performance tools you should definitely be able to make some improvements.

更新: 杰米·罗德里格斯将发布一些在微软的WPF的内部讨论中。有一个新的后的今天,当远程处理,其中包括对性能提示和讨论。

UPDATE: Jamie Rodriguez will post some of the internal discussions on WPF at Microsoft. There was a new post today, that includes tips and discussions on performance when remoting.

WPF,因为WPF 3.5 SP1的所有版本都远程连接(包括使用远程桌面和终端服务器)使用位图远程处理。

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:

  在应用程序使用WPF的软件光栅呈现在服务器上   在应用程序运行时,服务器跟踪哪些应用程序的窗口区域是新很脏,需要更新   当一个区域需要更新,服务器创建pssed只是脏区位图一个COM $ P $和发送到客户端   一旦客户端已经引起了位图在其自己的窗口中适当的位置,客户端窗口是由最新的    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   举例来说,这是完全隐藏在其他不透明元素的动画还是会造成脏区失效/位图的产生发生。从你的应用程序中删除这些。      关闭尽可能多的动画尽可能   对于那些不能被完全消除的动画,使用DesiredFramerate属性降低动画帧率      运行在TS应用程序应有利于纯色比渐变或其他外来填充(不需要的图像等),特别是对那些会经常重绘申请件       BitmapEffects /效果/ ShaderEffects,特别是模糊和阴影的大半径,在软件相当缓慢    3D - 三维软件光栅比渲染硬件慢得多