private void ViewModel_OnStateChanged(object sender, object e) { switch (_viewModel.State) { case FlyoutViewModel.ViewState.Opening: if (_viewModel.ShowOptions == FlyoutShowOptions.Pointer) { _rawListener.Start(); } Show(); // We need the theme to be updated on show because the window borders will be set based on taskbar position. ThemeChanged(); UpdateWindowBounds(); // Update layout otherwise we may display queued state changes UpdateLayout(); DevicesList.Focus(); WindowAnimationLibrary.BeginFlyoutEntranceAnimation(this, () => _viewModel.ChangeState(FlyoutViewModel.ViewState.Open)); break; case FlyoutViewModel.ViewState.Closing_Stage1: _rawListener.Stop(); if (_needsExpandOrCollapse) { WindowAnimationLibrary.BeginFlyoutExitanimation(this, () => { this.Cloak(); Hide(); // NB: Hidden to avoid the stage 2 hide delay, we want to show again immediately. _viewModel.ChangeState(FlyoutViewModel.ViewState.Hidden); }); } else { this.Cloak(); Hide(); DisableAcrylic(); _viewModel.ChangeState(FlyoutViewModel.ViewState.Closing_Stage2); } break; case FlyoutViewModel.ViewState.Hidden: if (_needsExpandOrCollapse) { _needsExpandOrCollapse = false; _viewModel.DoExpandCollapse(); _viewModel.BeginOpen(); } break; } }
private void FlyoutWindow_MouseLeave(object sender, MouseEventArgs e) { _rawListener.Start(); }