在 UWP 中单击汉堡菜单项时如何提高应用程序性能?

问题描述

我在 UWP 应用程序中为 MVVM 和汉堡菜单使用模板 10。通常从页面到页面导航需要 2 到 3 秒。当App在后台超过5小时,然后回到前台,页面导航需要8秒。如何减少页面到页面导航的延迟?

菜单项的 XAML 代码:

```<Controls:HamburgerButtonInfo ClearHistory="True" x:Name="manifest" Selected="manifest_Selected" Unselected="manifest_Unselected" PageType="views:Manifest">
                <StackPanel Orientation="Horizontal">
                    <BitmapIcon Width="30" Height="30" x:Name="manifesticon" Margin="10,20,0" UriSource="ms-appx:///Assets/ic_menu_manifest.png"/>
                    <TextBlock Margin="16,0" x:Name="manifesttext"
                           VerticalAlignment="Center"
                           Text="Manifest" />
                </StackPanel>
   </Controls:HamburgerButtonInfo>```

CS 代码:

public void manifest_Selected(object sender,RoutedEventArgs e)
    {
        reportElement = new HamburgerButtonInfo();
        manifesticon.Foreground = (Brush)Application.Current.Resources["HeaderBackground"];
        manifesttext.Foreground = (Brush)Application.Current.Resources["HeaderBackground"];
        reportElement = manifest;
        if (report.IsEnabled)
        {
            report_Unselected(sender,e);
        }
    }

    public void manifest_Unselected(object sender,RoutedEventArgs e)
    {
        manifesticon.Foreground = new SolidColorBrush(Color.FromArgb(255,229,229));
        manifesttext.Foreground = new SolidColorBrush(Color.FromArgb(255,229));
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)