【发布时间】:2011-01-15 07:46:56
【问题描述】:
我正在开发 WPF 应用程序,客户端报告 CPU 使用率极高 (90%)(而我无法重复该行为)。我已经将 bootleneck 追溯到这些行。它是用于小型单个 LED 控制(闪烁 LED)的简单发光动画。这个简单的动画占用如此巨大的 CPU 资源的原因是什么?
<Trigger Property="State">
<Trigger.Value>
<local:BlinkingLedStatus>Blinking</local:BlinkingLedStatus>
</Trigger.Value>
<Trigger.EnterActions>
<BeginStoryboard Name="beginStoryBoard">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="glow" Storyboard.TargetProperty="Opacity" AutoReverse="True" From="0.0" To="1.0" Duration="0:0:0.5" RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<StopStoryboard BeginStoryboardName="beginStoryBoard"/>
</Trigger.ExitActions>
</Trigger>
【问题讨论】:
标签: c# wpf animation cpu-usage