diff --git a/src/Calculator/Views/Calculator.xaml b/src/Calculator/Views/Calculator.xaml index a0efa57..f748d6b 100644 --- a/src/Calculator/Views/Calculator.xaml +++ b/src/Calculator/Views/Calculator.xaml @@ -403,12 +403,12 @@ - + - - + + @@ -419,19 +419,21 @@ + - + + - + - + @@ -439,7 +441,7 @@ - + @@ -454,11 +456,11 @@ - + - + @@ -468,7 +470,7 @@ - + @@ -479,7 +481,7 @@ - + @@ -491,13 +493,13 @@ - + - + @@ -505,7 +507,6 @@ - @@ -513,7 +514,7 @@ - + diff --git a/src/Calculator/Views/Calculator.xaml.cpp b/src/Calculator/Views/Calculator.xaml.cpp index 157b14e..6b7780b 100644 --- a/src/Calculator/Views/Calculator.xaml.cpp +++ b/src/Calculator/Views/Calculator.xaml.cpp @@ -209,7 +209,7 @@ void Calculator::AnimateCalculator(bool resultAnimate) // We are forcing the animation here // It's because if last animation was in standard, then go to unit converter, then comes back to standard // The state for the calculator does not change and the animation would not get run. - this->OnStoryboardCompleted(nullptr, nullptr); + this->OnModeVisualStateCompleted(nullptr, nullptr); } } } @@ -239,7 +239,7 @@ void Calculator::OnContextCanceled(UIElement ^ sender, RoutedEventArgs ^ e) m_displayFlyout->Hide(); } -void Calculator::OnLayoutStateChanged(_In_ Object ^ sender, _In_ Object ^ e) +void Calculator::OnLayoutVisualStateCompleted(_In_ Object ^ sender, _In_ Object ^ e) { UpdatePanelViewState(); } @@ -286,29 +286,23 @@ void Calculator::OnIsAlwaysOnTopPropertyChanged(bool /*oldValue*/, bool newValue { if (newValue) { - VisualStateManager::GoToState(this, L"AlwaysOnTop", false); + VisualStateManager::GoToState(this, L"DisplayModeAlwaysOnTop", false); + AlwaysOnTopResults->UpdateScrollButtons(); } else { - VisualStateManager::GoToState(this, L"Normal", false); - if (Model->IsInError) - { - VisualStateManager::GoToState(this, L"ErrorLayout", false); - } - else + VisualStateManager::GoToState(this, L"DisplayModeNormal", false); + if (!Model->IsInError) { EnableMemoryControls(true); } + Results->UpdateTextState(); } Model->IsMemoryEmpty = (Model->MemorizedNumbers->Size == 0) || IsAlwaysOnTop; - AlwaysOnTopResults->UpdateScrollButtons(); - Results->UpdateTextState(); - UpdateViewState(); UpdatePanelViewState(); - SetDefaultFocus(); } void Calculator::OnIsInErrorPropertyChanged() @@ -336,7 +330,7 @@ void Calculator::OnIsInErrorPropertyChanged() // Once the storyboard that rearranges the buttons completed, // We do the animation based on the Mode or Orientation change. -void Calculator::OnStoryboardCompleted(_In_ Object ^ sender, _In_ Object ^ e) +void Calculator::OnModeVisualStateCompleted(_In_ Object ^ sender, _In_ Object ^ e) { m_isLastAnimatedInScientific = IsScientific; m_isLastAnimatedInProgrammer = IsProgrammer; @@ -558,7 +552,7 @@ void Calculator::ToggleHistoryFlyout(Object ^ /*parameter*/) { return; } - + if (m_fIsHistoryFlyoutOpen) { HistoryFlyout->Hide(); @@ -568,7 +562,7 @@ void Calculator::ToggleHistoryFlyout(Object ^ /*parameter*/) HistoryFlyout->Content = m_historyList; m_historyList->RowHeight = NumpadPanel->ActualHeight; FlyoutBase::ShowAttachedFlyout(HistoryButton); - } + } } void Calculator::ToggleMemoryFlyout() @@ -719,7 +713,12 @@ void Calculator::UnregisterEventHandlers() ExpressionText->UnregisterEventHandlers(); } -void Calculator::OnErrorLayoutCompleted(_In_ Object ^ sender, _In_ Object ^ e) +void Calculator::OnErrorVisualStateCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e) +{ + SetDefaultFocus(); +} + +void Calculator::OnDisplayVisualStateCompleted(_In_ Object ^ sender, _In_ Object ^ e) { SetDefaultFocus(); } diff --git a/src/Calculator/Views/Calculator.xaml.h b/src/Calculator/Views/Calculator.xaml.h index 78ef710..e7d3610 100644 --- a/src/Calculator/Views/Calculator.xaml.h +++ b/src/Calculator/Views/Calculator.xaml.h @@ -87,8 +87,10 @@ public void OnIsAlwaysOnTopPropertyChanged(bool oldValue, bool newValue); void OnIsInErrorPropertyChanged(); void OnCalcPropertyChanged(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e); - void OnStoryboardCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); - void OnLayoutStateChanged(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); + void OnLayoutVisualStateCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); + void OnModeVisualStateCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); + void OnErrorVisualStateCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); + void OnDisplayVisualStateCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); void EnsureScientific(); void EnsureProgrammer(); void SetFontSizeResources(); @@ -140,7 +142,6 @@ public void OnHistoryFlyOutTapped(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Input::TappedRoutedEventArgs ^ e); bool IsValidRegularExpression(std::wstring str); void DockPanelTapped(_In_ Windows::UI::Xaml::Input::TappedRoutedEventArgs ^ e); - void OnErrorLayoutCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); void OnHistoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement ^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs ^ args); void OnMemoryAccessKeyInvoked(_In_ Windows::UI::Xaml::UIElement ^ sender, _In_ Windows::UI::Xaml::Input::AccessKeyInvokedEventArgs ^ args); void OnVisualStateChanged(Platform::Object ^ sender, Windows::UI::Xaml::VisualStateChangedEventArgs ^ e);