public void OnClosing(object sender, System.ComponentModel.CancelEventArgs e) { switch (_state) { case WindowViewState.Open: _state = WindowViewState.Closing; e.Cancel = true; Dialog.IsVisible = false; _mainViewModel.OnFullWindowClosed(); var window = (Window)sender; WindowAnimationLibrary.BeginWindowExitAnimation(window, () => { _state = WindowViewState.CloseReady; window.Close(); }); break; case WindowViewState.Closing: // Ignore any requests while playing the close animation. e.Cancel = true; break; case WindowViewState.CloseReady: // Accept the close. break; } }
private void OnStateChanged(object sender, object e) { switch (_viewModel.State) { case FlyoutViewState.Opening: var taskbar = WindowsTaskbar.Current; Show(); EnableAcrylicIfApplicable(taskbar); PositionWindowRelativeToTaskbar(taskbar); WindowAnimationLibrary.BeginWindowEntranceAnimation(this, () => { _viewModel.ChangeState(FlyoutViewState.Open); }); break; case FlyoutViewState.Closing_Stage1: WindowAnimationLibrary.BeginWindowExitAnimation(this, () => { this.Cloak(); AccentPolicyLibrary.DisableAcrylic(this); _viewModel.ChangeState(FlyoutViewState.Hidden); }); break; } }
private void CloseButton_Click(object sender, RoutedEventArgs e) { Trace.WriteLine("FullWindow CloseButton_Click"); if (!_isClosing) { // Ensure we don't double-animate if the user is able to close us multiple ways before the window stops accepting input. _isClosing = true; WindowAnimationLibrary.BeginWindowExitAnimation(this, () => this.Close()); } }
public void SafeClose() { Trace.WriteLine("SettingsWindow SafeClose"); if (!_isClosing) { // Ensure we don't double-animate if the user is able to close us multiple ways before the window stops accepting input. _isClosing = true; WindowAnimationLibrary.BeginWindowExitAnimation(this, () => this.Close()); } }
private void CloseButton_Click(object sender, RoutedEventArgs e) { WindowAnimationLibrary.BeginWindowExitAnimation(this, () => this.Close()); }