Take windows setting into account to Disable/Enable animations (#748)
This commit is contained in:
		| @@ -83,16 +83,6 @@ App::App() | |||||||
| #endif | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| bool App::m_isAnimationEnabled = true; |  | ||||||
|  |  | ||||||
| /// <summary> |  | ||||||
| /// Return True if animation is enabled by user setting. |  | ||||||
| /// </summary> |  | ||||||
| bool App::IsAnimationEnabled() |  | ||||||
| { |  | ||||||
|     return App::m_isAnimationEnabled; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void App::AddWindowToMap(_In_ WindowFrameService ^ frameService) | void App::AddWindowToMap(_In_ WindowFrameService ^ frameService) | ||||||
| { | { | ||||||
|     reader_writer_lock::scoped_lock lock(m_windowsMapLock); |     reader_writer_lock::scoped_lock lock(m_windowsMapLock); | ||||||
| @@ -218,9 +208,6 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument) | |||||||
|     //    } |     //    } | ||||||
|     //#endif |     //#endif | ||||||
|  |  | ||||||
|     auto userSettings = ref new Windows::UI::ViewManagement::UISettings(); |  | ||||||
|     m_isAnimationEnabled = userSettings->AnimationsEnabled; |  | ||||||
|  |  | ||||||
|     args->SplashScreen->Dismissed += ref new TypedEventHandler<SplashScreen ^, Object ^>(this, &App::DismissedEventHandler); |     args->SplashScreen->Dismissed += ref new TypedEventHandler<SplashScreen ^, Object ^>(this, &App::DismissedEventHandler); | ||||||
|  |  | ||||||
|     auto rootFrame = dynamic_cast<Frame ^>(Window::Current->Content); |     auto rootFrame = dynamic_cast<Frame ^>(Window::Current->Content); | ||||||
|   | |||||||
| @@ -29,8 +29,7 @@ namespace CalculatorApp | |||||||
|         virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs ^ args) override; |         virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs ^ args) override; | ||||||
|         virtual void OnActivated(Windows::ApplicationModel::Activation::IActivatedEventArgs ^ args) override; |         virtual void OnActivated(Windows::ApplicationModel::Activation::IActivatedEventArgs ^ args) override; | ||||||
|  |  | ||||||
|     internal : |     internal: | ||||||
|         static bool IsAnimationEnabled(); |  | ||||||
|         void RemoveWindow(_In_ WindowFrameService ^ frameService); |         void RemoveWindow(_In_ WindowFrameService ^ frameService); | ||||||
|         void RemoveSecondaryWindow(_In_ WindowFrameService ^ frameService); |         void RemoveSecondaryWindow(_In_ WindowFrameService ^ frameService); | ||||||
|  |  | ||||||
| @@ -88,7 +87,5 @@ namespace CalculatorApp | |||||||
|         bool m_preLaunched; |         bool m_preLaunched; | ||||||
|  |  | ||||||
|         Windows::UI::Xaml::Controls::Primitives::Popup ^ m_aboutPopup; |         Windows::UI::Xaml::Controls::Primitives::Popup ^ m_aboutPopup; | ||||||
|  |  | ||||||
|         static bool m_isAnimationEnabled; |  | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -195,7 +195,8 @@ void Calculator::UpdateViewState() | |||||||
|  |  | ||||||
| void Calculator::AnimateCalculator(bool resultAnimate) | void Calculator::AnimateCalculator(bool resultAnimate) | ||||||
| { | { | ||||||
|     if (App::IsAnimationEnabled()) |     static auto uiSettings = ref new UISettings();  | ||||||
|  |     if (uiSettings->AnimationsEnabled) | ||||||
|     { |     { | ||||||
|         m_doAnimate = true; |         m_doAnimate = true; | ||||||
|         m_resultAnimate = resultAnimate; |         m_resultAnimate = resultAnimate; | ||||||
|   | |||||||
| @@ -46,7 +46,6 @@ static const long long DURATION_500_MS = 10000 * 500; | |||||||
|  |  | ||||||
| UnitConverter::UnitConverter() | UnitConverter::UnitConverter() | ||||||
|     : m_meteredConnectionOverride(false) |     : m_meteredConnectionOverride(false) | ||||||
|     , m_isAnimationEnabled(false) |  | ||||||
| { | { | ||||||
|     m_layoutDirection = LocalizationService::GetInstance()->GetFlowDirection(); |     m_layoutDirection = LocalizationService::GetInstance()->GetFlowDirection(); | ||||||
|     m_FlowDirectionHorizontalAlignment = m_layoutDirection == ::FlowDirection::RightToLeft ? ::HorizontalAlignment::Right : ::HorizontalAlignment::Left; |     m_FlowDirectionHorizontalAlignment = m_layoutDirection == ::FlowDirection::RightToLeft ? ::HorizontalAlignment::Right : ::HorizontalAlignment::Left; | ||||||
| @@ -60,9 +59,6 @@ UnitConverter::UnitConverter() | |||||||
|     bool preferRight = LocalizationSettings::GetInstance().GetCurrencySymbolPrecedence() == 0; |     bool preferRight = LocalizationSettings::GetInstance().GetCurrencySymbolPrecedence() == 0; | ||||||
|     VisualStateManager::GoToState(this, preferRight ? "CurrencySymbolRightState" : "CurrencySymbolLeftState", false); |     VisualStateManager::GoToState(this, preferRight ? "CurrencySymbolRightState" : "CurrencySymbolLeftState", false); | ||||||
|  |  | ||||||
|     auto userSettings = ref new UISettings(); |  | ||||||
|     m_isAnimationEnabled = userSettings->AnimationsEnabled; |  | ||||||
|  |  | ||||||
|     auto resLoader = AppResourceProvider::GetInstance(); |     auto resLoader = AppResourceProvider::GetInstance(); | ||||||
|     m_chargesMayApplyText = resLoader->GetResourceString(L"DataChargesMayApply"); |     m_chargesMayApplyText = resLoader->GetResourceString(L"DataChargesMayApply"); | ||||||
|     m_failedToRefreshText = resLoader->GetResourceString(L"FailedToRefresh"); |     m_failedToRefreshText = resLoader->GetResourceString(L"FailedToRefresh"); | ||||||
| @@ -250,7 +246,8 @@ void UnitConverter::OnPasteMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEven | |||||||
|  |  | ||||||
| void UnitConverter::AnimateConverter() | void UnitConverter::AnimateConverter() | ||||||
| { | { | ||||||
|     if (App::IsAnimationEnabled()) |     static auto uiSettings = ref new UISettings(); | ||||||
|  |     if (uiSettings->AnimationsEnabled) | ||||||
|     { |     { | ||||||
|         AnimationStory->Begin(); |         AnimationStory->Begin(); | ||||||
|     } |     } | ||||||
| @@ -332,7 +329,7 @@ void UnitConverter::OnIsDisplayVisibleChanged() | |||||||
|  |  | ||||||
|         if (Model->IsCurrencyCurrentCategory && !Model->CurrencyTimestamp->IsEmpty()) |         if (Model->IsCurrencyCurrentCategory && !Model->CurrencyTimestamp->IsEmpty()) | ||||||
|         { |         { | ||||||
|             VisualStateManager::GoToState(this, L"CurrencyLoadedState", m_isAnimationEnabled); |             VisualStateManager::GoToState(this, L"CurrencyLoadedState", true); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -87,7 +87,6 @@ namespace CalculatorApp | |||||||
|  |  | ||||||
|         Windows::UI::Xaml::DispatcherTimer ^ m_delayTimer; |         Windows::UI::Xaml::DispatcherTimer ^ m_delayTimer; | ||||||
|  |  | ||||||
|         bool m_isAnimationEnabled; |  | ||||||
|         void SupplementaryResultsPanelInGrid_SizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e); |         void SupplementaryResultsPanelInGrid_SizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e); | ||||||
|         void OnVisualStateChanged(Platform::Object ^ sender, Windows::UI::Xaml::VisualStateChangedEventArgs ^ e); |         void OnVisualStateChanged(Platform::Object ^ sender, Windows::UI::Xaml::VisualStateChangedEventArgs ^ e); | ||||||
|     }; |     }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user