Merge remote-tracking branch 'upstream/master' into mergeFeature
This commit is contained in:
commit
aad968ff37
@ -29,7 +29,7 @@ jobs:
|
|||||||
downloadDirectory: $(Build.SourcesDirectory)
|
downloadDirectory: $(Build.SourcesDirectory)
|
||||||
vstsFeed: WindowsApps
|
vstsFeed: WindowsApps
|
||||||
vstsFeedPackage: calculator-internals
|
vstsFeedPackage: calculator-internals
|
||||||
vstsPackageVersion: 0.0.22
|
vstsPackageVersion: 0.0.31
|
||||||
|
|
||||||
- template: ./build-single-architecture.yaml
|
- template: ./build-single-architecture.yaml
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -293,16 +293,13 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="ApplicationViewModel.h" />
|
<ClInclude Include="ApplicationViewModel.h" />
|
||||||
<ClInclude Include="Common\AlwaysSelectedCollectionView.h" />
|
|
||||||
<ClInclude Include="Common\AppResourceProvider.h" />
|
<ClInclude Include="Common\AppResourceProvider.h" />
|
||||||
<ClInclude Include="Common\Automation\NarratorAnnouncement.h" />
|
<ClInclude Include="Common\Automation\NarratorAnnouncement.h" />
|
||||||
<ClInclude Include="Common\Automation\NarratorNotifier.h" />
|
<ClInclude Include="Common\Automation\NarratorNotifier.h" />
|
||||||
<ClInclude Include="Common\BindableBase.h" />
|
|
||||||
<ClInclude Include="Common\BitLength.h" />
|
<ClInclude Include="Common\BitLength.h" />
|
||||||
<ClInclude Include="Common\CalculatorButtonPressedEventArgs.h" />
|
<ClInclude Include="Common\CalculatorButtonPressedEventArgs.h" />
|
||||||
<ClInclude Include="Common\CalculatorButtonUser.h" />
|
<ClInclude Include="Common\CalculatorButtonUser.h" />
|
||||||
<ClInclude Include="Common\CalculatorDisplay.h" />
|
<ClInclude Include="Common\CalculatorDisplay.h" />
|
||||||
<ClInclude Include="Common\ConversionResultTaskHelper.h" />
|
|
||||||
<ClInclude Include="Common\CopyPasteManager.h" />
|
<ClInclude Include="Common\CopyPasteManager.h" />
|
||||||
<ClInclude Include="Common\DateCalculator.h" />
|
<ClInclude Include="Common\DateCalculator.h" />
|
||||||
<ClInclude Include="Common\DelegateCommand.h" />
|
<ClInclude Include="Common\DelegateCommand.h" />
|
||||||
@ -310,7 +307,6 @@
|
|||||||
<ClInclude Include="Common\EngineResourceProvider.h" />
|
<ClInclude Include="Common\EngineResourceProvider.h" />
|
||||||
<ClInclude Include="Common\ExpressionCommandDeserializer.h" />
|
<ClInclude Include="Common\ExpressionCommandDeserializer.h" />
|
||||||
<ClInclude Include="Common\ExpressionCommandSerializer.h" />
|
<ClInclude Include="Common\ExpressionCommandSerializer.h" />
|
||||||
<ClInclude Include="Common\KeyboardShortcutManager.h" />
|
|
||||||
<ClInclude Include="Common\LocalizationService.h" />
|
<ClInclude Include="Common\LocalizationService.h" />
|
||||||
<ClInclude Include="Common\LocalizationSettings.h" />
|
<ClInclude Include="Common\LocalizationSettings.h" />
|
||||||
<ClInclude Include="Common\LocalizationStringUtil.h" />
|
<ClInclude Include="Common\LocalizationStringUtil.h" />
|
||||||
@ -321,7 +317,6 @@
|
|||||||
<ClInclude Include="Common\TraceActivity.h" />
|
<ClInclude Include="Common\TraceActivity.h" />
|
||||||
<ClInclude Include="Common\TraceLogger.h" />
|
<ClInclude Include="Common\TraceLogger.h" />
|
||||||
<ClInclude Include="Common\Utils.h" />
|
<ClInclude Include="Common\Utils.h" />
|
||||||
<ClInclude Include="Common\ValidatingConverters.h" />
|
|
||||||
<ClInclude Include="DataLoaders\CurrencyDataLoader.h" />
|
<ClInclude Include="DataLoaders\CurrencyDataLoader.h" />
|
||||||
<ClInclude Include="DataLoaders\CurrencyHttpClient.h" />
|
<ClInclude Include="DataLoaders\CurrencyHttpClient.h" />
|
||||||
<ClInclude Include="DataLoaders\ICurrencyHttpClient.h" />
|
<ClInclude Include="DataLoaders\ICurrencyHttpClient.h" />
|
||||||
@ -346,16 +341,13 @@
|
|||||||
<ClCompile Include="Common\AppResourceProvider.cpp" />
|
<ClCompile Include="Common\AppResourceProvider.cpp" />
|
||||||
<ClCompile Include="Common\Automation\NarratorAnnouncement.cpp" />
|
<ClCompile Include="Common\Automation\NarratorAnnouncement.cpp" />
|
||||||
<ClCompile Include="Common\Automation\NarratorNotifier.cpp" />
|
<ClCompile Include="Common\Automation\NarratorNotifier.cpp" />
|
||||||
<ClCompile Include="Common\BindableBase.cpp" />
|
|
||||||
<ClCompile Include="Common\CalculatorButtonPressedEventArgs.cpp" />
|
<ClCompile Include="Common\CalculatorButtonPressedEventArgs.cpp" />
|
||||||
<ClCompile Include="Common\CalculatorDisplay.cpp" />
|
<ClCompile Include="Common\CalculatorDisplay.cpp" />
|
||||||
<ClCompile Include="Common\ConversionResultTaskHelper.cpp" />
|
|
||||||
<ClCompile Include="Common\CopyPasteManager.cpp" />
|
<ClCompile Include="Common\CopyPasteManager.cpp" />
|
||||||
<ClCompile Include="Common\DateCalculator.cpp" />
|
<ClCompile Include="Common\DateCalculator.cpp" />
|
||||||
<ClCompile Include="Common\EngineResourceProvider.cpp" />
|
<ClCompile Include="Common\EngineResourceProvider.cpp" />
|
||||||
<ClCompile Include="Common\ExpressionCommandDeserializer.cpp" />
|
<ClCompile Include="Common\ExpressionCommandDeserializer.cpp" />
|
||||||
<ClCompile Include="Common\ExpressionCommandSerializer.cpp" />
|
<ClCompile Include="Common\ExpressionCommandSerializer.cpp" />
|
||||||
<ClCompile Include="Common\KeyboardShortcutManager.cpp" />
|
|
||||||
<ClCompile Include="Common\LocalizationService.cpp" />
|
<ClCompile Include="Common\LocalizationService.cpp" />
|
||||||
<ClCompile Include="Common\NavCategory.cpp" />
|
<ClCompile Include="Common\NavCategory.cpp" />
|
||||||
<ClCompile Include="Common\NetworkManager.cpp" />
|
<ClCompile Include="Common\NetworkManager.cpp" />
|
||||||
@ -411,16 +403,7 @@
|
|||||||
</Choose>
|
</Choose>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="DataLoaders\DefaultFromToCurrency.json" />
|
<None Include="DataLoaders\DefaultFromToCurrency.json" />
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets" />
|
||||||
<Import Project="..\..\packages\Microsoft.UI.Xaml.2.2.190830001\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\packages\Microsoft.UI.Xaml.2.2.190830001\build\native\Microsoft.UI.Xaml.targets')" />
|
|
||||||
</ImportGroup>
|
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
|
||||||
<PropertyGroup>
|
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Error Condition="!Exists('..\..\packages\Microsoft.UI.Xaml.2.2.190830001\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.UI.Xaml.2.2.190830001\build\native\Microsoft.UI.Xaml.targets'))" />
|
|
||||||
</Target>
|
|
||||||
</Project>
|
</Project>
|
@ -26,18 +26,12 @@
|
|||||||
<ClCompile Include="Common\AppResourceProvider.cpp">
|
<ClCompile Include="Common\AppResourceProvider.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Common\BindableBase.cpp">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Common\CalculatorButtonPressedEventArgs.cpp">
|
<ClCompile Include="Common\CalculatorButtonPressedEventArgs.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Common\CalculatorDisplay.cpp">
|
<ClCompile Include="Common\CalculatorDisplay.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Common\ConversionResultTaskHelper.cpp">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Common\CopyPasteManager.cpp">
|
<ClCompile Include="Common\CopyPasteManager.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -53,9 +47,6 @@
|
|||||||
<ClCompile Include="Common\ExpressionCommandSerializer.cpp">
|
<ClCompile Include="Common\ExpressionCommandSerializer.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Common\KeyboardShortcutManager.cpp">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Common\LocalizationService.cpp">
|
<ClCompile Include="Common\LocalizationService.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -106,15 +97,9 @@
|
|||||||
<ClInclude Include="MemoryItemViewModel.h" />
|
<ClInclude Include="MemoryItemViewModel.h" />
|
||||||
<ClInclude Include="StandardCalculatorViewModel.h" />
|
<ClInclude Include="StandardCalculatorViewModel.h" />
|
||||||
<ClInclude Include="UnitConverterViewModel.h" />
|
<ClInclude Include="UnitConverterViewModel.h" />
|
||||||
<ClInclude Include="Common\AlwaysSelectedCollectionView.h">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Common\AppResourceProvider.h">
|
<ClInclude Include="Common\AppResourceProvider.h">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Common\BindableBase.h">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Common\CalculatorButtonPressedEventArgs.h">
|
<ClInclude Include="Common\CalculatorButtonPressedEventArgs.h">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -124,18 +109,12 @@
|
|||||||
<ClInclude Include="Common\CalculatorDisplay.h">
|
<ClInclude Include="Common\CalculatorDisplay.h">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Common\ConversionResultTaskHelper.h">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Common\CopyPasteManager.h">
|
<ClInclude Include="Common\CopyPasteManager.h">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Common\DateCalculator.h">
|
<ClInclude Include="Common\DateCalculator.h">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Common\DelegateCommand.h">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Common\DisplayExpressionToken.h">
|
<ClInclude Include="Common\DisplayExpressionToken.h">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -148,9 +127,6 @@
|
|||||||
<ClInclude Include="Common\ExpressionCommandSerializer.h">
|
<ClInclude Include="Common\ExpressionCommandSerializer.h">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Common\KeyboardShortcutManager.h">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Common\LocalizationService.h">
|
<ClInclude Include="Common\LocalizationService.h">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -175,9 +151,6 @@
|
|||||||
<ClInclude Include="Common\Utils.h">
|
<ClInclude Include="Common\Utils.h">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Common\ValidatingConverters.h">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Common\Automation\NarratorNotifier.h">
|
<ClInclude Include="Common\Automation\NarratorNotifier.h">
|
||||||
<Filter>Common\Automation</Filter>
|
<Filter>Common\Automation</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -226,14 +199,13 @@
|
|||||||
<ClInclude Include="GraphingCalculator\GraphingSettingsViewModel.h">
|
<ClInclude Include="GraphingCalculator\GraphingSettingsViewModel.h">
|
||||||
<Filter>GraphingCalculator</Filter>
|
<Filter>GraphingCalculator</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Common\DelegateCommand.h">
|
||||||
|
<Filter>Common</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="DataLoaders\DefaultFromToCurrency.json">
|
<None Include="DataLoaders\DefaultFromToCurrency.json">
|
||||||
<Filter>DataLoaders</Filter>
|
<Filter>DataLoaders</Filter>
|
||||||
</None>
|
</None>
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Page Include="$(MSBuildThisFileDirectory)DensityStyles\Compact.xaml" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -1,34 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
#include "BindableBase.h"
|
|
||||||
|
|
||||||
using namespace CalculatorApp::Common;
|
|
||||||
|
|
||||||
using namespace Platform;
|
|
||||||
using namespace Windows::UI::Xaml::Data;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Notifies listeners that a property value has changed.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="propertyName">Name of the property used to notify listeners.</param>
|
|
||||||
void BindableBase::OnPropertyChanged(String ^ propertyName)
|
|
||||||
{
|
|
||||||
PropertyChanged(this, ref new PropertyChangedEventArgs(propertyName));
|
|
||||||
}
|
|
||||||
|
|
||||||
Windows::UI::Xaml::Data::ICustomProperty ^ BindableBase::GetCustomProperty(Platform::String ^ name)
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Windows::UI::Xaml::Data::ICustomProperty ^ BindableBase::GetIndexedProperty(Platform::String ^ name, Windows::UI::Xaml::Interop::TypeName type)
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Platform::String ^ BindableBase::GetStringRepresentation()
|
|
||||||
{
|
|
||||||
return this->ToString();
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace CalculatorApp
|
|
||||||
{
|
|
||||||
namespace Common
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Implementation of <see cref="INotifyPropertyChanged"/> to simplify models.
|
|
||||||
/// </summary>
|
|
||||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class BindableBase : Windows::UI::Xaml::DependencyObject,
|
|
||||||
Windows::UI::Xaml::Data::INotifyPropertyChanged,
|
|
||||||
Windows::UI::Xaml::Data::ICustomPropertyProvider
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual event Windows::UI::Xaml::Data::PropertyChangedEventHandler ^ PropertyChanged;
|
|
||||||
|
|
||||||
public:
|
|
||||||
// ICustomPropertyProvider
|
|
||||||
virtual Windows::UI::Xaml::Data::ICustomProperty ^ GetCustomProperty(Platform::String ^ name);
|
|
||||||
virtual Windows::UI::Xaml::Data::ICustomProperty ^ GetIndexedProperty(Platform::String ^ name, Windows::UI::Xaml::Interop::TypeName type);
|
|
||||||
virtual Platform::String ^ GetStringRepresentation();
|
|
||||||
|
|
||||||
property Windows::UI::Xaml::Interop::TypeName Type
|
|
||||||
{
|
|
||||||
virtual Windows::UI::Xaml::Interop::TypeName get()
|
|
||||||
{
|
|
||||||
return this->GetType();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void OnPropertyChanged(Platform::String ^ propertyName);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
#include "ConversionResultTaskHelper.h"
|
|
||||||
|
|
||||||
using namespace CalculatorApp::Common;
|
|
||||||
using namespace concurrency;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
ConversionResultTaskHelper::ConversionResultTaskHelper(unsigned int delay, const function<void()> functionToRun)
|
|
||||||
: m_delay{ delay }
|
|
||||||
, m_storedFunction{ functionToRun }
|
|
||||||
{
|
|
||||||
auto token = m_cts.get_token();
|
|
||||||
auto delayTask = CompleteAfter(delay);
|
|
||||||
delayTask.then(
|
|
||||||
[this, token]() {
|
|
||||||
if (!token.is_canceled())
|
|
||||||
{
|
|
||||||
m_storedFunction();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
task_continuation_context::use_current());
|
|
||||||
}
|
|
||||||
|
|
||||||
ConversionResultTaskHelper::~ConversionResultTaskHelper()
|
|
||||||
{
|
|
||||||
m_cts.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma optimize("", off)
|
|
||||||
// Creates a task that completes after the specified delay.
|
|
||||||
//
|
|
||||||
// Taken from: How to: Create a Task that Completes After a Delay
|
|
||||||
// https://msdn.microsoft.com/en-us/library/hh873170.aspx
|
|
||||||
task<void> ConversionResultTaskHelper::CompleteAfter(unsigned int timeout)
|
|
||||||
{
|
|
||||||
co_await winrt::resume_after(winrt::Windows::Foundation::TimeSpan{ std::chrono::duration<uint32_t, std::milli>(timeout) });
|
|
||||||
};
|
|
||||||
#pragma optimize("", on)
|
|
@ -1,24 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace CalculatorApp
|
|
||||||
{
|
|
||||||
namespace Common
|
|
||||||
{
|
|
||||||
class ConversionResultTaskHelper
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ConversionResultTaskHelper(unsigned int delay, const std::function<void()> functionToRun);
|
|
||||||
~ConversionResultTaskHelper();
|
|
||||||
|
|
||||||
private:
|
|
||||||
concurrency::task<void> CompleteAfter(unsigned int timeout);
|
|
||||||
|
|
||||||
unsigned int m_delay;
|
|
||||||
concurrency::cancellation_token_source m_cts;
|
|
||||||
const std::function<void()> m_storedFunction;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +1,11 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <winmeta.h>
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
{
|
{
|
||||||
constexpr int64_t WINEVENT_KEYWORD_RESPONSE_TIME = 0x1000000000000;
|
|
||||||
|
|
||||||
// RAII wrapper that automatically sends the Stop event when the class gets destructed.
|
// RAII wrapper that automatically sends the Stop event when the class gets destructed.
|
||||||
class TraceActivity
|
class TraceActivity
|
||||||
{
|
{
|
||||||
|
@ -36,12 +36,6 @@ HistoryViewModel::HistoryViewModel(_In_ CalculationManager::CalculatorManager* c
|
|||||||
ItemSize = 0;
|
ItemSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryViewModel::RestoreCompleteHistory()
|
|
||||||
{
|
|
||||||
RestoreHistory(CalculationManager::CALCULATOR_MODE::CM_STD);
|
|
||||||
RestoreHistory(CalculationManager::CALCULATOR_MODE::CM_SCI);
|
|
||||||
}
|
|
||||||
|
|
||||||
// this will reload Items with the history list based on current mode
|
// this will reload Items with the history list based on current mode
|
||||||
void HistoryViewModel::ReloadHistory(_In_ ViewMode currentMode)
|
void HistoryViewModel::ReloadHistory(_In_ ViewMode currentMode)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,6 @@ namespace CalculatorApp
|
|||||||
event HistoryItemClickedHandler ^ HistoryItemClicked;
|
event HistoryItemClickedHandler ^ HistoryItemClicked;
|
||||||
void ShowItem(_In_ CalculatorApp::ViewModel::HistoryItemViewModel ^ e);
|
void ShowItem(_In_ CalculatorApp::ViewModel::HistoryItemViewModel ^ e);
|
||||||
void ClearHistory();
|
void ClearHistory();
|
||||||
void RestoreCompleteHistory();
|
|
||||||
|
|
||||||
internal : HistoryViewModel(_In_ CalculationManager::CalculatorManager* calculatorManager);
|
internal : HistoryViewModel(_In_ CalculationManager::CalculatorManager* calculatorManager);
|
||||||
void SetCalculatorDisplay(CalculatorDisplay& calculatorDisplay);
|
void SetCalculatorDisplay(CalculatorDisplay& calculatorDisplay);
|
||||||
|
@ -903,21 +903,6 @@ void StandardCalculatorViewModel::OnClearMemoryCommand(Object ^ parameter)
|
|||||||
Announcement = CalculatorAnnouncement::GetMemoryClearedAnnouncement(m_localizedMemoryCleared);
|
Announcement = CalculatorAnnouncement::GetMemoryClearedAnnouncement(m_localizedMemoryCleared);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StandardCalculatorViewModel::OnPinUnpinCommand(Object ^ parameter)
|
|
||||||
{
|
|
||||||
SetViewPinnedState(!IsViewPinned());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool StandardCalculatorViewModel::IsViewPinned()
|
|
||||||
{
|
|
||||||
return m_IsCurrentViewPinned;
|
|
||||||
}
|
|
||||||
|
|
||||||
void StandardCalculatorViewModel::SetViewPinnedState(bool pinned)
|
|
||||||
{
|
|
||||||
IsCurrentViewPinned = pinned;
|
|
||||||
}
|
|
||||||
|
|
||||||
ButtonInfo StandardCalculatorViewModel::MapCharacterToButtonId(char16 ch)
|
ButtonInfo StandardCalculatorViewModel::MapCharacterToButtonId(char16 ch)
|
||||||
{
|
{
|
||||||
ButtonInfo result;
|
ButtonInfo result;
|
||||||
@ -1476,15 +1461,6 @@ void StandardCalculatorViewModel::Recalculate(bool fromHistory)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandType StandardCalculatorViewModel::GetSelectedTokenType(_In_ unsigned int tokenPosition)
|
|
||||||
{
|
|
||||||
const pair<wstring, int>& token = m_tokens->at(tokenPosition);
|
|
||||||
unsigned int tokenCommandIndex = token.second;
|
|
||||||
const shared_ptr<IExpressionCommand>& tokenCommand = m_commands->at(tokenCommandIndex);
|
|
||||||
|
|
||||||
return tokenCommand->GetCommandType();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool StandardCalculatorViewModel::IsOpnd(Command command)
|
bool StandardCalculatorViewModel::IsOpnd(Command command)
|
||||||
{
|
{
|
||||||
static constexpr Command opnd[] = { Command::Command0, Command::Command1, Command::Command2, Command::Command3, Command::Command4, Command::Command5,
|
static constexpr Command opnd[] = { Command::Command0, Command::Command1, Command::Command2, Command::Command3, Command::Command4, Command::Command5,
|
||||||
@ -1626,26 +1602,6 @@ void StandardCalculatorViewModel::SwitchAngleType(NumbersAndOperatorsEnum num)
|
|||||||
OnButtonPressed(num);
|
OnButtonPressed(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
NumbersAndOperatorsEnum StandardCalculatorViewModel::ConvertIntegerToNumbersAndOperatorsEnum(unsigned int parameter)
|
|
||||||
{
|
|
||||||
NumbersAndOperatorsEnum angletype;
|
|
||||||
switch (parameter)
|
|
||||||
{
|
|
||||||
case 321:
|
|
||||||
angletype = NumbersAndOperatorsEnum::Degree;
|
|
||||||
break;
|
|
||||||
case 322:
|
|
||||||
angletype = NumbersAndOperatorsEnum::Radians;
|
|
||||||
break;
|
|
||||||
case 323:
|
|
||||||
angletype = NumbersAndOperatorsEnum::Grads;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
angletype = NumbersAndOperatorsEnum::Degree;
|
|
||||||
};
|
|
||||||
return angletype;
|
|
||||||
}
|
|
||||||
|
|
||||||
void StandardCalculatorViewModel::UpdateOperand(int pos, String ^ text)
|
void StandardCalculatorViewModel::UpdateOperand(int pos, String ^ text)
|
||||||
{
|
{
|
||||||
pair<wstring, int> p = m_tokens->at(pos);
|
pair<wstring, int> p = m_tokens->at(pos);
|
||||||
|
@ -57,7 +57,6 @@ namespace CalculatorApp
|
|||||||
PROPERTY_R(Platform::String ^, SelectedExpressionLastData);
|
PROPERTY_R(Platform::String ^, SelectedExpressionLastData);
|
||||||
OBSERVABLE_NAMED_PROPERTY_R(bool, IsInError);
|
OBSERVABLE_NAMED_PROPERTY_R(bool, IsInError);
|
||||||
OBSERVABLE_PROPERTY_R(bool, IsOperatorCommand);
|
OBSERVABLE_PROPERTY_R(bool, IsOperatorCommand);
|
||||||
OBSERVABLE_PROPERTY_R(Platform::String ^, DisplayStringExpression);
|
|
||||||
OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector<Common::DisplayExpressionToken ^> ^, ExpressionTokens);
|
OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IObservableVector<Common::DisplayExpressionToken ^> ^, ExpressionTokens);
|
||||||
OBSERVABLE_PROPERTY_R(Platform::String ^, DecimalDisplayValue);
|
OBSERVABLE_PROPERTY_R(Platform::String ^, DecimalDisplayValue);
|
||||||
OBSERVABLE_PROPERTY_R(Platform::String ^, HexDisplayValue);
|
OBSERVABLE_PROPERTY_R(Platform::String ^, HexDisplayValue);
|
||||||
@ -72,7 +71,6 @@ namespace CalculatorApp
|
|||||||
OBSERVABLE_PROPERTY_R(bool, IsUnaryOperatorEnabled);
|
OBSERVABLE_PROPERTY_R(bool, IsUnaryOperatorEnabled);
|
||||||
OBSERVABLE_PROPERTY_R(bool, IsNegateEnabled);
|
OBSERVABLE_PROPERTY_R(bool, IsNegateEnabled);
|
||||||
OBSERVABLE_PROPERTY_RW(bool, IsDecimalEnabled);
|
OBSERVABLE_PROPERTY_RW(bool, IsDecimalEnabled);
|
||||||
OBSERVABLE_PROPERTY_R(bool, IsCurrentViewPinned);
|
|
||||||
OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IVector<MemoryItemViewModel ^> ^, MemorizedNumbers);
|
OBSERVABLE_PROPERTY_R(Windows::Foundation::Collections::IVector<MemoryItemViewModel ^> ^, MemorizedNumbers);
|
||||||
OBSERVABLE_NAMED_PROPERTY_RW(bool, IsMemoryEmpty);
|
OBSERVABLE_NAMED_PROPERTY_RW(bool, IsMemoryEmpty);
|
||||||
OBSERVABLE_PROPERTY_R(bool, IsFToEChecked);
|
OBSERVABLE_PROPERTY_R(bool, IsFToEChecked);
|
||||||
@ -210,7 +208,6 @@ namespace CalculatorApp
|
|||||||
{
|
{
|
||||||
if (m_isEditingEnabled != value)
|
if (m_isEditingEnabled != value)
|
||||||
{
|
{
|
||||||
// Numbers::Common::KeyboardShortcutManager::IsCalculatorInEditingMode = value;
|
|
||||||
m_isEditingEnabled = value;
|
m_isEditingEnabled = value;
|
||||||
bool currentEditToggleValue = !m_isEditingEnabled;
|
bool currentEditToggleValue = !m_isEditingEnabled;
|
||||||
IsBinaryOperatorEnabled = currentEditToggleValue;
|
IsBinaryOperatorEnabled = currentEditToggleValue;
|
||||||
@ -263,7 +260,6 @@ namespace CalculatorApp
|
|||||||
void OnMemoryAdd(Platform::Object ^ memoryItemPosition);
|
void OnMemoryAdd(Platform::Object ^ memoryItemPosition);
|
||||||
void OnMemorySubtract(Platform::Object ^ memoryItemPosition);
|
void OnMemorySubtract(Platform::Object ^ memoryItemPosition);
|
||||||
void OnMemoryClear(_In_ Platform::Object ^ memoryItemPosition);
|
void OnMemoryClear(_In_ Platform::Object ^ memoryItemPosition);
|
||||||
void OnPinUnpinCommand(Platform::Object ^ parameter);
|
|
||||||
|
|
||||||
void OnInputChanged();
|
void OnInputChanged();
|
||||||
void DisplayPasteError();
|
void DisplayPasteError();
|
||||||
@ -333,7 +329,6 @@ namespace CalculatorApp
|
|||||||
Platform::String ^ m_localizedOpenParenthesisCountChangedAutomationFormat;
|
Platform::String ^ m_localizedOpenParenthesisCountChangedAutomationFormat;
|
||||||
Platform::String ^ m_localizedNoRightParenthesisAddedFormat;
|
Platform::String ^ m_localizedNoRightParenthesisAddedFormat;
|
||||||
|
|
||||||
bool m_pinned;
|
|
||||||
bool m_isOperandEnabled;
|
bool m_isOperandEnabled;
|
||||||
bool m_isEditingEnabled;
|
bool m_isEditingEnabled;
|
||||||
bool m_isStandard;
|
bool m_isStandard;
|
||||||
@ -373,12 +368,8 @@ namespace CalculatorApp
|
|||||||
bool IsOpnd(CalculationManager::Command command);
|
bool IsOpnd(CalculationManager::Command command);
|
||||||
bool IsRecoverableCommand(CalculationManager::Command command);
|
bool IsRecoverableCommand(CalculationManager::Command command);
|
||||||
|
|
||||||
CalculationManager::CommandType GetSelectedTokenType(_In_ unsigned int);
|
|
||||||
void SaveEditedCommand(_In_ unsigned int index, _In_ CalculationManager::Command command);
|
void SaveEditedCommand(_In_ unsigned int index, _In_ CalculationManager::Command command);
|
||||||
|
|
||||||
bool IsViewPinned();
|
|
||||||
void SetViewPinnedState(bool pinned);
|
|
||||||
|
|
||||||
CalculatorApp::Common::ViewMode GetCalculatorMode();
|
CalculatorApp::Common::ViewMode GetCalculatorMode();
|
||||||
|
|
||||||
friend class CalculatorDisplay;
|
friend class CalculatorDisplay;
|
||||||
|
@ -478,20 +478,10 @@ void UnitConverterViewModel::OnButtonPressed(Platform::Object ^ parameter)
|
|||||||
|
|
||||||
static constexpr UCM::Command OPERANDS[] = { UCM::Command::Zero, UCM::Command::One, UCM::Command::Two, UCM::Command::Three, UCM::Command::Four,
|
static constexpr UCM::Command OPERANDS[] = { UCM::Command::Zero, UCM::Command::One, UCM::Command::Two, UCM::Command::Three, UCM::Command::Four,
|
||||||
UCM::Command::Five, UCM::Command::Six, UCM::Command::Seven, UCM::Command::Eight, UCM::Command::Nine };
|
UCM::Command::Five, UCM::Command::Six, UCM::Command::Seven, UCM::Command::Eight, UCM::Command::Nine };
|
||||||
|
|
||||||
if (find(begin(OPERANDS), end(OPERANDS), command) != end(OPERANDS))
|
|
||||||
{
|
|
||||||
if (m_isInputBlocked)
|
if (m_isInputBlocked)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_IsCurrencyCurrentCategory)
|
|
||||||
{
|
|
||||||
StartConversionResultTimer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_model->SendCommand(command);
|
m_model->SendCommand(command);
|
||||||
|
|
||||||
TraceLogger::GetInstance()->LogConverterInputReceived(Mode);
|
TraceLogger::GetInstance()->LogConverterInputReceived(Mode);
|
||||||
@ -998,18 +988,6 @@ bool UnitConverterViewModel::UnitsAreValid()
|
|||||||
return UnitFrom != nullptr && !UnitFrom->Abbreviation->IsEmpty() && UnitTo != nullptr && !UnitTo->Abbreviation->IsEmpty();
|
return UnitFrom != nullptr && !UnitFrom->Abbreviation->IsEmpty() && UnitTo != nullptr && !UnitTo->Abbreviation->IsEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnitConverterViewModel::StartConversionResultTimer()
|
|
||||||
{
|
|
||||||
auto that(this);
|
|
||||||
m_conversionResultTaskHelper = make_unique<ConversionResultTaskHelper>(CONVERSION_FINALIZED_DELAY_IN_MS, [that]() {
|
|
||||||
if (that->UnitsAreValid())
|
|
||||||
{
|
|
||||||
String ^ valueFrom = that->m_Value1Active ? that->m_Value1 : that->m_Value2;
|
|
||||||
String ^ valueTo = that->m_Value1Active ? that->m_Value2 : that->m_Value1;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
String ^ SupplementaryResult::GetLocalizedAutomationName()
|
String ^ SupplementaryResult::GetLocalizedAutomationName()
|
||||||
{
|
{
|
||||||
auto format = AppResourceProvider::GetInstance()->GetResourceString("SupplementaryUnit_AutomationName");
|
auto format = AppResourceProvider::GetInstance()->GetResourceString("SupplementaryUnit_AutomationName");
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include "Common/Utils.h"
|
#include "Common/Utils.h"
|
||||||
#include "Common/NetworkManager.h"
|
#include "Common/NetworkManager.h"
|
||||||
#include "Common/Automation/NarratorAnnouncement.h"
|
#include "Common/Automation/NarratorAnnouncement.h"
|
||||||
#include "Common/ConversionResultTaskHelper.h"
|
|
||||||
#include "Common/CalculatorButtonUser.h"
|
#include "Common/CalculatorButtonUser.h"
|
||||||
#include "Common/NavCategory.h"
|
#include "Common/NavCategory.h"
|
||||||
|
|
||||||
@ -264,8 +263,6 @@ namespace CalculatorApp
|
|||||||
void OnButtonPressed(Platform::Object ^ parameter);
|
void OnButtonPressed(Platform::Object ^ parameter);
|
||||||
Platform::String ^ ConvertToLocalizedString(const std::wstring& stringToLocalize, bool allowPartialStrings);
|
Platform::String ^ ConvertToLocalizedString(const std::wstring& stringToLocalize, bool allowPartialStrings);
|
||||||
|
|
||||||
void StartConversionResultTimer();
|
|
||||||
|
|
||||||
std::shared_ptr<UnitConversionManager::IUnitConverter> m_model;
|
std::shared_ptr<UnitConversionManager::IUnitConverter> m_model;
|
||||||
wchar_t m_decimalSeparator;
|
wchar_t m_decimalSeparator;
|
||||||
|
|
||||||
@ -326,8 +323,6 @@ namespace CalculatorApp
|
|||||||
Platform::String ^ m_lastAnnouncedConversionResult;
|
Platform::String ^ m_lastAnnouncedConversionResult;
|
||||||
|
|
||||||
bool m_isCurrencyDataLoaded;
|
bool m_isCurrencyDataLoaded;
|
||||||
|
|
||||||
std::unique_ptr<CalculatorApp::Common::ConversionResultTaskHelper> m_conversionResultTaskHelper;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class UnitConverterVMCallback : public UnitConversionManager::IUnitConverterVMCallback
|
class UnitConverterVMCallback : public UnitConversionManager::IUnitConverterVMCallback
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="Microsoft.UI.Xaml" version="2.2.190830001" targetFramework="native" />
|
|
||||||
</packages>
|
|
@ -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;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -236,11 +236,13 @@
|
|||||||
<DependentUpon>AboutFlyout.xaml</DependentUpon>
|
<DependentUpon>AboutFlyout.xaml</DependentUpon>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Common\AppLifecycleLogger.h" />
|
<ClInclude Include="Common\AppLifecycleLogger.h" />
|
||||||
|
<ClInclude Include="Common\KeyboardShortcutManager.h" />
|
||||||
|
<ClInclude Include="Common\ValidatingConverters.h" />
|
||||||
|
<ClInclude Include="Common\ViewState.h" />
|
||||||
<ClInclude Include="Controls\CalculationResultAutomationPeer.h" />
|
<ClInclude Include="Controls\CalculationResultAutomationPeer.h" />
|
||||||
<ClInclude Include="Controls\MathRichEditBox.h" />
|
<ClInclude Include="Controls\MathRichEditBox.h" />
|
||||||
<ClInclude Include="Controls\OverflowTextBlockAutomationPeer.h" />
|
<ClInclude Include="Controls\OverflowTextBlockAutomationPeer.h" />
|
||||||
<ClInclude Include="Common\AlwaysSelectedCollectionView.h" />
|
<ClInclude Include="Common\AlwaysSelectedCollectionView.h" />
|
||||||
<ClInclude Include="Common\BindableBase.h" />
|
|
||||||
<ClInclude Include="Controls\CalculationResult.h" />
|
<ClInclude Include="Controls\CalculationResult.h" />
|
||||||
<ClInclude Include="Controls\CalculatorButton.h" />
|
<ClInclude Include="Controls\CalculatorButton.h" />
|
||||||
<ClInclude Include="Controls\FlipButtons.h" />
|
<ClInclude Include="Controls\FlipButtons.h" />
|
||||||
@ -399,10 +401,11 @@
|
|||||||
<DependentUpon>App.xaml</DependentUpon>
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Common\AppLifecycleLogger.cpp" />
|
<ClCompile Include="Common\AppLifecycleLogger.cpp" />
|
||||||
|
<ClCompile Include="Common\KeyboardShortcutManager.cpp" />
|
||||||
|
<ClCompile Include="Common\ViewState.cpp" />
|
||||||
<ClCompile Include="Controls\CalculationResultAutomationPeer.cpp" />
|
<ClCompile Include="Controls\CalculationResultAutomationPeer.cpp" />
|
||||||
<ClCompile Include="Controls\MathRichEditBox.cpp" />
|
<ClCompile Include="Controls\MathRichEditBox.cpp" />
|
||||||
<ClCompile Include="Controls\OverflowTextBlockAutomationPeer.cpp" />
|
<ClCompile Include="Controls\OverflowTextBlockAutomationPeer.cpp" />
|
||||||
<ClCompile Include="Common\BindableBase.cpp" />
|
|
||||||
<ClCompile Include="Controls\CalculationResult.cpp" />
|
<ClCompile Include="Controls\CalculationResult.cpp" />
|
||||||
<ClCompile Include="Controls\CalculatorButton.cpp" />
|
<ClCompile Include="Controls\CalculatorButton.cpp" />
|
||||||
<ClCompile Include="Controls\FlipButtons.cpp" />
|
<ClCompile Include="Controls\FlipButtons.cpp" />
|
||||||
|
@ -231,9 +231,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="App.xaml.cpp" />
|
<ClCompile Include="App.xaml.cpp" />
|
||||||
<ClCompile Include="pch.cpp" />
|
<ClCompile Include="pch.cpp" />
|
||||||
<ClCompile Include="Common\BindableBase.cpp">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Controls\CalculationResult.cpp">
|
<ClCompile Include="Controls\CalculationResult.cpp">
|
||||||
<Filter>Controls</Filter>
|
<Filter>Controls</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -327,6 +324,10 @@
|
|||||||
<ClCompile Include="Utils\VisualTree.cpp">
|
<ClCompile Include="Utils\VisualTree.cpp">
|
||||||
<Filter>Utils</Filter>
|
<Filter>Utils</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Common\KeyboardShortcutManager.cpp">
|
||||||
|
<Filter>Common</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="Common\ViewState.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="pch.h" />
|
<ClInclude Include="pch.h" />
|
||||||
@ -334,9 +335,6 @@
|
|||||||
<ClInclude Include="Common\AlwaysSelectedCollectionView.h">
|
<ClInclude Include="Common\AlwaysSelectedCollectionView.h">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Common\BindableBase.h">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Controls\CalculationResult.h">
|
<ClInclude Include="Controls\CalculationResult.h">
|
||||||
<Filter>Controls</Filter>
|
<Filter>Controls</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -430,6 +428,13 @@
|
|||||||
<ClInclude Include="Utils\VisualTree.h">
|
<ClInclude Include="Utils\VisualTree.h">
|
||||||
<Filter>Utils</Filter>
|
<Filter>Utils</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Common\KeyboardShortcutManager.h">
|
||||||
|
<Filter>Common</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Common\ValidatingConverters.h">
|
||||||
|
<Filter>Common</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Common\ViewState.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AppxManifest Include="Package.appxmanifest" />
|
<AppxManifest Include="Package.appxmanifest" />
|
||||||
@ -515,6 +520,7 @@
|
|||||||
<Page Include="Views\GraphingCalculator\GraphingNumPad.xaml">
|
<Page Include="Views\GraphingCalculator\GraphingNumPad.xaml">
|
||||||
<Filter>Views\GraphingCalculator</Filter>
|
<Filter>Views\GraphingCalculator</Filter>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)DensityStyles\Compact.xaml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PRIResource Include="Resources\en-US\CEngineStrings.resw">
|
<PRIResource Include="Resources\en-US\CEngineStrings.resw">
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "AppLifecycleLogger.h"
|
#include "AppLifecycleLogger.h"
|
||||||
#include "CalcViewModel/Common/TraceActivity.h"
|
#include <winmeta.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace winrt;
|
using namespace winrt;
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
#include "BindableBase.h"
|
|
||||||
|
|
||||||
using namespace CalculatorApp::Common;
|
|
||||||
|
|
||||||
using namespace Platform;
|
|
||||||
using namespace Windows::UI::Xaml::Data;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Notifies listeners that a property value has changed.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="propertyName">Name of the property used to notify listeners.</param>
|
|
||||||
void BindableBase::OnPropertyChanged(String ^ propertyName)
|
|
||||||
{
|
|
||||||
PropertyChanged(this, ref new PropertyChangedEventArgs(propertyName));
|
|
||||||
}
|
|
||||||
|
|
||||||
Windows::UI::Xaml::Data::ICustomProperty ^ BindableBase::GetCustomProperty(Platform::String ^ name)
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Windows::UI::Xaml::Data::ICustomProperty ^ BindableBase::GetIndexedProperty(Platform::String ^ name, Windows::UI::Xaml::Interop::TypeName type)
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Platform::String ^ BindableBase::GetStringRepresentation()
|
|
||||||
{
|
|
||||||
return this->ToString();
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace CalculatorApp
|
|
||||||
{
|
|
||||||
namespace Common
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Implementation of <see cref="INotifyPropertyChanged"/> to simplify models.
|
|
||||||
/// </summary>
|
|
||||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class BindableBase : Windows::UI::Xaml::DependencyObject,
|
|
||||||
Windows::UI::Xaml::Data::INotifyPropertyChanged,
|
|
||||||
Windows::UI::Xaml::Data::ICustomPropertyProvider
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual event Windows::UI::Xaml::Data::PropertyChangedEventHandler ^ PropertyChanged;
|
|
||||||
|
|
||||||
public:
|
|
||||||
// ICustomPropertyProvider
|
|
||||||
virtual Windows::UI::Xaml::Data::ICustomProperty ^ GetCustomProperty(Platform::String ^ name);
|
|
||||||
virtual Windows::UI::Xaml::Data::ICustomProperty ^ GetIndexedProperty(Platform::String ^ name, Windows::UI::Xaml::Interop::TypeName type);
|
|
||||||
virtual Platform::String ^ GetStringRepresentation();
|
|
||||||
|
|
||||||
property Windows::UI::Xaml::Interop::TypeName Type
|
|
||||||
{
|
|
||||||
virtual Windows::UI::Xaml::Interop::TypeName get()
|
|
||||||
{
|
|
||||||
return this->GetType();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void OnPropertyChanged(Platform::String ^ propertyName);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "KeyboardShortcutManager.h"
|
#include "KeyboardShortcutManager.h"
|
||||||
#include "AppResourceProvider.h"
|
#include "CalcViewModel/Common/AppResourceProvider.h"
|
||||||
#include "ApplicationViewModel.h"
|
#include "CalcViewModel/ApplicationViewModel.h"
|
||||||
#include "LocalizationSettings.h"
|
#include "CalcViewModel/Common/LocalizationSettings.h"
|
||||||
|
|
||||||
using namespace Concurrency;
|
using namespace Concurrency;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Utils.h"
|
#include "CalcViewModel/Common/Utils.h"
|
||||||
#include "MyVirtualKey.h"
|
#include "CalcViewModel/Common/MyVirtualKey.h"
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
{
|
{
|
19
src/Calculator/Common/ViewState.cpp
Normal file
19
src/Calculator/Common/ViewState.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
#include "ViewState.h"
|
||||||
|
|
||||||
|
namespace CalculatorApp
|
||||||
|
{
|
||||||
|
namespace ViewState
|
||||||
|
{
|
||||||
|
Platform::StringReference Snap(L"Snap");
|
||||||
|
Platform::StringReference DockedView(L"DockedView");
|
||||||
|
|
||||||
|
bool IsValidViewState(Platform::String ^ viewState)
|
||||||
|
{
|
||||||
|
return viewState->Equals(ViewState::Snap) || viewState->Equals(ViewState::DockedView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
src/Calculator/Common/ViewState.h
Normal file
15
src/Calculator/Common/ViewState.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace CalculatorApp
|
||||||
|
{
|
||||||
|
namespace ViewState
|
||||||
|
{
|
||||||
|
extern Platform::StringReference Snap;
|
||||||
|
extern Platform::StringReference DockedView;
|
||||||
|
|
||||||
|
bool IsValidViewState(Platform::String ^ viewState);
|
||||||
|
}
|
||||||
|
}
|
@ -26,16 +26,12 @@ using namespace Windows::UI::Xaml::Automation::Peers;
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, IsActive);
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, IsActive);
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, AccentColor);
|
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, MinFontSize);
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, MinFontSize);
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, MaxFontSize);
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, MaxFontSize);
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, DisplayMargin);
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, DisplayMargin);
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, MaxExpressionHistoryCharacters);
|
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, ExpressionVisibility);
|
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, DisplayValue);
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, DisplayValue);
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, IsInError);
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, IsInError);
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, IsOperatorCommand);
|
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, IsOperatorCommand);
|
||||||
DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, DisplayStringExpression);
|
|
||||||
|
|
||||||
#define SCALEFACTOR 0.357143
|
#define SCALEFACTOR 0.357143
|
||||||
#define SMALLHEIGHTSCALEFACTOR 0
|
#define SMALLHEIGHTSCALEFACTOR 0
|
||||||
@ -46,15 +42,13 @@ DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, DisplayStringExpression);
|
|||||||
#define WIDTHTOFONTOFFSET 3
|
#define WIDTHTOFONTOFFSET 3
|
||||||
#define WIDTHCUTOFF 50
|
#define WIDTHCUTOFF 50
|
||||||
#define FONTTOLERANCE 0.001
|
#define FONTTOLERANCE 0.001
|
||||||
|
#define SCROLL_RATIO 0.7
|
||||||
|
|
||||||
// We need a safety margin to guarantee we correctly always show/hide ScrollLeft and ScrollRight buttons when necessary.
|
// We need a safety margin to guarantee we correctly always show/hide ScrollLeft and ScrollRight buttons when necessary.
|
||||||
// In rare cases, ScrollViewer::HorizontalOffset is a little low by a few (sub)pixels when users scroll to one of the extremity
|
// In rare cases, ScrollViewer::HorizontalOffset is a little low by a few (sub)pixels when users scroll to one of the extremity
|
||||||
// and no events are launched when they scroll again in the same direction
|
// and no events are launched when they scroll again in the same direction
|
||||||
#define SCROLL_BUTTONS_APPROXIMATION_RANGE 4
|
#define SCROLL_BUTTONS_APPROXIMATION_RANGE 4
|
||||||
|
|
||||||
StringReference CalculationResult::s_FocusedState(L"Focused");
|
|
||||||
StringReference CalculationResult::s_UnfocusedState(L"Unfocused");
|
|
||||||
|
|
||||||
CalculationResult::CalculationResult()
|
CalculationResult::CalculationResult()
|
||||||
: m_isScalingText(false)
|
: m_isScalingText(false)
|
||||||
, m_haveCalculatedMax(false)
|
, m_haveCalculatedMax(false)
|
||||||
@ -123,12 +117,12 @@ void CalculationResult::OnApplyTemplate()
|
|||||||
m_scrollLeft = dynamic_cast<HyperlinkButton ^>(GetTemplateChild("ScrollLeft"));
|
m_scrollLeft = dynamic_cast<HyperlinkButton ^>(GetTemplateChild("ScrollLeft"));
|
||||||
if (m_scrollLeft)
|
if (m_scrollLeft)
|
||||||
{
|
{
|
||||||
m_scrollLeftClickToken = m_scrollLeft->Click += ref new RoutedEventHandler(this, &CalculationResult::OnScrollClick);
|
m_scrollLeftClickToken = m_scrollLeft->Click += ref new RoutedEventHandler(this, &CalculationResult::OnScrollLeftClick);
|
||||||
}
|
}
|
||||||
m_scrollRight = dynamic_cast<HyperlinkButton ^>(GetTemplateChild("ScrollRight"));
|
m_scrollRight = dynamic_cast<HyperlinkButton ^>(GetTemplateChild("ScrollRight"));
|
||||||
if (m_scrollRight)
|
if (m_scrollRight)
|
||||||
{
|
{
|
||||||
m_scrollRightClickToken = m_scrollRight->Click += ref new RoutedEventHandler(this, &CalculationResult::OnScrollClick);
|
m_scrollRightClickToken = m_scrollRight->Click += ref new RoutedEventHandler(this, &CalculationResult::OnScrollRightClick);
|
||||||
}
|
}
|
||||||
m_textBlock = dynamic_cast<TextBlock ^>(GetTemplateChild("NormalOutput"));
|
m_textBlock = dynamic_cast<TextBlock ^>(GetTemplateChild("NormalOutput"));
|
||||||
if (m_textBlock)
|
if (m_textBlock)
|
||||||
@ -139,7 +133,6 @@ void CalculationResult::OnApplyTemplate()
|
|||||||
}
|
}
|
||||||
UpdateVisualState();
|
UpdateVisualState();
|
||||||
UpdateTextState();
|
UpdateTextState();
|
||||||
VisualStateManager::GoToState(this, s_UnfocusedState, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculationResult::OnTextContainerLayoutUpdated(Object ^ /*sender*/, Object ^ /*e*/)
|
void CalculationResult::OnTextContainerLayoutUpdated(Object ^ /*sender*/, Object ^ /*e*/)
|
||||||
@ -160,16 +153,6 @@ void CalculationResult::OnIsActivePropertyChanged(bool /*oldValue*/, bool /*newV
|
|||||||
UpdateVisualState();
|
UpdateVisualState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculationResult::OnAccentColorPropertyChanged(Brush ^ /*oldValue*/, Brush ^ /*newValue*/)
|
|
||||||
{
|
|
||||||
// Force the "Active" transition to happen again
|
|
||||||
if (IsActive)
|
|
||||||
{
|
|
||||||
VisualStateManager::GoToState(this, "Normal", true);
|
|
||||||
VisualStateManager::GoToState(this, "Active", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalculationResult::OnDisplayValuePropertyChanged(String ^ /*oldValue*/, String ^ /*newValue*/)
|
void CalculationResult::OnDisplayValuePropertyChanged(String ^ /*oldValue*/, String ^ /*newValue*/)
|
||||||
{
|
{
|
||||||
UpdateTextState();
|
UpdateTextState();
|
||||||
@ -291,7 +274,7 @@ void CalculationResult::ScrollLeft()
|
|||||||
}
|
}
|
||||||
if (m_textContainer->HorizontalOffset > 0)
|
if (m_textContainer->HorizontalOffset > 0)
|
||||||
{
|
{
|
||||||
double offset = m_textContainer->HorizontalOffset - (scrollRatio * m_textContainer->ViewportWidth);
|
double offset = m_textContainer->HorizontalOffset - (SCROLL_RATIO * m_textContainer->ViewportWidth);
|
||||||
m_textContainer->ChangeView(offset, nullptr, nullptr);
|
m_textContainer->ChangeView(offset, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -305,7 +288,7 @@ void CalculationResult::ScrollRight()
|
|||||||
|
|
||||||
if (m_textContainer->HorizontalOffset < m_textContainer->ExtentWidth - m_textContainer->ViewportWidth)
|
if (m_textContainer->HorizontalOffset < m_textContainer->ExtentWidth - m_textContainer->ViewportWidth)
|
||||||
{
|
{
|
||||||
double offset = m_textContainer->HorizontalOffset + (scrollRatio * m_textContainer->ViewportWidth);
|
double offset = m_textContainer->HorizontalOffset + (SCROLL_RATIO * m_textContainer->ViewportWidth);
|
||||||
m_textContainer->ChangeView(offset, nullptr, nullptr);
|
m_textContainer->ChangeView(offset, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -323,17 +306,14 @@ void CalculationResult::OnKeyDown(KeyRoutedEventArgs ^ e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculationResult::OnScrollClick(Object ^ sender, RoutedEventArgs ^ /*e*/)
|
void CalculationResult::OnScrollLeftClick(Object ^ sender, RoutedEventArgs ^ /*e*/)
|
||||||
{
|
{
|
||||||
auto clicked = dynamic_cast<HyperlinkButton ^>(sender);
|
ScrollLeft();
|
||||||
if (clicked == m_scrollLeft)
|
}
|
||||||
{
|
|
||||||
this->ScrollLeft();
|
void CalculationResult::OnScrollRightClick(Object ^ sender, RoutedEventArgs ^ /*e*/)
|
||||||
}
|
{
|
||||||
else
|
ScrollRight();
|
||||||
{
|
|
||||||
this->ScrollRight();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculationResult::UpdateScrollButtons()
|
void CalculationResult::UpdateScrollButtons()
|
||||||
@ -392,19 +372,6 @@ void CalculationResult::OnRightTapped(RightTappedRoutedEventArgs ^ e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculationResult::OnGotFocus(RoutedEventArgs ^ e)
|
|
||||||
{
|
|
||||||
if (this->FocusState == ::FocusState::Keyboard)
|
|
||||||
{
|
|
||||||
VisualStateManager::GoToState(this, s_FocusedState, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalculationResult::OnLostFocus(RoutedEventArgs ^ e)
|
|
||||||
{
|
|
||||||
VisualStateManager::GoToState(this, s_UnfocusedState, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
AutomationPeer ^ CalculationResult::OnCreateAutomationPeer()
|
AutomationPeer ^ CalculationResult::OnCreateAutomationPeer()
|
||||||
{
|
{
|
||||||
return ref new CalculationResultAutomationPeer(this);
|
return ref new CalculationResultAutomationPeer(this);
|
||||||
|
@ -20,15 +20,11 @@ namespace CalculatorApp
|
|||||||
|
|
||||||
DEPENDENCY_PROPERTY_OWNER(CalculationResult);
|
DEPENDENCY_PROPERTY_OWNER(CalculationResult);
|
||||||
|
|
||||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Visibility, ExpressionVisibility);
|
|
||||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, MinFontSize, 0.0);
|
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, MinFontSize, 0.0);
|
||||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, MaxFontSize, 30.0);
|
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, MaxFontSize, 30.0);
|
||||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Thickness, DisplayMargin);
|
DEPENDENCY_PROPERTY(Windows::UI::Xaml::Thickness, DisplayMargin);
|
||||||
DEPENDENCY_PROPERTY(int, MaxExpressionHistoryCharacters);
|
|
||||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, IsActive);
|
DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, IsActive);
|
||||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(Windows::UI::Xaml::Media::Brush ^, AccentColor);
|
|
||||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(Platform::String ^, DisplayValue);
|
DEPENDENCY_PROPERTY_WITH_CALLBACK(Platform::String ^, DisplayValue);
|
||||||
DEPENDENCY_PROPERTY(Platform::String ^, DisplayStringExpression);
|
|
||||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, IsInError);
|
DEPENDENCY_PROPERTY_WITH_CALLBACK(bool, IsInError);
|
||||||
DEPENDENCY_PROPERTY_WITH_DEFAULT(bool, IsOperatorCommand, false);
|
DEPENDENCY_PROPERTY_WITH_DEFAULT(bool, IsOperatorCommand, false);
|
||||||
|
|
||||||
@ -43,14 +39,11 @@ namespace CalculatorApp
|
|||||||
virtual void OnApplyTemplate() override;
|
virtual void OnApplyTemplate() override;
|
||||||
virtual void OnTapped(Windows::UI::Xaml::Input::TappedRoutedEventArgs ^ e) override;
|
virtual void OnTapped(Windows::UI::Xaml::Input::TappedRoutedEventArgs ^ e) override;
|
||||||
virtual void OnRightTapped(Windows::UI::Xaml::Input::RightTappedRoutedEventArgs ^ e) override;
|
virtual void OnRightTapped(Windows::UI::Xaml::Input::RightTappedRoutedEventArgs ^ e) override;
|
||||||
virtual void OnGotFocus(Windows::UI::Xaml::RoutedEventArgs ^ e) override;
|
|
||||||
virtual void OnLostFocus(Windows::UI::Xaml::RoutedEventArgs ^ e) override;
|
|
||||||
|
|
||||||
virtual Windows::UI::Xaml::Automation::Peers::AutomationPeer ^ OnCreateAutomationPeer() override;
|
virtual Windows::UI::Xaml::Automation::Peers::AutomationPeer ^ OnCreateAutomationPeer() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnIsActivePropertyChanged(bool oldValue, bool newValue);
|
void OnIsActivePropertyChanged(bool oldValue, bool newValue);
|
||||||
void OnAccentColorPropertyChanged(Windows::UI::Xaml::Media::Brush ^ oldValue, Windows::UI::Xaml::Media::Brush ^ newValue);
|
|
||||||
void OnDisplayValuePropertyChanged(Platform::String ^ oldValue, Platform::String ^ newValue);
|
void OnDisplayValuePropertyChanged(Platform::String ^ oldValue, Platform::String ^ newValue);
|
||||||
void OnIsInErrorPropertyChanged(bool oldValue, bool newValue);
|
void OnIsInErrorPropertyChanged(bool oldValue, bool newValue);
|
||||||
void OnMinFontSizePropertyChanged(double oldValue, double newValue);
|
void OnMinFontSizePropertyChanged(double oldValue, double newValue);
|
||||||
@ -60,22 +53,21 @@ namespace CalculatorApp
|
|||||||
void OnTextContainerLayoutUpdated(Object ^ sender, Object ^ e);
|
void OnTextContainerLayoutUpdated(Object ^ sender, Object ^ e);
|
||||||
void OnTextContainerOnViewChanged(Object ^ sender, Windows::UI::Xaml::Controls::ScrollViewerViewChangedEventArgs ^ e);
|
void OnTextContainerOnViewChanged(Object ^ sender, Windows::UI::Xaml::Controls::ScrollViewerViewChangedEventArgs ^ e);
|
||||||
void UpdateVisualState();
|
void UpdateVisualState();
|
||||||
void OnScrollClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
void UpdateAllState();
|
||||||
|
void OnScrollLeftClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||||
|
void OnScrollRightClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||||
|
void OnPointerEntered(Platform::Object ^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e);
|
||||||
|
void OnPointerExited(Platform::Object ^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ e);
|
||||||
void ModifyFontAndMargin(Windows::UI::Xaml::Controls::TextBlock ^ textBlock, double fontChange);
|
void ModifyFontAndMargin(Windows::UI::Xaml::Controls::TextBlock ^ textBlock, double fontChange);
|
||||||
void UpdateScrollButtons();
|
void UpdateScrollButtons();
|
||||||
void ScrollLeft();
|
void ScrollLeft();
|
||||||
void ScrollRight();
|
void ScrollRight();
|
||||||
void RaiseSelectedEvent();
|
void RaiseSelectedEvent();
|
||||||
|
|
||||||
// Visual states for focused
|
|
||||||
static Platform::StringReference s_FocusedState;
|
|
||||||
static Platform::StringReference s_UnfocusedState;
|
|
||||||
|
|
||||||
Windows::UI::Xaml::Controls::ScrollViewer ^ m_textContainer;
|
Windows::UI::Xaml::Controls::ScrollViewer ^ m_textContainer;
|
||||||
Windows::UI::Xaml::Controls::TextBlock ^ m_textBlock;
|
Windows::UI::Xaml::Controls::TextBlock ^ m_textBlock;
|
||||||
Windows::UI::Xaml::Controls::HyperlinkButton ^ m_scrollLeft;
|
Windows::UI::Xaml::Controls::HyperlinkButton ^ m_scrollLeft;
|
||||||
Windows::UI::Xaml::Controls::HyperlinkButton ^ m_scrollRight;
|
Windows::UI::Xaml::Controls::HyperlinkButton ^ m_scrollRight;
|
||||||
double scrollRatio = 0.7;
|
|
||||||
bool m_isScalingText;
|
bool m_isScalingText;
|
||||||
bool m_haveCalculatedMax;
|
bool m_haveCalculatedMax;
|
||||||
Windows::Foundation::EventRegistrationToken m_textContainerLayoutChangedToken;
|
Windows::Foundation::EventRegistrationToken m_textContainerLayoutChangedToken;
|
||||||
|
@ -547,7 +547,6 @@
|
|||||||
</VisualState.StateTriggers>
|
</VisualState.StateTriggers>
|
||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Target="Results.MaxFontSize" Value="72"/>
|
<Setter Target="Results.MaxFontSize" Value="72"/>
|
||||||
<Setter Target="Results.MaxExpressionHistoryCharacters" Value="51"/>
|
|
||||||
<Setter Target="RowResult.MinHeight" Value="108"/>
|
<Setter Target="RowResult.MinHeight" Value="108"/>
|
||||||
<Setter Target="RowResult.Height" Value="72*"/>
|
<Setter Target="RowResult.Height" Value="72*"/>
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
@ -558,7 +557,6 @@
|
|||||||
</VisualState.StateTriggers>
|
</VisualState.StateTriggers>
|
||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Target="Results.MaxFontSize" Value="46"/>
|
<Setter Target="Results.MaxFontSize" Value="46"/>
|
||||||
<Setter Target="Results.MaxExpressionHistoryCharacters" Value="30"/>
|
|
||||||
<Setter Target="RowResult.MinHeight" Value="72"/>
|
<Setter Target="RowResult.MinHeight" Value="72"/>
|
||||||
<Setter Target="RowResult.Height" Value="72*"/>
|
<Setter Target="RowResult.Height" Value="72*"/>
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
@ -569,7 +567,6 @@
|
|||||||
</VisualState.StateTriggers>
|
</VisualState.StateTriggers>
|
||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Target="Results.MaxFontSize" Value="26"/>
|
<Setter Target="Results.MaxFontSize" Value="26"/>
|
||||||
<Setter Target="Results.MaxExpressionHistoryCharacters" Value="30"/>
|
|
||||||
<Setter Target="RowResult.MinHeight" Value="42"/>
|
<Setter Target="RowResult.MinHeight" Value="42"/>
|
||||||
<Setter Target="RowResult.Height" Value="42*"/>
|
<Setter Target="RowResult.Height" Value="42*"/>
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
@ -615,9 +612,7 @@
|
|||||||
AutomationProperties.Name="{x:Bind Model.CalculationResultAutomationName, Mode=OneWay}"
|
AutomationProperties.Name="{x:Bind Model.CalculationResultAutomationName, Mode=OneWay}"
|
||||||
ContextCanceled="OnContextCanceled"
|
ContextCanceled="OnContextCanceled"
|
||||||
ContextRequested="OnContextRequested"
|
ContextRequested="OnContextRequested"
|
||||||
DisplayStringExpression="{x:Bind Model.DisplayStringExpression, Mode=OneWay}"
|
|
||||||
DisplayValue="{x:Bind Model.DisplayValue, Mode=OneWay}"
|
DisplayValue="{x:Bind Model.DisplayValue, Mode=OneWay}"
|
||||||
ExpressionVisibility="Visible"
|
|
||||||
IsInError="{x:Bind Model.IsInError, Mode=OneWay}"
|
IsInError="{x:Bind Model.IsInError, Mode=OneWay}"
|
||||||
IsOperatorCommand="{x:Bind Model.IsOperatorCommand, Mode=OneWay}"
|
IsOperatorCommand="{x:Bind Model.IsOperatorCommand, Mode=OneWay}"
|
||||||
TabIndex="1"
|
TabIndex="1"
|
||||||
|
@ -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;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "CalculatorScientificOperators.xaml.h"
|
#include "CalculatorScientificOperators.xaml.h"
|
||||||
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
|
#include "Common/KeyboardShortcutManager.h"
|
||||||
#include "CalcViewModel/Common/TraceLogger.h"
|
#include "CalcViewModel/Common/TraceLogger.h"
|
||||||
#include "Controls/CalculatorButton.h"
|
#include "Controls/CalculatorButton.h"
|
||||||
#include "CalcViewModel/StandardCalculatorViewModel.h"
|
#include "CalcViewModel/StandardCalculatorViewModel.h"
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "MainPage.xaml.h"
|
#include "MainPage.xaml.h"
|
||||||
#include "CalcViewModel/Common/TraceLogger.h"
|
#include "CalcViewModel/Common/TraceLogger.h"
|
||||||
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
|
|
||||||
#include "CalcViewModel/Common/LocalizationService.h"
|
#include "CalcViewModel/Common/LocalizationService.h"
|
||||||
#include "CalcViewModel/Common/Automation/NarratorNotifier.h"
|
#include "CalcViewModel/Common/Automation/NarratorNotifier.h"
|
||||||
#include "CalcViewModel/Common/AppResourceProvider.h"
|
#include "CalcViewModel/Common/AppResourceProvider.h"
|
||||||
@ -12,6 +11,8 @@
|
|||||||
#include "Converters/BooleanToVisibilityConverter.h"
|
#include "Converters/BooleanToVisibilityConverter.h"
|
||||||
#include "CalcViewModel/Common/LocalizationStringUtil.h"
|
#include "CalcViewModel/Common/LocalizationStringUtil.h"
|
||||||
#include "Common/AppLifecycleLogger.h"
|
#include "Common/AppLifecycleLogger.h"
|
||||||
|
#include "Common/KeyboardShortcutManager.h"
|
||||||
|
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
using namespace CalculatorApp::Common;
|
using namespace CalculatorApp::Common;
|
||||||
using namespace CalculatorApp::Common::Automation;
|
using namespace CalculatorApp::Common::Automation;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Views/NumberPad.g.h"
|
#include "Views/NumberPad.g.h"
|
||||||
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
|
#include "Common/KeyboardShortcutManager.h"
|
||||||
#include "CalcViewModel/Common/NumberBase.h"
|
#include "CalcViewModel/Common/NumberBase.h"
|
||||||
#include "CalcManager/Header Files/RadixType.h"
|
#include "CalcManager/Header Files/RadixType.h"
|
||||||
|
|
||||||
|
@ -559,7 +559,6 @@
|
|||||||
ContextCanceled="OnContextCanceled"
|
ContextCanceled="OnContextCanceled"
|
||||||
ContextRequested="OnContextRequested"
|
ContextRequested="OnContextRequested"
|
||||||
DisplayValue="{x:Bind Model.Value1, Mode=OneWay}"
|
DisplayValue="{x:Bind Model.Value1, Mode=OneWay}"
|
||||||
ExpressionVisibility="Collapsed"
|
|
||||||
FlowDirection="{x:Bind LayoutDirection}"
|
FlowDirection="{x:Bind LayoutDirection}"
|
||||||
IsActive="{Binding Value1Active, Mode=TwoWay}"
|
IsActive="{Binding Value1Active, Mode=TwoWay}"
|
||||||
KeyDown="OnValueKeyDown"
|
KeyDown="OnValueKeyDown"
|
||||||
@ -610,7 +609,6 @@
|
|||||||
ContextCanceled="OnContextCanceled"
|
ContextCanceled="OnContextCanceled"
|
||||||
ContextRequested="OnContextRequested"
|
ContextRequested="OnContextRequested"
|
||||||
DisplayValue="{x:Bind Model.Value2, Mode=OneWay}"
|
DisplayValue="{x:Bind Model.Value2, Mode=OneWay}"
|
||||||
ExpressionVisibility="Collapsed"
|
|
||||||
FlowDirection="{x:Bind LayoutDirection}"
|
FlowDirection="{x:Bind LayoutDirection}"
|
||||||
IsActive="{Binding Value2Active, Mode=TwoWay}"
|
IsActive="{Binding Value2Active, Mode=TwoWay}"
|
||||||
KeyDown="OnValueKeyDown"
|
KeyDown="OnValueKeyDown"
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
#include "Controls/CalculationResult.h"
|
#include "Controls/CalculationResult.h"
|
||||||
#include "Controls/CalculatorButton.h"
|
#include "Controls/CalculatorButton.h"
|
||||||
#include "CalcViewModel/Common/CopyPasteManager.h"
|
#include "CalcViewModel/Common/CopyPasteManager.h"
|
||||||
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
|
|
||||||
#include "CalcViewModel/Common/LocalizationService.h"
|
#include "CalcViewModel/Common/LocalizationService.h"
|
||||||
#include "CalcViewModel/Common/LocalizationSettings.h"
|
#include "CalcViewModel/Common/LocalizationSettings.h"
|
||||||
|
#include "Common/KeyboardShortcutManager.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace CalculatorApp;
|
using namespace CalculatorApp;
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "Views/UnitConverter.g.h"
|
#include "Views/UnitConverter.g.h"
|
||||||
#include "Common/AlwaysSelectedCollectionView.h"
|
#include "Common/AlwaysSelectedCollectionView.h"
|
||||||
#include "CalcViewModel/Common/ValidatingConverters.h"
|
#include "Common/ValidatingConverters.h"
|
||||||
#include "Converters/BooleanToVisibilityConverter.h"
|
#include "Converters/BooleanToVisibilityConverter.h"
|
||||||
#include "Converters/VisibilityNegationConverter.h"
|
#include "Converters/VisibilityNegationConverter.h"
|
||||||
#include "CalcViewModel/UnitConverterViewModel.h"
|
#include "CalcViewModel/UnitConverterViewModel.h"
|
||||||
@ -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);
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "WindowFrameService.h"
|
#include "WindowFrameService.h"
|
||||||
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
|
#include "Common/KeyboardShortcutManager.h"
|
||||||
#include "CalcViewModel/Common/TraceLogger.h"
|
#include "CalcViewModel/Common/TraceLogger.h"
|
||||||
|
|
||||||
using namespace concurrency;
|
using namespace concurrency;
|
||||||
|
@ -103,10 +103,6 @@ namespace CalculatorUnitTests
|
|||||||
{
|
{
|
||||||
VERIFY_ARE_EQUAL(Platform::StringReference(currentItem->expectedPrimaryDisplay.c_str()), viewModel->DisplayValue);
|
VERIFY_ARE_EQUAL(Platform::StringReference(currentItem->expectedPrimaryDisplay.c_str()), viewModel->DisplayValue);
|
||||||
}
|
}
|
||||||
if (currentItem->expectedExpressions != L"N/A" && viewModel->DisplayStringExpression != nullptr)
|
|
||||||
{
|
|
||||||
VERIFY_ARE_EQUAL(Platform::StringReference(currentItem->expectedExpressions.c_str()), viewModel->DisplayStringExpression);
|
|
||||||
}
|
|
||||||
currentItem++;
|
currentItem++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,19 +118,13 @@ namespace CalculatorUnitTests
|
|||||||
m_decimalSeparator = ref new Platform::String(m_engineResourceProvider->GetCEngineString(L"sDecimal").c_str());
|
m_decimalSeparator = ref new Platform::String(m_engineResourceProvider->GetCEngineString(L"sDecimal").c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValidateViewModelValueAndExpression(String ^ value, String ^ expression = nullptr)
|
void ValidateViewModelValue(String ^ value)
|
||||||
{
|
{
|
||||||
String ^ displayValue = m_viewModel->DisplayValue;
|
String ^ displayValue = m_viewModel->DisplayValue;
|
||||||
String ^ displayExpression = m_viewModel->DisplayStringExpression;
|
|
||||||
if (value != nullptr)
|
if (value != nullptr)
|
||||||
{
|
{
|
||||||
VERIFY_ARE_EQUAL(value, displayValue);
|
VERIFY_ARE_EQUAL(value, displayValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expression != nullptr)
|
|
||||||
{
|
|
||||||
VERIFY_ARE_EQUAL(expression, displayExpression);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValidateViewModelValueAndSecondaryExpression(String ^ value, String ^ expression = nullptr)
|
void ValidateViewModelValueAndSecondaryExpression(String ^ value, String ^ expression = nullptr)
|
||||||
@ -167,7 +157,6 @@ namespace CalculatorUnitTests
|
|||||||
StandardCalculatorViewModel ^ vmconstructortest = ref new StandardCalculatorViewModel();
|
StandardCalculatorViewModel ^ vmconstructortest = ref new StandardCalculatorViewModel();
|
||||||
vmconstructortest->IsStandard = true;
|
vmconstructortest->IsStandard = true;
|
||||||
String ^ displayValue = vmconstructortest->DisplayValue;
|
String ^ displayValue = vmconstructortest->DisplayValue;
|
||||||
String ^ displayExpression = vmconstructortest->DisplayStringExpression;
|
|
||||||
String ^ calculationResultAutomationName = vmconstructortest->CalculationResultAutomationName;
|
String ^ calculationResultAutomationName = vmconstructortest->CalculationResultAutomationName;
|
||||||
|
|
||||||
VERIFY_ARE_EQUAL(StringReference(L"0"), displayValue);
|
VERIFY_ARE_EQUAL(StringReference(L"0"), displayValue);
|
||||||
@ -401,18 +390,18 @@ namespace CalculatorUnitTests
|
|||||||
m_viewModel->IsScientific = false;
|
m_viewModel->IsScientific = false;
|
||||||
|
|
||||||
m_viewModel->OnPaste("-0.99");
|
m_viewModel->OnPaste("-0.99");
|
||||||
ValidateViewModelValueAndExpression("-0" + m_decimalSeparator + "99", "");
|
ValidateViewModelValue("-0" + m_decimalSeparator + "99");
|
||||||
|
|
||||||
m_viewModel->OnPaste("1+1=");
|
m_viewModel->OnPaste("1+1=");
|
||||||
ValidateViewModelValueAndExpression("2", "");
|
ValidateViewModelValue("2");
|
||||||
|
|
||||||
// This result is not obvious: it's the result of the previous operation
|
// This result is not obvious: it's the result of the previous operation
|
||||||
m_viewModel->OnPaste("0=");
|
m_viewModel->OnPaste("0=");
|
||||||
ValidateViewModelValueAndExpression("1", "");
|
ValidateViewModelValue("1");
|
||||||
|
|
||||||
// Negative value
|
// Negative value
|
||||||
m_viewModel->OnPaste("-1");
|
m_viewModel->OnPaste("-1");
|
||||||
ValidateViewModelValueAndExpression("-1", "");
|
ValidateViewModelValue("-1");
|
||||||
|
|
||||||
// Negated expression
|
// Negated expression
|
||||||
m_viewModel->OnPaste("-(1+1)");
|
m_viewModel->OnPaste("-(1+1)");
|
||||||
@ -429,24 +418,24 @@ namespace CalculatorUnitTests
|
|||||||
|
|
||||||
//// Positive exponent
|
//// Positive exponent
|
||||||
m_viewModel->OnPaste("1.23e+10");
|
m_viewModel->OnPaste("1.23e+10");
|
||||||
ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e+10", "");
|
ValidateViewModelValue("1" + m_decimalSeparator + "23e+10");
|
||||||
|
|
||||||
m_viewModel->OnPaste("1.23e10");
|
m_viewModel->OnPaste("1.23e10");
|
||||||
ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e+10", "");
|
ValidateViewModelValue("1" + m_decimalSeparator + "23e+10");
|
||||||
|
|
||||||
m_viewModel->OnPaste("135e10");
|
m_viewModel->OnPaste("135e10");
|
||||||
ValidateViewModelValueAndExpression("135" + m_decimalSeparator + "e+10", "");
|
ValidateViewModelValue("135" + m_decimalSeparator + "e+10");
|
||||||
|
|
||||||
//// Negative exponent
|
//// Negative exponent
|
||||||
m_viewModel->OnPaste("1.23e-10");
|
m_viewModel->OnPaste("1.23e-10");
|
||||||
ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e-10", "");
|
ValidateViewModelValue("1" + m_decimalSeparator + "23e-10");
|
||||||
|
|
||||||
//// Uppercase E (for exponent)
|
//// Uppercase E (for exponent)
|
||||||
m_viewModel->OnPaste("1.23E-10");
|
m_viewModel->OnPaste("1.23E-10");
|
||||||
ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e-10", "");
|
ValidateViewModelValue("1" + m_decimalSeparator + "23e-10");
|
||||||
|
|
||||||
m_viewModel->OnPaste("135E10");
|
m_viewModel->OnPaste("135E10");
|
||||||
ValidateViewModelValueAndExpression("135" + m_decimalSeparator + "e+10", "");
|
ValidateViewModelValue("135" + m_decimalSeparator + "e+10");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify Calculator CalculationResultAutomationName is set correctly
|
// Verify Calculator CalculationResultAutomationName is set correctly
|
||||||
|
Loading…
Reference in New Issue
Block a user