Skip to content

Commit

Permalink
perf: 惰性加载开发者选项
Browse files Browse the repository at this point in the history
  • Loading branch information
Blinue committed Nov 15, 2023
1 parent bdca371 commit 5f269b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/Magpie.App/AboutPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace winrt::Magpie::App::implementation {

void AboutPage::VersionTextBlock_DoubleTapped(IInspectable const&, Input::DoubleTappedRoutedEventArgs const&) {
// 按住 Alt 键双击版本号即可启用开发者模式
if (!_viewModel.IsDeveloperMode() && (GetAsyncKeyState(VK_MENU) & 0x8000)) {
_viewModel.IsDeveloperMode(true);

Expand Down
3 changes: 3 additions & 0 deletions src/Magpie.App/SettingsPage.idl
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ namespace Magpie.App {
SettingsPage();

SettingsViewModel ViewModel { get; };

// https://github.com/microsoft/microsoft-ui-xaml/issues/7579
void UnloadObject(Windows.UI.Xaml.DependencyObject object);
}
}
16 changes: 9 additions & 7 deletions src/Magpie.App/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingsCard.ActionContent>
</local:SettingsCard>
<muxc:InfoBar x:Uid="Settings_General_RequireRestart"
<muxc:InfoBar x:Name="RequireRestartInfoBar"
x:Uid="Settings_General_RequireRestart"
Margin="0,2,0,0"
x:Load="{x:Bind ViewModel.RequireRestart, Mode=OneWay}"
IsClosable="False"
IsOpen="True"
Severity="Warning"
Visibility="{x:Bind ViewModel.RequireRestart, Mode=OneWay}">
Severity="Warning">
<muxc:InfoBar.ActionButton>
<Button x:Uid="Settings_General_RequireRestart_ActionButton"
HorizontalAlignment="Right"
Expand Down Expand Up @@ -142,12 +143,13 @@
</local:SettingsCard.ActionContent>
</local:SettingsCard>
</local:SettingsGroup>
<muxc:Expander Margin="0,0,0,2"
<muxc:Expander x:Name="DeveloperModeExpander"
Margin="0,0,0,2"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
IsExpanded="{x:Bind ViewModel.IsDeveloperMode, Mode=OneTime}"
Style="{StaticResource SettingExpanderStyle}"
Visibility="{x:Bind ViewModel.IsDeveloperMode, Mode=OneWay}">
x:Load="{x:Bind ViewModel.IsDeveloperMode, Mode=OneWay}"
IsExpanded="True"
Style="{StaticResource SettingExpanderStyle}">
<muxc:Expander.Header>
<local:SettingsCard x:Uid="Settings_DeveloperOptions"
Style="{StaticResource ExpanderHeaderSettingStyle}">
Expand Down

0 comments on commit 5f269b0

Please sign in to comment.