Improve launch performance by delay loading NavigationView (#1213)
* Delay load graph engine * Remove default behavior * Delay load nav view * Add automation properties * clean up * handle shortcut keys * Include only navview changes * Address PR comments * manual merge fix * PR Changes * Undo other changes * reset resw file * fix margin
This commit is contained in:
parent
c1fefd3a7b
commit
f2e423329d
@ -249,7 +249,7 @@
|
|||||||
<x:Double x:Key="CalcOperatorCaptionSize">14</x:Double>
|
<x:Double x:Key="CalcOperatorCaptionSize">14</x:Double>
|
||||||
<x:Double x:Key="CalcOperatorTextIconCaptionSize">16</x:Double>
|
<x:Double x:Key="CalcOperatorTextIconCaptionSize">16</x:Double>
|
||||||
|
|
||||||
<!-- White and black color brushes used for the Utils::GetContrastColor-->
|
<!-- White and black color brushes used for the Utils::GetContrastColor -->
|
||||||
<SolidColorBrush x:Key="WhiteBrush" Color="White"/>
|
<SolidColorBrush x:Key="WhiteBrush" Color="White"/>
|
||||||
<SolidColorBrush x:Key="BlackBrush" Color="Black"/>
|
<SolidColorBrush x:Key="BlackBrush" Color="Black"/>
|
||||||
|
|
||||||
|
@ -513,6 +513,12 @@ void KeyboardShortcutManager::OnKeyDownHandler(CoreWindow ^ sender, KeyEventArgs
|
|||||||
const auto& lookupMap = GetCurrentKeyDictionary(static_cast<MyVirtualKey>(key));
|
const auto& lookupMap = GetCurrentKeyDictionary(static_cast<MyVirtualKey>(key));
|
||||||
auto buttons = lookupMap.equal_range(static_cast<MyVirtualKey>(key));
|
auto buttons = lookupMap.equal_range(static_cast<MyVirtualKey>(key));
|
||||||
auto navView = buttons.first->second.Resolve<MUXC::NavigationView>();
|
auto navView = buttons.first->second.Resolve<MUXC::NavigationView>();
|
||||||
|
|
||||||
|
if (navView == nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto appViewModel = safe_cast<ApplicationViewModel ^>(navView->DataContext);
|
auto appViewModel = safe_cast<ApplicationViewModel ^>(navView->DataContext);
|
||||||
appViewModel->Mode = ViewMode::Date;
|
appViewModel->Mode = ViewMode::Date;
|
||||||
auto categoryName = AppResourceProvider::GetInstance()->GetResourceString(L"DateCalculationModeText");
|
auto categoryName = AppResourceProvider::GetInstance()->GetResourceString(L"DateCalculationModeText");
|
||||||
|
@ -118,6 +118,49 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Row="1"
|
||||||
|
Height="{StaticResource HamburgerHeight}"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Top">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="{StaticResource HamburgerHeightGridLength}"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="1"
|
||||||
|
Margin="8,0,0,0"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<TextBlock x:Name="Header"
|
||||||
|
Margin="0,-3,0,0"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource CategoryNameTextBlockStyle}"
|
||||||
|
Text="{x:Bind Model.CategoryName, Mode=OneWay}"
|
||||||
|
Visibility="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"/>
|
||||||
|
<controls:PreviewTagControl Margin="10,0,0,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Visibility="{x:Bind Model.IsModePreview, Mode=OneWay}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<Button x:Name="NormalAlwaysOnTopButton"
|
||||||
|
x:Uid="EnterAlwaysOnTopButton"
|
||||||
|
Grid.Column="2"
|
||||||
|
Margin="10,0,0,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalContentAlignment="Center"
|
||||||
|
Style="{StaticResource SquareIconButtonStyle}"
|
||||||
|
Background="Transparent"
|
||||||
|
FontFamily="{StaticResource CalculatorFontFamily}"
|
||||||
|
AutomationProperties.AutomationId="NormalAlwaysOnTopButton"
|
||||||
|
Click="AlwaysOnTopButtonClick"
|
||||||
|
Content=""
|
||||||
|
Visibility="{x:Bind Model.DisplayNormalAlwaysOnTopOption, Mode=OneWay}">
|
||||||
|
<Button.KeyboardAccelerators>
|
||||||
|
<KeyboardAccelerator Key="Up" Modifiers="Menu"/>
|
||||||
|
</Button.KeyboardAccelerators>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<muxc:NavigationView x:Name="NavView"
|
<muxc:NavigationView x:Name="NavView"
|
||||||
x:Uid="NavView"
|
x:Uid="NavView"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
@ -136,12 +179,13 @@
|
|||||||
PaneOpening="OnNavPaneOpening"
|
PaneOpening="OnNavPaneOpening"
|
||||||
SelectionChanged="OnNavSelectionChanged"
|
SelectionChanged="OnNavSelectionChanged"
|
||||||
TabIndex="1"
|
TabIndex="1"
|
||||||
UseSystemFocusVisuals="True">
|
UseSystemFocusVisuals="True"
|
||||||
|
x:Load="False">
|
||||||
|
|
||||||
<muxc:NavigationView.PaneFooter>
|
<muxc:NavigationView.PaneFooter>
|
||||||
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
|
||||||
<muxc:NavigationViewList x:Name="NavFooter"
|
<muxc:NavigationViewList x:Name="NavFooter"
|
||||||
Width="{x:Bind NavView.OpenPaneLength, Mode=Oneway}"
|
Width="{StaticResource SplitViewOpenPaneLength}"
|
||||||
IsItemClickEnabled="True"
|
IsItemClickEnabled="True"
|
||||||
ItemClick="OnAboutButtonClick"
|
ItemClick="OnAboutButtonClick"
|
||||||
x:Load="False">
|
x:Load="False">
|
||||||
@ -170,41 +214,6 @@
|
|||||||
</muxc:NavigationViewList>
|
</muxc:NavigationViewList>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</muxc:NavigationView.PaneFooter>
|
</muxc:NavigationView.PaneFooter>
|
||||||
<Grid Height="{StaticResource HamburgerHeight}" VerticalAlignment="Top">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<StackPanel Margin="48,0,0,0" Orientation="Horizontal">
|
|
||||||
<TextBlock x:Name="Header"
|
|
||||||
Margin="0,-3,0,0"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Style="{StaticResource CategoryNameTextBlockStyle}"
|
|
||||||
Text="{x:Bind Model.CategoryName, Mode=OneWay}"
|
|
||||||
Visibility="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"/>
|
|
||||||
<controls:PreviewTagControl Margin="10,0,0,0"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Visibility="{x:Bind Model.IsModePreview, Mode=OneWay}"/>
|
|
||||||
</StackPanel>
|
|
||||||
<Button x:Name="NormalAlwaysOnTopButton"
|
|
||||||
x:Uid="EnterAlwaysOnTopButton"
|
|
||||||
Grid.Column="1"
|
|
||||||
Margin="10,0,0,0"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
HorizontalContentAlignment="Center"
|
|
||||||
Style="{StaticResource SquareIconButtonStyle}"
|
|
||||||
Background="Transparent"
|
|
||||||
FontFamily="{StaticResource CalculatorFontFamily}"
|
|
||||||
AutomationProperties.AutomationId="NormalAlwaysOnTopButton"
|
|
||||||
Click="AlwaysOnTopButtonClick"
|
|
||||||
Content=""
|
|
||||||
Visibility="{x:Bind Model.DisplayNormalAlwaysOnTopOption, Mode=OneWay}">
|
|
||||||
<Button.KeyboardAccelerators>
|
|
||||||
<KeyboardAccelerator Key="Up" Modifiers="Menu"/>
|
|
||||||
</Button.KeyboardAccelerators>
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
|
||||||
</muxc:NavigationView>
|
</muxc:NavigationView>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
|
@ -270,12 +270,14 @@ void MainPage::OnPageLoaded(_In_ Object ^, _In_ RoutedEventArgs ^ args)
|
|||||||
|
|
||||||
// Delay load things later when we get a chance.
|
// Delay load things later when we get a chance.
|
||||||
this->Dispatcher->RunAsync(
|
this->Dispatcher->RunAsync(
|
||||||
CoreDispatcherPriority::Normal, ref new DispatchedHandler([]() {
|
CoreDispatcherPriority::Normal, ref new DispatchedHandler([this]() {
|
||||||
if (TraceLogger::GetInstance()->IsWindowIdInLog(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())))
|
if (TraceLogger::GetInstance()->IsWindowIdInLog(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())))
|
||||||
{
|
{
|
||||||
AppLifecycleLogger::GetInstance().LaunchUIResponsive();
|
AppLifecycleLogger::GetInstance().LaunchUIResponsive();
|
||||||
AppLifecycleLogger::GetInstance().LaunchVisibleComplete();
|
AppLifecycleLogger::GetInstance().LaunchVisibleComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->FindName(L"NavView");
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
Loading…
Reference in New Issue
Block a user