diff --git a/src/TeamsISO.App.WinUI/Views/MainWindow.xaml b/src/TeamsISO.App.WinUI/Views/MainWindow.xaml index 788fc85..40677ed 100644 --- a/src/TeamsISO.App.WinUI/Views/MainWindow.xaml +++ b/src/TeamsISO.App.WinUI/Views/MainWindow.xaml @@ -3,7 +3,8 @@ x:Class="TeamsISO.App.WinUI.Views.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:models="using:TeamsISO.App.WinUI.Models"> + xmlns:models="using:TeamsISO.App.WinUI.Models" + xmlns:views="using:TeamsISO.App.WinUI.Views"> + + + + + + + + + + + + + + + + + + + + + + + /// Toggle the settings drawer with a slide animation. The drawer is + /// pre-translated 400px off the right edge in XAML; the storyboard + /// animates X back to 0 to slide it in. Hit-testing is gated so the + /// off-screen drawer doesn't intercept clicks on the participants list. + /// + private void OnSettingsClick(object sender, RoutedEventArgs e) + { + if (_drawerOpen) + { + CloseDrawer(); + } + else + { + OpenDrawer(); + } + } + + private void OpenDrawer() + { + if (_drawerOpen) return; + _drawerOpen = true; + SettingsDrawerHost.IsHitTestVisible = true; + var sb = (Microsoft.UI.Xaml.Media.Animation.Storyboard)((Microsoft.UI.Xaml.Controls.Grid)Content) + .Resources["DrawerSlideIn"]; + sb.Begin(); + SettingsDrawerHost.CloseRequested -= OnDrawerCloseRequested; + SettingsDrawerHost.CloseRequested += OnDrawerCloseRequested; + } + + private void CloseDrawer() + { + if (!_drawerOpen) return; + _drawerOpen = false; + var sb = (Microsoft.UI.Xaml.Media.Animation.Storyboard)((Microsoft.UI.Xaml.Controls.Grid)Content) + .Resources["DrawerSlideOut"]; + sb.Completed += (_, _) => SettingsDrawerHost.IsHitTestVisible = false; + sb.Begin(); + } + + private void OnDrawerCloseRequested(object? sender, System.EventArgs e) => CloseDrawer(); + /// /// Push a resolved theme to the visual tree and to the AppWindow /// title-bar buttons. Called on every