Coproject - a RIA Caliburn.Micro demo, part 10.5

来源:互联网 发布:罗曼电动牙刷知乎 编辑:程序博客网 时间:2024/05/22 06:27

If you watched CPU usage after implementing BusyIndicator, you might notice major increase in CPU usage on To do module after the list is loaded for the first time.

High CPU usage with BusyIndicator and ProgressBar

It is a common issue with BusyIndicator: Silverlight forum, Silverlight toolkit issue, Appsolo blog but the solution is not obvious or easy to find. So I’ve spent some time and figured out that the excessive CPU usage is caused by ProgressBar that is present in BusyIndicator. After googling for a while, I ran into this forum but that was all about it. Fortunately, recently I saw Silveright TV episode 57. I strongly recommend to watch the video.

Now, let's apply the new knowledge on Coproject. Edit App.xaml.cs

private void Application_Startup(object sender, StartupEventArgs e){        Application.Current.Host.Settings.EnableRedrawRegions = true;}

Run the application and reload the list (be careful if you have epilepsy!). As you can see, we have a problem.

Now, let's do what was suggested in the video. So, edit ShellView to begin as follows:

<Grid x:Name="LayoutRoot">        <Border Style="{StaticResource ContentBorderStyle}">                <ContentControl Style="{StaticResource LogoIcon}"/>        </Border>        <Border Style="{StaticResource LeftBorderStyle}"/>        <TextBlock Text="Coproject" Style="{StaticResource ApplicationTitleStyle}" />        ...

And then just update LeftBorderStyle in Custom.xaml:

<Style x:Key="LeftBorderStyle" BasedOn="{StaticResource LinksBorderStyle}" TargetType="Border">        <Setter Property="Margin" Value="10,135,25,0"/></Style>

Run the application again and you should see we're fine now.

0 0
原创粉丝点击