Skip to content

Commit 3f1c35f

Browse files
committed
Add Escape key navigation and update status panel behavior
Added MainGrid KeyDown handler to support Escape key for back navigation in ContentFrame. Updated ClearStatus_Click to collapse DimmerStatusPanel. Introduced new XAML namespace for custom views and included commented-out code for future SmokeViewQueueGrid integration. Minor XAML improvements for maintainability.
1 parent d8c640a commit 3f1c35f

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

Dimmer/Dimmer.WinUI/Views/DimmerWin.xaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@
1111
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
1212
Title="DimmerWin"
1313
Activated="Window_Activated"
14+
xmlns:localViews="using:Dimmer.WinUI.Views.CustomViews.WinuiViews"
1415
Closed="DimmerWindowClosed"
1516
SizeChanged="Window_SizeChanged"
17+
1618
mc:Ignorable="d">
1719

1820

1921

2022

21-
<Grid x:Name="MainGrid" Background="Transparent">
23+
<Grid x:Name="MainGrid" Background="Transparent"
24+
KeyDown="MainGrid_KeyDown">
2225
<Grid.RowDefinitions>
2326
<RowDefinition Height="auto" />
2427
<RowDefinition Height="auto" />
@@ -72,6 +75,9 @@
7275
x:Name="ContentFrame"
7376
Grid.Row="2"
7477
x:FieldModifier="Public" />
78+
79+
<!--<localViews:SmokeViewQueueGrid x:Name="SmokeGrid" Visibility="Collapsed" DismissRequested="SmokeGrid_DismissRequested"
80+
Loaded="SmokeGrid_Loaded"/>-->
7581

7682
</Grid>
7783
</Window>

Dimmer/Dimmer.WinUI/Views/DimmerWin.xaml.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private void Window_SizeChanged(object sender, WindowSizeChangedEventArgs args)
121121
Debug.WriteLine($"New window size: {args.Size.Width} x {args.Size.Height}");
122122
}
123123

124-
DesktopAcrylicController m_acrylicController;
124+
125125
SystemBackdropConfiguration m_configurationSource;
126126

127127
private void SetConfigurationSourceTheme()
@@ -157,7 +157,7 @@ private void DimmerStatusTextBlock_Loaded(object sender, RoutedEventArgs e)
157157

158158
private void ClearStatus_Click(object sender, RoutedEventArgs e)
159159
{
160-
MyViewModel.HideIndeterminateProgressBar();
160+
DimmerStatusPanel.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed;
161161
}
162162

163163
private void TopMediaControlSection_Loaded(object sender, RoutedEventArgs e)
@@ -181,4 +181,28 @@ private void DimmerStatusPanel_Loaded(object sender, RoutedEventArgs e)
181181
{
182182
MyViewModel.DimmerStatusPanel = DimmerStatusPanel;
183183
}
184+
185+
private void MainGrid_KeyDown(object sender, KeyRoutedEventArgs e)
186+
{
187+
var pressedKey = e.Key;
188+
if (pressedKey == Windows.System.VirtualKey.Escape)
189+
{
190+
if (ContentFrame.CanGoBack)
191+
{
192+
ContentFrame.GoBack();
193+
}
194+
}
195+
}
196+
197+
//private void SmokeGrid_Loaded(object sender, RoutedEventArgs e)
198+
//{
199+
// SmokeGrid.SetBaseViewModelWin(MyViewModel);
200+
201+
// AnimationHelper.TryStart(
202+
// SmokeGrid, null,
203+
// AnimationHelper.Key_ToViewQueue
204+
// );
205+
206+
//}
207+
184208
}

0 commit comments

Comments
 (0)