mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
- AlignAfterOpenBracket: AlwaysBreak
This commit is contained in:
parent
0df371f5a3
commit
60be5e8185
76 changed files with 554 additions and 415 deletions
|
@ -1,5 +1,5 @@
|
|||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Right
|
||||
|
|
|
@ -300,8 +300,8 @@ void CHistoryCollector::CompleteHistoryLine(wstring_view numStr)
|
|||
{
|
||||
if (nullptr != m_pCalcDisplay)
|
||||
{
|
||||
m_pCalcDisplay->SetExpressionDisplay(std::make_shared<CalculatorVector<std::pair<std::wstring, int>>>(),
|
||||
std::make_shared<CalculatorVector<std::shared_ptr<IExpressionCommand>>>());
|
||||
m_pCalcDisplay->SetExpressionDisplay(
|
||||
std::make_shared<CalculatorVector<std::pair<std::wstring, int>>>(), std::make_shared<CalculatorVector<std::shared_ptr<IExpressionCommand>>>());
|
||||
}
|
||||
|
||||
if (nullptr != m_pHistoryDisplay)
|
||||
|
@ -322,8 +322,8 @@ void CHistoryCollector::ClearHistoryLine(wstring_view errStr)
|
|||
{
|
||||
if (nullptr != m_pCalcDisplay)
|
||||
{
|
||||
m_pCalcDisplay->SetExpressionDisplay(std::make_shared<CalculatorVector<std::pair<std::wstring, int>>>(),
|
||||
std::make_shared<CalculatorVector<std::shared_ptr<IExpressionCommand>>>());
|
||||
m_pCalcDisplay->SetExpressionDisplay(
|
||||
std::make_shared<CalculatorVector<std::pair<std::wstring, int>>>(), std::make_shared<CalculatorVector<std::shared_ptr<IExpressionCommand>>>());
|
||||
}
|
||||
m_iCurLineHistStart = -1; // It will get recomputed at the first Opnd
|
||||
ReinitHistory();
|
||||
|
|
|
@ -58,8 +58,9 @@ void CCalcEngine::InitialOneTimeOnlySetup(CalculationManager::IResourceProvider&
|
|||
// CCalcEngine::CCalcEngine
|
||||
//
|
||||
//////////////////////////////////////////////////
|
||||
CCalcEngine::CCalcEngine(bool fPrecedence, bool fIntegerMode, CalculationManager::IResourceProvider* const pResourceProvider,
|
||||
__in_opt ICalcDisplay* pCalcDisplay, __in_opt shared_ptr<IHistoryDisplay> pHistoryDisplay)
|
||||
CCalcEngine::CCalcEngine(
|
||||
bool fPrecedence, bool fIntegerMode, CalculationManager::IResourceProvider* const pResourceProvider, __in_opt ICalcDisplay* pCalcDisplay,
|
||||
__in_opt shared_ptr<IHistoryDisplay> pHistoryDisplay)
|
||||
: m_fPrecedence(fPrecedence)
|
||||
, m_fIntegerMode(fIntegerMode)
|
||||
, m_pCalcDisplay(pCalcDisplay)
|
||||
|
|
|
@ -382,8 +382,8 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
|||
if (nullptr != m_pCalcDisplay)
|
||||
{
|
||||
m_pCalcDisplay->SetParenthesisNumber(0);
|
||||
m_pCalcDisplay->SetExpressionDisplay(make_shared<CalculatorVector<pair<wstring, int>>>(),
|
||||
make_shared<CalculatorVector<shared_ptr<IExpressionCommand>>>());
|
||||
m_pCalcDisplay->SetExpressionDisplay(
|
||||
make_shared<CalculatorVector<pair<wstring, int>>>(), make_shared<CalculatorVector<shared_ptr<IExpressionCommand>>>());
|
||||
}
|
||||
|
||||
m_HistoryCollector.ClearHistoryLine(wstring());
|
||||
|
@ -476,8 +476,8 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
|||
m_HistoryCollector.CompleteHistoryLine(groupedString);
|
||||
if (nullptr != m_pCalcDisplay)
|
||||
{
|
||||
m_pCalcDisplay->SetExpressionDisplay(make_shared<CalculatorVector<pair<wstring, int>>>(),
|
||||
make_shared<CalculatorVector<shared_ptr<IExpressionCommand>>>());
|
||||
m_pCalcDisplay->SetExpressionDisplay(
|
||||
make_shared<CalculatorVector<pair<wstring, int>>>(), make_shared<CalculatorVector<shared_ptr<IExpressionCommand>>>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,9 @@ CalculatorHistory::CalculatorHistory(size_t maxSize) : m_maxHistorySize(maxSize)
|
|||
{
|
||||
}
|
||||
|
||||
unsigned int CalculatorHistory::AddToHistory(_In_ shared_ptr<CalculatorVector<pair<wstring, int>>> const& tokens,
|
||||
_In_ shared_ptr<CalculatorVector<shared_ptr<IExpressionCommand>>> const& commands, _In_ wstring_view result)
|
||||
unsigned int CalculatorHistory::AddToHistory(
|
||||
_In_ shared_ptr<CalculatorVector<pair<wstring, int>>> const& tokens, _In_ shared_ptr<CalculatorVector<shared_ptr<IExpressionCommand>>> const& commands,
|
||||
_In_ wstring_view result)
|
||||
{
|
||||
unsigned int addedIndex;
|
||||
wstring generatedExpression;
|
||||
|
|
|
@ -30,7 +30,8 @@ namespace CalculationManager
|
|||
{
|
||||
public:
|
||||
CalculatorHistory(const size_t maxSize);
|
||||
unsigned int AddToHistory(_In_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& spTokens,
|
||||
unsigned int AddToHistory(
|
||||
_In_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& spTokens,
|
||||
_In_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& spCommands, std::wstring_view result);
|
||||
std::vector<std::shared_ptr<HISTORYITEM>> const& GetHistory();
|
||||
std::shared_ptr<HISTORYITEM> const& GetHistoryItem(unsigned int uIdx);
|
||||
|
|
|
@ -85,7 +85,8 @@ namespace CalculationManager
|
|||
/// Used to set the expression display value on ViewModel
|
||||
/// </summary>
|
||||
/// <param name="expressionString">wstring representing expression to be displayed</param>
|
||||
void CalculatorManager::SetExpressionDisplay(_Inout_ shared_ptr<CalculatorVector<pair<wstring, int>>> const& tokens,
|
||||
void CalculatorManager::SetExpressionDisplay(
|
||||
_Inout_ shared_ptr<CalculatorVector<pair<wstring, int>>> const& tokens,
|
||||
_Inout_ shared_ptr<CalculatorVector<shared_ptr<IExpressionCommand>>> const& commands)
|
||||
{
|
||||
if (!m_inHistoryItemLoadMode)
|
||||
|
|
|
@ -91,7 +91,8 @@ namespace CalculationManager
|
|||
// ICalcDisplay
|
||||
void SetPrimaryDisplay(_In_ const std::wstring& displayString, _In_ bool isError) override;
|
||||
void SetIsInError(bool isError) override;
|
||||
void SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
void SetExpressionDisplay(
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& commands) override;
|
||||
void SetMemorizedNumbers(_In_ const std::vector<std::wstring>& memorizedNumbers) override;
|
||||
void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) override;
|
||||
|
|
|
@ -54,7 +54,8 @@ namespace CalculatorEngineTests
|
|||
class CCalcEngine
|
||||
{
|
||||
public:
|
||||
CCalcEngine(bool fPrecedence, bool fIntegerMode, CalculationManager::IResourceProvider* const pResourceProvider, __in_opt ICalcDisplay* pCalcDisplay,
|
||||
CCalcEngine(
|
||||
bool fPrecedence, bool fIntegerMode, CalculationManager::IResourceProvider* const pResourceProvider, __in_opt ICalcDisplay* pCalcDisplay,
|
||||
__in_opt std::shared_ptr<IHistoryDisplay> pHistoryDisplay);
|
||||
void ProcessCommand(OpCode wID);
|
||||
void DisplayError(uint32_t nError);
|
||||
|
|
|
@ -12,7 +12,8 @@ class ICalcDisplay
|
|||
public:
|
||||
virtual void SetPrimaryDisplay(const std::wstring& pszText, bool isError) = 0;
|
||||
virtual void SetIsInError(bool isInError) = 0;
|
||||
virtual void SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
virtual void SetExpressionDisplay(
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& commands) = 0;
|
||||
virtual void SetParenthesisNumber(_In_ unsigned int count) = 0;
|
||||
virtual void OnNoRightParenAdded() = 0;
|
||||
|
|
|
@ -8,7 +8,7 @@ class IHistoryDisplay
|
|||
{
|
||||
public:
|
||||
virtual ~IHistoryDisplay(){};
|
||||
virtual unsigned int AddToHistory(_In_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
_In_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& commands,
|
||||
_In_ std::wstring_view result) = 0;
|
||||
virtual unsigned int AddToHistory(
|
||||
_In_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
_In_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& commands, _In_ std::wstring_view result) = 0;
|
||||
};
|
||||
|
|
|
@ -356,12 +356,13 @@ uint64_t rattoUi64(_In_ PRAT prat, uint32_t radix, int32_t precision);
|
|||
extern PNUMBER _createnum(_In_ uint32_t size); // returns an empty number structure with size digits
|
||||
extern PNUMBER nRadixxtonum(_In_ PNUMBER a, uint32_t radix, int32_t precision);
|
||||
extern PNUMBER gcd(_In_ PNUMBER a, _In_ PNUMBER b);
|
||||
extern PNUMBER StringToNumber(std::wstring_view numberString, uint32_t radix,
|
||||
extern PNUMBER StringToNumber(
|
||||
std::wstring_view numberString, uint32_t radix,
|
||||
int32_t precision); // takes a text representation of a number and returns a number.
|
||||
|
||||
// takes a text representation of a number as a mantissa with sign and an exponent with sign.
|
||||
extern PRAT StringToRat(bool mantissaIsNegative, std::wstring_view mantissa, bool exponentIsNegative, std::wstring_view exponent, uint32_t radix,
|
||||
int32_t precision);
|
||||
extern PRAT
|
||||
StringToRat(bool mantissaIsNegative, std::wstring_view mantissa, bool exponentIsNegative, std::wstring_view exponent, uint32_t radix, int32_t precision);
|
||||
|
||||
extern PNUMBER i32factnum(int32_t ini32, uint32_t radix);
|
||||
extern PNUMBER i32prodnum(int32_t start, int32_t stop, uint32_t radix);
|
||||
|
|
|
@ -29,7 +29,8 @@ namespace UnitConversionManager
|
|||
{
|
||||
}
|
||||
|
||||
Unit(int id, std::wstring currencyName, std::wstring countryName, std::wstring abbreviation, bool isRtlLanguage, bool isConversionSource,
|
||||
Unit(
|
||||
int id, std::wstring currencyName, std::wstring countryName, std::wstring abbreviation, bool isRtlLanguage, bool isConversionSource,
|
||||
bool isConversionTarget)
|
||||
: id(id), abbreviation(abbreviation), isConversionSource(isConversionSource), isConversionTarget(isConversionTarget), isWhimsical(false)
|
||||
{
|
||||
|
@ -155,8 +156,8 @@ namespace UnitConversionManager
|
|||
};
|
||||
|
||||
typedef std::tuple<std::vector<UnitConversionManager::Unit>, UnitConversionManager::Unit, UnitConversionManager::Unit> CategorySelectionInitializer;
|
||||
typedef std::unordered_map<UnitConversionManager::Unit,
|
||||
std::unordered_map<UnitConversionManager::Unit, UnitConversionManager::ConversionData, UnitConversionManager::UnitHash>,
|
||||
typedef std::unordered_map<
|
||||
UnitConversionManager::Unit, std::unordered_map<UnitConversionManager::Unit, UnitConversionManager::ConversionData, UnitConversionManager::UnitHash>,
|
||||
UnitConversionManager::UnitHash>
|
||||
UnitToUnitToConversionDataMap;
|
||||
typedef std::unordered_map<UnitConversionManager::Category, std::vector<UnitConversionManager::Unit>, UnitConversionManager::CategoryHash>
|
||||
|
@ -188,10 +189,10 @@ namespace UnitConversionManager
|
|||
{
|
||||
public:
|
||||
virtual void SetViewModelCallback(const std::shared_ptr<UnitConversionManager::IViewModelCurrencyCallback>& callback) = 0;
|
||||
virtual std::pair<std::wstring, std::wstring> GetCurrencySymbols(_In_ const UnitConversionManager::Unit& unit1,
|
||||
_In_ const UnitConversionManager::Unit& unit2) = 0;
|
||||
virtual std::pair<std::wstring, std::wstring> GetCurrencyRatioEquality(_In_ const UnitConversionManager::Unit& unit1,
|
||||
_In_ const UnitConversionManager::Unit& unit2) = 0;
|
||||
virtual std::pair<std::wstring, std::wstring>
|
||||
GetCurrencySymbols(_In_ const UnitConversionManager::Unit& unit1, _In_ const UnitConversionManager::Unit& unit2) = 0;
|
||||
virtual std::pair<std::wstring, std::wstring>
|
||||
GetCurrencyRatioEquality(_In_ const UnitConversionManager::Unit& unit1, _In_ const UnitConversionManager::Unit& unit2) = 0;
|
||||
virtual std::wstring GetCurrencyTimestamp() = 0;
|
||||
|
||||
virtual concurrency::task<bool> TryLoadDataFromCacheAsync() = 0;
|
||||
|
|
|
@ -47,8 +47,8 @@ namespace CalculatorApp
|
|||
throw ref new Platform::NotImplementedException();
|
||||
}
|
||||
property Windows::Foundation::Collections::IObservableVector<Platform::Object ^> ^ CollectionGroups {
|
||||
virtual Windows::Foundation::Collections::IObservableVector<Platform::Object
|
||||
^> ^ get() = Windows::UI::Xaml::Data::ICollectionView::CollectionGroups::get
|
||||
virtual Windows::Foundation::Collections::IObservableVector<
|
||||
Platform::Object ^> ^ get() = Windows::UI::Xaml::Data::ICollectionView::CollectionGroups::get
|
||||
{
|
||||
return ref new Platform::Collections::Vector<Platform::Object ^>();
|
||||
}
|
||||
|
@ -80,8 +80,9 @@ namespace CalculatorApp
|
|||
// restore the selection to the way we wanted it to begin with
|
||||
if (m_currentPosition >= 0 && m_currentPosition < static_cast<int>(m_source->Size))
|
||||
{
|
||||
this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal,
|
||||
ref new Windows::UI::Core::DispatchedHandler([this]() { m_currentChanged(this, nullptr); }));
|
||||
this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this]() {
|
||||
m_currentChanged(this, nullptr);
|
||||
}));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -167,14 +168,14 @@ namespace CalculatorApp
|
|||
{
|
||||
throw ref new Platform::NotImplementedException();
|
||||
}
|
||||
virtual unsigned int
|
||||
GetMany(unsigned int /*startIndex*/,
|
||||
virtual unsigned int GetMany(
|
||||
unsigned int /*startIndex*/,
|
||||
Platform::WriteOnlyArray<Platform::Object ^> ^ /*items*/) = Windows::Foundation::Collections::IVector<Platform::Object ^>::GetMany
|
||||
{
|
||||
throw ref new Platform::NotImplementedException();
|
||||
}
|
||||
virtual Windows::Foundation::Collections::IVectorView<Platform::Object ^> ^ GetView() = Windows::Foundation::Collections::IVector<Platform::Object
|
||||
^>::GetView
|
||||
virtual Windows::Foundation::Collections::IVectorView<Platform::Object ^> ^ GetView() = Windows::Foundation::Collections::IVector<
|
||||
Platform::Object ^>::GetView
|
||||
{
|
||||
throw ref new Platform::NotImplementedException();
|
||||
}
|
||||
|
@ -263,7 +264,8 @@ namespace CalculatorApp
|
|||
|
||||
private:
|
||||
virtual Platform::Object
|
||||
^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
^ Convert(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::Convert
|
||||
{
|
||||
auto result = dynamic_cast<Windows::UI::Xaml::Interop::IBindableVector ^>(value);
|
||||
|
@ -275,7 +277,8 @@ namespace CalculatorApp
|
|||
}
|
||||
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(Platform::Object ^ /*value*/, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
^ ConvertBack(
|
||||
Platform::Object ^ /*value*/, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack
|
||||
{
|
||||
return Windows::UI::Xaml::DependencyProperty::UnsetValue;
|
||||
|
|
|
@ -25,8 +25,8 @@ namespace CalculatorApp::Common::Automation
|
|||
}
|
||||
}
|
||||
|
||||
NarratorAnnouncement::NarratorAnnouncement(String ^ announcement, String ^ activityId, AutomationNotificationKind kind,
|
||||
AutomationNotificationProcessing processing)
|
||||
NarratorAnnouncement::NarratorAnnouncement(
|
||||
String ^ announcement, String ^ activityId, AutomationNotificationKind kind, AutomationNotificationProcessing processing)
|
||||
: m_announcement(announcement), m_activityId(activityId), m_kind(kind), m_processing(processing)
|
||||
{
|
||||
}
|
||||
|
@ -58,66 +58,70 @@ bool NarratorAnnouncement::IsValid(NarratorAnnouncement ^ announcement)
|
|||
|
||||
NarratorAnnouncement ^ CalculatorAnnouncement::GetDisplayUpdatedAnnouncement(String ^ announcement)
|
||||
{
|
||||
return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::DisplayUpdated, AutomationNotificationKind::Other,
|
||||
AutomationNotificationProcessing::ImportantMostRecent);
|
||||
return ref new NarratorAnnouncement(
|
||||
announcement, CalculatorActivityIds::DisplayUpdated, AutomationNotificationKind::Other, AutomationNotificationProcessing::ImportantMostRecent);
|
||||
}
|
||||
|
||||
NarratorAnnouncement ^ CalculatorAnnouncement::GetMaxDigitsReachedAnnouncement(String ^ announcement)
|
||||
{
|
||||
return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::MaxDigitsReached, AutomationNotificationKind::Other,
|
||||
AutomationNotificationProcessing::ImportantMostRecent);
|
||||
return ref new NarratorAnnouncement(
|
||||
announcement, CalculatorActivityIds::MaxDigitsReached, AutomationNotificationKind::Other, AutomationNotificationProcessing::ImportantMostRecent);
|
||||
}
|
||||
|
||||
NarratorAnnouncement ^ CalculatorAnnouncement::GetMemoryClearedAnnouncement(String ^ announcement)
|
||||
{
|
||||
return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::MemoryCleared, AutomationNotificationKind::ItemRemoved,
|
||||
AutomationNotificationProcessing::ImportantMostRecent);
|
||||
return ref new NarratorAnnouncement(
|
||||
announcement, CalculatorActivityIds::MemoryCleared, AutomationNotificationKind::ItemRemoved, AutomationNotificationProcessing::ImportantMostRecent);
|
||||
}
|
||||
|
||||
NarratorAnnouncement ^ CalculatorAnnouncement::GetMemoryItemChangedAnnouncement(String ^ announcement)
|
||||
{
|
||||
return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::MemoryItemChanged, AutomationNotificationKind::ActionCompleted,
|
||||
AutomationNotificationProcessing::MostRecent);
|
||||
return ref new NarratorAnnouncement(
|
||||
announcement, CalculatorActivityIds::MemoryItemChanged, AutomationNotificationKind::ActionCompleted, AutomationNotificationProcessing::MostRecent);
|
||||
}
|
||||
|
||||
NarratorAnnouncement ^ CalculatorAnnouncement::GetMemoryItemAddedAnnouncement(String ^ announcement)
|
||||
{
|
||||
return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::MemoryItemAdded, AutomationNotificationKind::ItemAdded,
|
||||
AutomationNotificationProcessing::MostRecent);
|
||||
return ref new NarratorAnnouncement(
|
||||
announcement, CalculatorActivityIds::MemoryItemAdded, AutomationNotificationKind::ItemAdded, AutomationNotificationProcessing::MostRecent);
|
||||
}
|
||||
|
||||
NarratorAnnouncement ^ CalculatorAnnouncement::GetHistoryClearedAnnouncement(String ^ announcement)
|
||||
{
|
||||
return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::HistoryCleared, AutomationNotificationKind::ItemRemoved,
|
||||
AutomationNotificationProcessing::MostRecent);
|
||||
return ref new NarratorAnnouncement(
|
||||
announcement, CalculatorActivityIds::HistoryCleared, AutomationNotificationKind::ItemRemoved, AutomationNotificationProcessing::MostRecent);
|
||||
}
|
||||
|
||||
NarratorAnnouncement ^ CalculatorAnnouncement::GetCategoryNameChangedAnnouncement(String ^ announcement)
|
||||
{
|
||||
return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::CategoryNameChanged, AutomationNotificationKind::ActionCompleted,
|
||||
return ref new NarratorAnnouncement(
|
||||
announcement, CalculatorActivityIds::CategoryNameChanged, AutomationNotificationKind::ActionCompleted,
|
||||
AutomationNotificationProcessing::ImportantMostRecent);
|
||||
}
|
||||
|
||||
NarratorAnnouncement ^ CalculatorAnnouncement::GetUpdateCurrencyRatesAnnouncement(String ^ announcement)
|
||||
{
|
||||
return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::UpdateCurrencyRates, AutomationNotificationKind::ActionCompleted,
|
||||
return ref new NarratorAnnouncement(
|
||||
announcement, CalculatorActivityIds::UpdateCurrencyRates, AutomationNotificationKind::ActionCompleted,
|
||||
AutomationNotificationProcessing::ImportantMostRecent);
|
||||
}
|
||||
|
||||
NarratorAnnouncement ^ CalculatorAnnouncement::GetDisplayCopiedAnnouncement(String ^ announcement)
|
||||
{
|
||||
return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::DisplayCopied, AutomationNotificationKind::ActionCompleted,
|
||||
AutomationNotificationProcessing::ImportantMostRecent);
|
||||
return ref new NarratorAnnouncement(
|
||||
announcement, CalculatorActivityIds::DisplayCopied, AutomationNotificationKind::ActionCompleted, AutomationNotificationProcessing::ImportantMostRecent);
|
||||
}
|
||||
|
||||
NarratorAnnouncement ^ CalculatorAnnouncement::GetOpenParenthesisCountChangedAnnouncement(String ^ announcement)
|
||||
{
|
||||
return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::OpenParenthesisCountChanged, AutomationNotificationKind::ActionCompleted,
|
||||
return ref new NarratorAnnouncement(
|
||||
announcement, CalculatorActivityIds::OpenParenthesisCountChanged, AutomationNotificationKind::ActionCompleted,
|
||||
AutomationNotificationProcessing::ImportantMostRecent);
|
||||
}
|
||||
|
||||
NarratorAnnouncement ^ CalculatorAnnouncement::GetNoRightParenthesisAddedAnnouncement(String ^ announcement)
|
||||
{
|
||||
return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::NoParenthesisAdded, AutomationNotificationKind::ActionCompleted,
|
||||
return ref new NarratorAnnouncement(
|
||||
announcement, CalculatorActivityIds::NoParenthesisAdded, AutomationNotificationKind::ActionCompleted,
|
||||
AutomationNotificationProcessing::ImportantMostRecent);
|
||||
}
|
||||
|
|
|
@ -58,8 +58,8 @@ public
|
|||
// class that can access the private constructor.
|
||||
friend class CalculatorAnnouncement;
|
||||
|
||||
NarratorAnnouncement(Platform::String ^ announcement, Platform::String ^ activityId, AutomationNotificationKind kind,
|
||||
AutomationNotificationProcessing processing);
|
||||
NarratorAnnouncement(
|
||||
Platform::String ^ announcement, Platform::String ^ activityId, AutomationNotificationKind kind, AutomationNotificationProcessing processing);
|
||||
|
||||
Platform::String ^ m_announcement;
|
||||
Platform::String ^ m_activityId;
|
||||
|
|
|
@ -30,10 +30,12 @@ void NarratorNotifier::Announce(NarratorAnnouncement ^ announcement)
|
|||
|
||||
void NarratorNotifier::RegisterDependencyProperties()
|
||||
{
|
||||
s_announcementProperty = DependencyProperty::Register(L"Announcement", // The name of the dependency property.
|
||||
s_announcementProperty = DependencyProperty::Register(
|
||||
L"Announcement", // The name of the dependency property.
|
||||
NarratorAnnouncement::typeid, // The type of the dependency property.
|
||||
NarratorNotifier::typeid, // The owner of the dependency property.
|
||||
ref new PropertyMetadata(nullptr, // Default value of the dependency property.
|
||||
ref new PropertyMetadata(
|
||||
nullptr, // Default value of the dependency property.
|
||||
ref new PropertyChangedCallback(OnAnnouncementChanged)));
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ public
|
|||
^ AnnouncementProperty { Windows::UI::Xaml::DependencyProperty ^ get() { return s_announcementProperty; } }
|
||||
|
||||
static NarratorAnnouncement
|
||||
^ GetAnnouncement(Windows::UI::Xaml::DependencyObject
|
||||
^ element) { return safe_cast<NarratorAnnouncement ^>(element->GetValue(s_announcementProperty)); }
|
||||
^ GetAnnouncement(
|
||||
Windows::UI::Xaml::DependencyObject ^ element) { return safe_cast<NarratorAnnouncement ^>(element->GetValue(s_announcementProperty)); }
|
||||
|
||||
static void SetAnnouncement(Windows::UI::Xaml::DependencyObject ^ element, NarratorAnnouncement ^ value)
|
||||
{
|
||||
|
@ -40,8 +40,8 @@ public
|
|||
}
|
||||
|
||||
private:
|
||||
static void OnAnnouncementChanged(_In_ Windows::UI::Xaml::DependencyObject ^ dependencyObject,
|
||||
_In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ eventArgs);
|
||||
static void OnAnnouncementChanged(
|
||||
_In_ Windows::UI::Xaml::DependencyObject ^ dependencyObject, _In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ eventArgs);
|
||||
|
||||
static Windows::UI::Xaml::DependencyProperty ^ s_announcementProperty;
|
||||
|
||||
|
|
|
@ -34,8 +34,9 @@ void NotificationHost::Announce(NarratorAnnouncement ^ announcement)
|
|||
auto peer = FrameworkElementAutomationPeer::FromElement(m_host);
|
||||
if (peer != nullptr)
|
||||
{
|
||||
peer->RaiseNotificationEvent(GetWindowsNotificationKind(announcement->Kind), GetWindowsNotificationProcessing(announcement->Processing),
|
||||
announcement->Announcement, announcement->ActivityId);
|
||||
peer->RaiseNotificationEvent(
|
||||
GetWindowsNotificationKind(announcement->Kind), GetWindowsNotificationProcessing(announcement->Processing), announcement->Announcement,
|
||||
announcement->ActivityId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,8 @@ void CalculatorDisplay::SetIsInError(bool isError)
|
|||
}
|
||||
}
|
||||
|
||||
void CalculatorDisplay::SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
void CalculatorDisplay::SetExpressionDisplay(
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& commands)
|
||||
{
|
||||
if (m_callbackReference != nullptr)
|
||||
|
|
|
@ -18,7 +18,8 @@ namespace CalculatorApp
|
|||
private:
|
||||
void SetPrimaryDisplay(_In_ const std::wstring& displayString, _In_ bool isError) override;
|
||||
void SetIsInError(bool isError) override;
|
||||
void SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
void SetExpressionDisplay(
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& commands) override;
|
||||
void SetMemorizedNumbers(_In_ const std::vector<std::wstring>& memorizedNumbers) override;
|
||||
void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) override;
|
||||
|
|
|
@ -38,9 +38,10 @@ static const wstring c_uIntSuffixes = L"[uU]?[lL]{0,2}";
|
|||
|
||||
// RegEx Patterns used by various modes
|
||||
static const array<wregex, 1> standardModePatterns = { wregex(c_wspc + c_signedDecFloat + c_wspc) };
|
||||
static const array<wregex, 2> scientificModePatterns = { wregex(L"(" + c_wspc + L"[-+]?)|(" + c_wspcLParenSigned + L")" + c_signedDecFloat + c_wspcRParens),
|
||||
wregex(L"(" + c_wspc + L"[-+]?)|(" + c_wspcLParenSigned + L")" + c_signedDecFloat
|
||||
+ L"[e]([+]|[-])+\\d+" + c_wspcRParens) };
|
||||
static const array<wregex, 2> scientificModePatterns = {
|
||||
wregex(L"(" + c_wspc + L"[-+]?)|(" + c_wspcLParenSigned + L")" + c_signedDecFloat + c_wspcRParens),
|
||||
wregex(L"(" + c_wspc + L"[-+]?)|(" + c_wspcLParenSigned + L")" + c_signedDecFloat + L"[e]([+]|[-])+\\d+" + c_wspcRParens)
|
||||
};
|
||||
static const array<array<wregex, 5>, 4> programmerModePatterns = {
|
||||
{ // Hex numbers like 5F, 4A0C, 0xa9, 0xFFull, 47CDh
|
||||
{ wregex(c_wspcLParens + L"(0[xX])?" + c_hexProgrammerChars + c_uIntSuffixes + c_wspcRParens),
|
||||
|
@ -75,8 +76,10 @@ task<String ^> CopyPasteManager::GetStringToPaste(ViewMode mode, CategoryGroupTy
|
|||
//-- add support to allow pasting for expressions like 1.3e12(as of now we allow 1.3e+12)
|
||||
|
||||
return create_task((dataPackageView->GetTextAsync(::StandardDataFormats::Text)))
|
||||
.then([mode, modeType, programmerNumberBase,
|
||||
bitLengthType](String ^ pastedText) { return ValidatePasteExpression(pastedText, mode, modeType, programmerNumberBase, bitLengthType); },
|
||||
.then(
|
||||
[mode, modeType, programmerNumberBase, bitLengthType](String ^ pastedText) {
|
||||
return ValidatePasteExpression(pastedText, mode, modeType, programmerNumberBase, bitLengthType);
|
||||
},
|
||||
task_continuation_context::use_arbitrary());
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace CalculatorApp
|
|||
{
|
||||
public:
|
||||
static void CopyToClipboard(Platform::String ^ stringToCopy);
|
||||
static concurrency::task<Platform::String ^> GetStringToPaste(CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType,
|
||||
int programmerNumberBase = -1, int bitLengthType = -1);
|
||||
static concurrency::task<Platform::String ^> GetStringToPaste(
|
||||
CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType, int programmerNumberBase = -1, int bitLengthType = -1);
|
||||
static bool HasStringToPaste()
|
||||
{
|
||||
return ClipboardTextFormat() >= 0;
|
||||
|
@ -40,19 +40,22 @@ namespace CalculatorApp
|
|||
static Platform::String
|
||||
^ ValidatePasteExpression(Platform::String ^ pastedText, CalculatorApp::Common::ViewMode mode, int programmerNumberBase, int bitLengthType);
|
||||
static Platform::String
|
||||
^ ValidatePasteExpression(Platform::String ^ pastedText, CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType,
|
||||
^ ValidatePasteExpression(
|
||||
Platform::String ^ pastedText, CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType,
|
||||
int programmerNumberBase, int bitLengthType);
|
||||
|
||||
static std::vector<std::wstring> ExtractOperands(const std::wstring& pasteExpression, CalculatorApp::Common::ViewMode mode,
|
||||
static std::vector<std::wstring>
|
||||
ExtractOperands(const std::wstring& pasteExpression, CalculatorApp::Common::ViewMode mode, int programmerNumberBase = -1, int bitLengthType = -1);
|
||||
static bool ExpressionRegExMatch(
|
||||
std::vector<std::wstring> operands, CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType,
|
||||
int programmerNumberBase = -1, int bitLengthType = -1);
|
||||
static bool ExpressionRegExMatch(std::vector<std::wstring> operands, CalculatorApp::Common::ViewMode mode,
|
||||
CalculatorApp::Common::CategoryGroupType modeType, int programmerNumberBase = -1, int bitLengthType = -1);
|
||||
|
||||
static std::pair<size_t, uint64_t> GetMaxOperandLengthAndValue(CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType,
|
||||
int programmerNumberBase = -1, int bitLengthType = -1);
|
||||
static std::pair<size_t, uint64_t> GetMaxOperandLengthAndValue(
|
||||
CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType, int programmerNumberBase = -1, int bitLengthType = -1);
|
||||
static std::wstring SanitizeOperand(const std::wstring& operand);
|
||||
static bool TryOperandToULL(const std::wstring& operand, int numberBase, unsigned long long int& result);
|
||||
static size_t OperandLength(const std::wstring& operand, CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType,
|
||||
static size_t OperandLength(
|
||||
const std::wstring& operand, CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType,
|
||||
int programmerNumberBase = -1);
|
||||
static size_t StandardScientificOperandLength(const std::wstring& operand);
|
||||
static size_t ProgrammerOperandLength(const std::wstring& operand, int numberBase);
|
||||
|
|
|
@ -44,11 +44,12 @@ namespace CalculatorApp
|
|||
DateCalculationEngine(_In_ Platform::String ^ calendarIdentifier);
|
||||
|
||||
// Public Methods
|
||||
bool __nothrow AddDuration(_In_ Windows::Foundation::DateTime startDate, _In_ const DateDifference& duration,
|
||||
_Out_ Windows::Foundation::DateTime* endDate);
|
||||
bool __nothrow SubtractDuration(_In_ Windows::Foundation::DateTime startDate, _In_ const DateDifference& duration,
|
||||
_Out_ Windows::Foundation::DateTime* endDate);
|
||||
void __nothrow GetDateDifference(_In_ Windows::Foundation::DateTime date1, _In_ Windows::Foundation::DateTime date2, _In_ DateUnit outputFormat,
|
||||
bool __nothrow
|
||||
AddDuration(_In_ Windows::Foundation::DateTime startDate, _In_ const DateDifference& duration, _Out_ Windows::Foundation::DateTime* endDate);
|
||||
bool __nothrow SubtractDuration(
|
||||
_In_ Windows::Foundation::DateTime startDate, _In_ const DateDifference& duration, _Out_ Windows::Foundation::DateTime* endDate);
|
||||
void __nothrow GetDateDifference(
|
||||
_In_ Windows::Foundation::DateTime date1, _In_ Windows::Foundation::DateTime date2, _In_ DateUnit outputFormat,
|
||||
_Out_ DateDifference* difference);
|
||||
|
||||
private:
|
||||
|
|
|
@ -446,7 +446,8 @@ const std::multimap<MyVirtualKey, WeakReference>& GetCurrentKeyDictionary(MyVirt
|
|||
{
|
||||
return s_VirtualKeyAltChordsForButtons.find(viewId)->second;
|
||||
}
|
||||
else if ((s_ShiftKeyPressed.find(viewId)->second)
|
||||
else if (
|
||||
(s_ShiftKeyPressed.find(viewId)->second)
|
||||
&& ((Window::Current->CoreWindow->GetKeyState(VirtualKey::Control) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down))
|
||||
{
|
||||
return s_VirtualKeyControlShiftChordsForButtons.find(viewId)->second;
|
||||
|
|
|
@ -62,13 +62,13 @@ namespace CalculatorApp
|
|||
|
||||
static void OnVirtualKeyInverseChordPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, MyVirtualKey oldValue, MyVirtualKey newValue);
|
||||
|
||||
static void OnVirtualKeyControlInverseChordPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, MyVirtualKey oldValue,
|
||||
MyVirtualKey newValue);
|
||||
static void
|
||||
OnVirtualKeyControlInverseChordPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, MyVirtualKey oldValue, MyVirtualKey newValue);
|
||||
|
||||
static void OnVirtualKeyAltChordPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, MyVirtualKey oldValue, MyVirtualKey newValue);
|
||||
|
||||
static void OnVirtualKeyControlShiftChordPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, MyVirtualKey oldValue,
|
||||
MyVirtualKey newValue);
|
||||
static void
|
||||
OnVirtualKeyControlShiftChordPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, MyVirtualKey oldValue, MyVirtualKey newValue);
|
||||
|
||||
static void OnCharacterReceivedHandler(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::CharacterReceivedEventArgs ^ args);
|
||||
static void OnKeyDownHandler(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::KeyEventArgs ^ args);
|
||||
|
|
|
@ -44,8 +44,8 @@ namespace CalculatorApp
|
|||
static Windows::Globalization::NumberFormatting::DecimalFormatter ^ GetRegionalSettingsAwareDecimalFormatter();
|
||||
static Windows::Globalization::DateTimeFormatting::DateTimeFormatter ^ GetRegionalSettingsAwareDateTimeFormatter(_In_ Platform::String ^ format);
|
||||
static Windows::Globalization::DateTimeFormatting::DateTimeFormatter
|
||||
^ GetRegionalSettingsAwareDateTimeFormatter(_In_ Platform::String ^ format, _In_ Platform::String ^ calendarIdentifier,
|
||||
_In_ Platform::String ^ clockIdentifier);
|
||||
^ GetRegionalSettingsAwareDateTimeFormatter(
|
||||
_In_ Platform::String ^ format, _In_ Platform::String ^ calendarIdentifier, _In_ Platform::String ^ clockIdentifier);
|
||||
|
||||
static Windows::Globalization::NumberFormatting::CurrencyFormatter ^ GetRegionalSettingsAwareCurrencyFormatter();
|
||||
|
||||
|
@ -60,8 +60,8 @@ namespace CalculatorApp
|
|||
|
||||
// Attached property callbacks
|
||||
static void OnFontTypePropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, LanguageFontType oldValue, LanguageFontType newValue);
|
||||
static void OnFontWeightPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, Windows::UI::Text::FontWeight oldValue,
|
||||
Windows::UI::Text::FontWeight newValue);
|
||||
static void OnFontWeightPropertyChanged(
|
||||
Windows::UI::Xaml::DependencyObject ^ target, Windows::UI::Text::FontWeight oldValue, Windows::UI::Text::FontWeight newValue);
|
||||
static void OnFontSizePropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, double oldValue, double newValue);
|
||||
|
||||
static void UpdateFontFamilyAndSize(Windows::UI::Xaml::DependencyObject ^ target);
|
||||
|
|
|
@ -60,7 +60,8 @@ namespace CalculatorApp
|
|||
|
||||
// Get locale info for List Separator, eg. comma is used in many locales
|
||||
wchar_t listSeparatorString[4] = L"";
|
||||
result = ::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SLIST, listSeparatorString,
|
||||
result = ::GetLocaleInfoEx(
|
||||
LOCALE_NAME_USER_DEFAULT, LOCALE_SLIST, listSeparatorString,
|
||||
static_cast<int>(std::size(listSeparatorString))); // Max length of the expected return value is 4
|
||||
if (result == 0)
|
||||
{
|
||||
|
@ -68,7 +69,8 @@ namespace CalculatorApp
|
|||
}
|
||||
|
||||
int currencyTrailingDigits = 0;
|
||||
result = GetLocaleInfoEx(m_resolvedName.c_str(), LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER, (LPWSTR)¤cyTrailingDigits,
|
||||
result = GetLocaleInfoEx(
|
||||
m_resolvedName.c_str(), LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER, (LPWSTR)¤cyTrailingDigits,
|
||||
sizeof(currencyTrailingDigits) / sizeof(WCHAR));
|
||||
if (result == 0)
|
||||
{
|
||||
|
@ -78,7 +80,8 @@ namespace CalculatorApp
|
|||
// Currency symbol precedence is either 0 or 1.
|
||||
// A value of 0 indicates the symbol follows the currency value.
|
||||
int currencySymbolPrecedence = 1;
|
||||
result = GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_IPOSSYMPRECEDES | LOCALE_RETURN_NUMBER, (LPWSTR)¤cySymbolPrecedence,
|
||||
result = GetLocaleInfoEx(
|
||||
LOCALE_NAME_USER_DEFAULT, LOCALE_IPOSSYMPRECEDES | LOCALE_RETURN_NUMBER, (LPWSTR)¤cySymbolPrecedence,
|
||||
sizeof(currencySymbolPrecedence) / sizeof(WCHAR));
|
||||
|
||||
// As CalcEngine only supports the first character of the decimal separator,
|
||||
|
@ -101,7 +104,8 @@ namespace CalculatorApp
|
|||
|
||||
// Get FirstDayOfWeek Date and Time setting
|
||||
wchar_t day[80] = L"";
|
||||
::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT,
|
||||
::GetLocaleInfoEx(
|
||||
LOCALE_NAME_USER_DEFAULT,
|
||||
LOCALE_IFIRSTDAYOFWEEK, // The first day in a week
|
||||
reinterpret_cast<PWSTR>(day), // Argument is of type PWSTR
|
||||
static_cast<int>(std::size(day))); // Max return size are 80 characters
|
||||
|
|
|
@ -105,8 +105,9 @@ ViewMode NavCategory::Deserialize(Platform::Object ^ obj)
|
|||
if (boxed != nullptr)
|
||||
{
|
||||
int serializationId = boxed->Value;
|
||||
auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest),
|
||||
[serializationId](const NavCategoryInitializer& initializer) { return initializer.serializationId == serializationId; });
|
||||
auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest), [serializationId](const NavCategoryInitializer& initializer) {
|
||||
return initializer.serializationId == serializationId;
|
||||
});
|
||||
|
||||
if (iter != s_categoryManifest.end())
|
||||
{
|
||||
|
@ -144,8 +145,9 @@ bool NavCategory::IsConverterViewMode(ViewMode mode)
|
|||
|
||||
bool NavCategory::IsModeInCategoryGroup(ViewMode mode, CategoryGroupType type)
|
||||
{
|
||||
auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest),
|
||||
[mode, type](const NavCategoryInitializer& initializer) { return initializer.viewMode == mode && initializer.groupType == type; });
|
||||
auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest), [mode, type](const NavCategoryInitializer& initializer) {
|
||||
return initializer.viewMode == mode && initializer.groupType == type;
|
||||
});
|
||||
|
||||
return iter != s_categoryManifest.end();
|
||||
}
|
||||
|
@ -160,8 +162,9 @@ String ^ NavCategory::GetFriendlyName(ViewMode mode)
|
|||
|
||||
ViewMode NavCategory::GetViewModeForFriendlyName(String ^ name)
|
||||
{
|
||||
auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest),
|
||||
[name](const NavCategoryInitializer& initializer) { return wcscmp(initializer.friendlyName, name->Data()) == 0; });
|
||||
auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest), [name](const NavCategoryInitializer& initializer) {
|
||||
return wcscmp(initializer.friendlyName, name->Data()) == 0;
|
||||
});
|
||||
|
||||
return (iter != s_categoryManifest.end()) ? iter->viewMode : ViewMode::None;
|
||||
}
|
||||
|
@ -238,8 +241,9 @@ int NavCategory::GetPosition(ViewMode mode)
|
|||
|
||||
ViewMode NavCategory::GetViewModeForVirtualKey(MyVirtualKey virtualKey)
|
||||
{
|
||||
auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest),
|
||||
[virtualKey](const NavCategoryInitializer& initializer) { return initializer.virtualKey == virtualKey; });
|
||||
auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest), [virtualKey](const NavCategoryInitializer& initializer) {
|
||||
return initializer.virtualKey == virtualKey;
|
||||
});
|
||||
|
||||
return (iter != s_categoryManifest.end()) ? iter->viewMode : ViewMode::None;
|
||||
}
|
||||
|
@ -285,9 +289,9 @@ NavCategoryGroup::NavCategoryGroup(const NavCategoryGroupInitializer& groupIniti
|
|||
String ^ categoryAutomationName = ref new String(
|
||||
LocalizationStringUtil::GetLocalizedString(navCategoryItemAutomationNameFormat->Data(), categoryName->Data(), m_Name->Data()).c_str());
|
||||
|
||||
m_Categories->Append(ref new NavCategory(categoryName, categoryAutomationName, StringReference(categoryInitializer.glyph),
|
||||
resProvider.GetResourceString(nameResourceKey + "AccessKey"), groupMode, categoryInitializer.viewMode,
|
||||
categoryInitializer.supportsNegative));
|
||||
m_Categories->Append(ref new NavCategory(
|
||||
categoryName, categoryAutomationName, StringReference(categoryInitializer.glyph), resProvider.GetResourceString(nameResourceKey + "AccessKey"),
|
||||
groupMode, categoryInitializer.viewMode, categoryInitializer.supportsNegative));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -313,16 +317,18 @@ NavCategoryGroup ^ NavCategoryGroup::CreateConverterCategory()
|
|||
vector<NavCategoryInitializer> NavCategoryGroup::GetInitializerCategoryGroup(CategoryGroupType groupType)
|
||||
{
|
||||
vector<NavCategoryInitializer> initializers{};
|
||||
copy_if(begin(s_categoryManifest), end(s_categoryManifest), back_inserter(initializers),
|
||||
[groupType](const NavCategoryInitializer& initializer) { return initializer.groupType == groupType; });
|
||||
copy_if(begin(s_categoryManifest), end(s_categoryManifest), back_inserter(initializers), [groupType](const NavCategoryInitializer& initializer) {
|
||||
return initializer.groupType == groupType;
|
||||
});
|
||||
|
||||
return initializers;
|
||||
}
|
||||
|
||||
String ^ NavCategoryGroup::GetHeaderResourceKey(CategoryGroupType type)
|
||||
{
|
||||
auto iter = find_if(begin(s_categoryGroupManifest), end(s_categoryGroupManifest),
|
||||
[type](const NavCategoryGroupInitializer& initializer) { return initializer.type == type; });
|
||||
auto iter = find_if(begin(s_categoryGroupManifest), end(s_categoryGroupManifest), [type](const NavCategoryGroupInitializer& initializer) {
|
||||
return initializer.type == type;
|
||||
});
|
||||
|
||||
return (iter != s_categoryGroupManifest.end()) ? StringReference(iter->headerResourceKey) : nullptr;
|
||||
}
|
||||
|
|
|
@ -58,8 +58,9 @@ namespace CalculatorApp
|
|||
private
|
||||
struct NavCategoryInitializer
|
||||
{
|
||||
constexpr NavCategoryInitializer(ViewMode mode, int id, wchar_t const* name, wchar_t const* nameKey, wchar_t const* glyph, CategoryGroupType group,
|
||||
MyVirtualKey vKey, bool categorySupportsNegative)
|
||||
constexpr NavCategoryInitializer(
|
||||
ViewMode mode, int id, wchar_t const* name, wchar_t const* nameKey, wchar_t const* glyph, CategoryGroupType group, MyVirtualKey vKey,
|
||||
bool categorySupportsNegative)
|
||||
: viewMode(mode)
|
||||
, serializationId(id)
|
||||
, friendlyName(name)
|
||||
|
@ -161,7 +162,8 @@ namespace CalculatorApp
|
|||
|
||||
static ViewMode GetViewModeForVirtualKey(MyVirtualKey virtualKey);
|
||||
|
||||
internal : NavCategory(Platform::String ^ name, Platform::String ^ automationName, Platform::String ^ glyph, Platform::String ^ accessKey,
|
||||
internal : NavCategory(
|
||||
Platform::String ^ name, Platform::String ^ automationName, Platform::String ^ glyph, Platform::String ^ accessKey,
|
||||
Platform::String ^ mode, ViewMode viewMode, bool supportsNegative)
|
||||
: m_name(name)
|
||||
, m_automationName(automationName)
|
||||
|
|
|
@ -15,14 +15,16 @@ namespace CalculatorApp
|
|||
{
|
||||
}
|
||||
|
||||
TraceActivity(winrt::Windows::Foundation::Diagnostics::LoggingChannel channel, std::wstring_view activityName,
|
||||
TraceActivity(
|
||||
winrt::Windows::Foundation::Diagnostics::LoggingChannel channel, std::wstring_view activityName,
|
||||
winrt::Windows::Foundation::Diagnostics::LoggingFields fields)
|
||||
: m_channel(channel), m_activityName(activityName), m_fields(fields), m_activity(nullptr)
|
||||
{
|
||||
// Write the activity's START event. Note that you must not specify keyword
|
||||
// or level for START and STOP events because they always use the activity's
|
||||
// keyword and level.
|
||||
m_activity = m_channel.StartActivity(m_activityName, m_fields, winrt::Windows::Foundation::Diagnostics::LoggingLevel::Verbose,
|
||||
m_activity = m_channel.StartActivity(
|
||||
m_activityName, m_fields, winrt::Windows::Foundation::Diagnostics::LoggingLevel::Verbose,
|
||||
winrt::Windows::Foundation::Diagnostics::LoggingOptions(WINEVENT_KEYWORD_RESPONSE_TIME));
|
||||
}
|
||||
|
||||
|
|
|
@ -607,8 +607,8 @@ namespace CalculatorApp
|
|||
}
|
||||
}
|
||||
|
||||
void TraceLogger::LogMemoryUsed(int windowId, unsigned int slotPosition, bool isStandard, bool isScientific, bool isProgrammer,
|
||||
unsigned int memorySize) const
|
||||
void
|
||||
TraceLogger::LogMemoryUsed(int windowId, unsigned int slotPosition, bool isStandard, bool isScientific, bool isProgrammer, unsigned int memorySize) const
|
||||
{
|
||||
if (!GetTraceLoggingProviderEnabled())
|
||||
return;
|
||||
|
|
|
@ -96,8 +96,8 @@ namespace CalculatorApp
|
|||
// Trace methods for Date Calculator usage
|
||||
void LogDateDifferenceModeUsed(int windowId);
|
||||
void LogDateAddSubtractModeUsed(int windowId, bool isAddMode);
|
||||
void LogDateClippedTimeDifferenceFound(winrt::Windows::Globalization::Calendar const& today,
|
||||
winrt::Windows::Foundation::DateTime const& clippedTime) const;
|
||||
void
|
||||
LogDateClippedTimeDifferenceFound(winrt::Windows::Globalization::Calendar const& today, winrt::Windows::Foundation::DateTime const& clippedTime) const;
|
||||
|
||||
void LogStandardException(std::wstring_view functionName, _In_ const std::exception& e) const;
|
||||
void LogWinRTException(std::wstring_view functionName, _In_ winrt::hresult_error const& e) const;
|
||||
|
|
|
@ -92,8 +92,9 @@ wstring Utils::RemoveUnwantedCharsFromWstring(wstring input, wchar_t* unwantedCh
|
|||
return input;
|
||||
}
|
||||
|
||||
void Utils::SerializeCommandsAndTokens(_In_ shared_ptr<CalculatorVector<pair<wstring, int>>> const& tokens,
|
||||
_In_ shared_ptr<CalculatorVector<shared_ptr<IExpressionCommand>>> const& commands, DataWriter ^ writer)
|
||||
void Utils::SerializeCommandsAndTokens(
|
||||
_In_ shared_ptr<CalculatorVector<pair<wstring, int>>> const& tokens, _In_ shared_ptr<CalculatorVector<shared_ptr<IExpressionCommand>>> const& commands,
|
||||
DataWriter ^ writer)
|
||||
{
|
||||
unsigned int commandsSize;
|
||||
IFTPlatformException(commands->GetSize(&commandsSize));
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
m_##n = value; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
t m_##n; \
|
||||
\
|
||||
public:
|
||||
|
||||
#define PROPERTY_RW(t, n) \
|
||||
|
@ -39,8 +41,10 @@ public:
|
|||
m_##n = value; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
t m_##n; \
|
||||
\
|
||||
public:
|
||||
|
||||
#define OBSERVABLE_PROPERTY_R(t, n) \
|
||||
|
@ -61,8 +65,10 @@ public:
|
|||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
t m_##n; \
|
||||
\
|
||||
public:
|
||||
|
||||
#define OBSERVABLE_PROPERTY_RW(t, n) \
|
||||
|
@ -81,8 +87,10 @@ public:
|
|||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
t m_##n; \
|
||||
\
|
||||
public:
|
||||
|
||||
#define OBSERVABLE_NAMED_PROPERTY_R(t, n) \
|
||||
|
@ -92,6 +100,7 @@ public:
|
|||
{ \
|
||||
Platform::String ^ get() { return Platform::StringReference(L#n); } \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
|
||||
#define OBSERVABLE_NAMED_PROPERTY_RW(t, n) \
|
||||
|
@ -101,6 +110,7 @@ public:
|
|||
{ \
|
||||
Platform::String ^ get() { return Platform::StringReference(L#n); } \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
|
||||
#define OBSERVABLE_PROPERTY_FIELD(n) m_##n
|
||||
|
@ -114,6 +124,7 @@ public:
|
|||
{ \
|
||||
PropertyChanged(this, ref new Windows::UI::Xaml::Data::PropertyChangedEventArgs(p)); \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
#else
|
||||
#define OBSERVABLE_OBJECT() \
|
||||
|
@ -122,6 +133,7 @@ public:
|
|||
void RaisePropertyChanged(Platform::String ^ p) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
#endif
|
||||
|
||||
|
@ -136,6 +148,7 @@ public:
|
|||
PropertyChanged(this, ref new Windows::UI::Xaml::Data::PropertyChangedEventArgs(p)); \
|
||||
c(p); \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
#else
|
||||
#define OBSERVABLE_OBJECT_CALLBACK(c) \
|
||||
|
@ -145,6 +158,7 @@ public:
|
|||
{ \
|
||||
c(p); \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
#endif
|
||||
|
||||
|
@ -156,6 +170,7 @@ public:
|
|||
if (!donotuse_##p) {\
|
||||
donotuse_##p = CalculatorApp::Common::MakeDelegate(this, &m);\
|
||||
} return donotuse_##p; }} private: Windows::UI::Xaml::Input::ICommand^ donotuse_##p; \
|
||||
\
|
||||
public:
|
||||
|
||||
#define DEPENDENCY_PROPERTY_DECLARATION(t, n) \
|
||||
|
@ -173,6 +188,7 @@ public:
|
|||
\
|
||||
private: \
|
||||
static Windows::UI::Xaml::DependencyProperty ^ s_##n##Property; \
|
||||
\
|
||||
public:
|
||||
|
||||
// Utilities for DependencyProperties
|
||||
|
@ -368,9 +384,9 @@ namespace Utils
|
|||
double GetDoubleFromWstring(std::wstring input);
|
||||
int GetWindowId();
|
||||
void RunOnUIThreadNonblocking(std::function<void()>&& function, _In_ Windows::UI::Core::CoreDispatcher ^ currentDispatcher);
|
||||
void SerializeCommandsAndTokens(_In_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
_In_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& commands,
|
||||
Windows::Storage::Streams::DataWriter ^ writer);
|
||||
void SerializeCommandsAndTokens(
|
||||
_In_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
_In_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& commands, Windows::Storage::Streams::DataWriter ^ writer);
|
||||
|
||||
const std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> DeserializeCommands(Windows::Storage::Streams::DataReader ^ reader);
|
||||
const std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> DeserializeTokens(Windows::Storage::Streams::DataReader ^ reader);
|
||||
|
@ -378,7 +394,8 @@ namespace Utils
|
|||
Windows::Foundation::DateTime GetUniversalSystemTime();
|
||||
bool IsDateTimeOlderThan(Windows::Foundation::DateTime dateTime, const long long duration);
|
||||
|
||||
concurrency::task<void> WriteFileToFolder(Windows::Storage::IStorageFolder ^ folder, Platform::String ^ fileName, Platform::String ^ contents,
|
||||
concurrency::task<void> WriteFileToFolder(
|
||||
Windows::Storage::IStorageFolder ^ folder, Platform::String ^ fileName, Platform::String ^ contents,
|
||||
Windows::Storage::CreationCollisionOption collisionOption);
|
||||
concurrency::task<Platform::String ^> ReadFileFromFolder(Windows::Storage::IStorageFolder ^ folder, Platform::String ^ fileName);
|
||||
}
|
||||
|
@ -387,6 +404,7 @@ namespace Utils
|
|||
#define DEPENDENCY_PROPERTY_OWNER(owner) \
|
||||
private: \
|
||||
typedef owner DependencyPropertiesOwner; \
|
||||
\
|
||||
public:
|
||||
|
||||
// Normal DependencyProperty
|
||||
|
@ -402,6 +420,7 @@ public:
|
|||
SetValue(s_##name##Property, value); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
static Windows::UI::Xaml::DependencyProperty ^ s_##name##Property; \
|
||||
\
|
||||
|
@ -419,6 +438,7 @@ private:
|
|||
{ \
|
||||
return Utils::RegisterDependencyProperty<DependencyPropertiesOwner, type>(L#name); \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
|
||||
#define DEPENDENCY_PROPERTY_WITH_DEFAULT(type, name, defaultValue) \
|
||||
|
@ -433,6 +453,7 @@ public:
|
|||
SetValue(s_##name##Property, value); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
static Windows::UI::Xaml::DependencyProperty ^ s_##name##Property; \
|
||||
\
|
||||
|
@ -450,6 +471,7 @@ private:
|
|||
{ \
|
||||
return Utils::RegisterDependencyProperty<DependencyPropertiesOwner, type>(L#name, defaultValue); \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
|
||||
#define DEPENDENCY_PROPERTY_WITH_CALLBACK(type, name) \
|
||||
|
@ -464,6 +486,7 @@ public:
|
|||
SetValue(s_##name##Property, value); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
static Windows::UI::Xaml::DependencyProperty ^ s_##name##Property; \
|
||||
\
|
||||
|
@ -486,6 +509,7 @@ private:
|
|||
auto self = safe_cast<DependencyPropertiesOwner ^>(sender); \
|
||||
self->On##name##PropertyChanged(safe_cast<type>(args->OldValue), safe_cast<type>(args->NewValue)); \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
|
||||
#define DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(type, name, defaultValue) \
|
||||
|
@ -500,6 +524,7 @@ public:
|
|||
SetValue(s_##name##Property, value); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
static Windows::UI::Xaml::DependencyProperty ^ s_##name##Property; \
|
||||
\
|
||||
|
@ -522,6 +547,7 @@ private:
|
|||
auto self = safe_cast<DependencyPropertiesOwner ^>(sender); \
|
||||
self->On##name##PropertyChanged(safe_cast<type>(args->OldValue), safe_cast<type>(args->NewValue)); \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
|
||||
// Attached DependencyProperty
|
||||
|
@ -552,6 +578,7 @@ private:
|
|||
{ \
|
||||
return Utils::RegisterDependencyPropertyAttached<DependencyPropertiesOwner, type>(L#name); \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
|
||||
#define DEPENDENCY_PROPERTY_ATTACHED_WITH_DEFAULT(type, name, defaultValue) \
|
||||
|
@ -581,6 +608,7 @@ private:
|
|||
{ \
|
||||
return Utils::RegisterDependencyPropertyAttached<DependencyPropertiesOwner, type>(L#name, defaultValue); \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
|
||||
#define DEPENDENCY_PROPERTY_ATTACHED_WITH_CALLBACK(type, name) \
|
||||
|
@ -614,6 +642,7 @@ private:
|
|||
{ \
|
||||
On##name##PropertyChanged(sender, safe_cast<type>(args->OldValue), safe_cast<type>(args->NewValue)); \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
|
||||
#define DEPENDENCY_PROPERTY_ATTACHED_WITH_DEFAULT_AND_CALLBACK(type, name, defaultValue) \
|
||||
|
@ -647,6 +676,7 @@ private:
|
|||
{ \
|
||||
On##name##PropertyChanged(sender, safe_cast<type>(args->OldValue), safe_cast<type>(args->NewValue)); \
|
||||
} \
|
||||
\
|
||||
public:
|
||||
|
||||
// This goes into the cpp to initialize the static variable
|
||||
|
|
|
@ -17,7 +17,8 @@ namespace CalculatorApp
|
|||
|
||||
private:
|
||||
virtual Platform::Object
|
||||
^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
^ Convert(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::Convert
|
||||
{
|
||||
// Pass through as we don't want to change the value from the source
|
||||
|
@ -25,7 +26,8 @@ namespace CalculatorApp
|
|||
}
|
||||
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
^ ConvertBack(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack
|
||||
{
|
||||
if (value)
|
||||
|
@ -47,7 +49,8 @@ namespace CalculatorApp
|
|||
|
||||
private:
|
||||
virtual Platform::Object
|
||||
^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
^ Convert(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::Convert
|
||||
{
|
||||
// Pass through as we don't want to change the value from the source
|
||||
|
@ -55,7 +58,8 @@ namespace CalculatorApp
|
|||
}
|
||||
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
^ ConvertBack(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack
|
||||
{
|
||||
// The value to be valid has to be a boxed int32 value
|
||||
|
|
|
@ -275,8 +275,8 @@ pair<wstring, wstring> CurrencyDataLoader::GetCurrencyRatioEquality(_In_ const U
|
|||
wstring digitSymbol = wstring{ LocalizationSettings::GetInstance().GetDigitSymbolFromEnUsDigit(L'1') };
|
||||
wstring roundedFormat = m_ratioFormatter->Format(rounded)->Data();
|
||||
|
||||
wstring ratioString = LocalizationStringUtil::GetLocalizedString(m_ratioFormat.c_str(), digitSymbol.c_str(), unit1.abbreviation.c_str(),
|
||||
roundedFormat.c_str(), unit2.abbreviation.c_str());
|
||||
wstring ratioString = LocalizationStringUtil::GetLocalizedString(
|
||||
m_ratioFormat.c_str(), digitSymbol.c_str(), unit1.abbreviation.c_str(), roundedFormat.c_str(), unit2.abbreviation.c_str());
|
||||
|
||||
wstring accessibleRatioString = LocalizationStringUtil::GetLocalizedString(
|
||||
m_ratioFormat.c_str(), digitSymbol.c_str(), unit1.accessibleName.c_str(), roundedFormat.c_str(), unit2.accessibleName.c_str());
|
||||
|
@ -459,8 +459,8 @@ task<bool> CurrencyDataLoader::TryLoadDataFromWebOverrideAsync()
|
|||
};
|
||||
#pragma optimize("", on)
|
||||
|
||||
bool CurrencyDataLoader::TryParseWebResponses(_In_ String ^ staticDataJson, _In_ String ^ allRatiosJson, _Inout_ vector<UCM::CurrencyStaticData>& staticData,
|
||||
_Inout_ CurrencyRatioMap& allRatiosData)
|
||||
bool CurrencyDataLoader::TryParseWebResponses(
|
||||
_In_ String ^ staticDataJson, _In_ String ^ allRatiosJson, _Inout_ vector<UCM::CurrencyStaticData>& staticData, _Inout_ CurrencyRatioMap& allRatiosData)
|
||||
{
|
||||
return TryParseStaticData(staticDataJson, staticData) && TryParseAllRatiosData(allRatiosJson, allRatiosData);
|
||||
}
|
||||
|
|
|
@ -71,8 +71,8 @@ namespace CalculatorApp
|
|||
// ICurrencyConverterDataLoader
|
||||
void SetViewModelCallback(const std::shared_ptr<UCM::IViewModelCurrencyCallback>& callback) override;
|
||||
std::pair<std::wstring, std::wstring> GetCurrencySymbols(const UCM::Unit& unit1, const UCM::Unit& unit2) override;
|
||||
std::pair<std::wstring, std::wstring> GetCurrencyRatioEquality(_In_ const UnitConversionManager::Unit& unit1,
|
||||
_In_ const UnitConversionManager::Unit& unit2) override;
|
||||
std::pair<std::wstring, std::wstring>
|
||||
GetCurrencyRatioEquality(_In_ const UnitConversionManager::Unit& unit1, _In_ const UnitConversionManager::Unit& unit2) override;
|
||||
std::wstring GetCurrencyTimestamp() override;
|
||||
|
||||
concurrency::task<bool> TryLoadDataFromCacheAsync() override;
|
||||
|
@ -88,8 +88,9 @@ namespace CalculatorApp
|
|||
|
||||
concurrency::task<bool> TryFinishLoadFromCacheAsync();
|
||||
|
||||
bool TryParseWebResponses(_In_ Platform::String ^ staticDataJson, _In_ Platform::String ^ allRatiosJson,
|
||||
_Inout_ std::vector<UCM::CurrencyStaticData>& staticData, _Inout_ CurrencyRatioMap& allRatiosData);
|
||||
bool TryParseWebResponses(
|
||||
_In_ Platform::String ^ staticDataJson, _In_ Platform::String ^ allRatiosJson, _Inout_ std::vector<UCM::CurrencyStaticData>& staticData,
|
||||
_Inout_ CurrencyRatioMap& allRatiosData);
|
||||
bool TryParseStaticData(_In_ Platform::String ^ rawJson, _Inout_ std::vector<UCM::CurrencyStaticData>& staticData);
|
||||
bool TryParseAllRatiosData(_In_ Platform::String ^ rawJson, _Inout_ CurrencyRatioMap& allRatiosData);
|
||||
concurrency::task<void> FinalizeUnits(_In_ const std::vector<UCM::CurrencyStaticData>& staticData, _In_ const CurrencyRatioMap& ratioMap);
|
||||
|
|
|
@ -53,8 +53,9 @@ bool UnitConverterDataLoader::SupportsCategory(const UCM::Category& target)
|
|||
}
|
||||
|
||||
static int currencyId = NavCategory::Serialize(ViewMode::Currency);
|
||||
auto itr = find_if(supportedCategories->begin(), supportedCategories->end(),
|
||||
[&](const UCM::Category& category) { return currencyId != category.id && target.id == category.id; });
|
||||
auto itr = find_if(supportedCategories->begin(), supportedCategories->end(), [&](const UCM::Category& category) {
|
||||
return currencyId != category.id && target.id == category.id;
|
||||
});
|
||||
|
||||
return itr != supportedCategories->end();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,8 @@ namespace CalculatorApp
|
|||
{
|
||||
}
|
||||
|
||||
OrderedUnit(int id, std::wstring name, std::wstring abbreviation, int order, bool isConversionSource = false, bool isConversionTarget = false,
|
||||
OrderedUnit(
|
||||
int id, std::wstring name, std::wstring abbreviation, int order, bool isConversionSource = false, bool isConversionTarget = false,
|
||||
bool isWhimsical = false)
|
||||
: UnitConversionManager::Unit(id, name, abbreviation, isConversionSource, isConversionTarget, isWhimsical), order(order)
|
||||
{
|
||||
|
@ -37,8 +38,8 @@ namespace CalculatorApp
|
|||
ExplicitUnitConversionData()
|
||||
{
|
||||
}
|
||||
ExplicitUnitConversionData(CalculatorApp::Common::ViewMode categoryId, int parentUnitId, int unitId, double ratio, double offset,
|
||||
bool offsetFirst = false)
|
||||
ExplicitUnitConversionData(
|
||||
CalculatorApp::Common::ViewMode categoryId, int parentUnitId, int unitId, double ratio, double offset, bool offsetFirst = false)
|
||||
: categoryId(categoryId), parentUnitId(parentUnitId), unitId(unitId), UnitConversionManager::ConversionData(ratio, offset, offsetFirst)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -105,8 +105,9 @@ void DateCalculatorViewModel::OnPropertyChanged(_In_ String ^ prop)
|
|||
{
|
||||
UpdateStrDateResultAutomationName();
|
||||
}
|
||||
else if (prop != StrDateDiffResultAutomationNamePropertyName && prop != StrDateDiffResultInDaysPropertyName
|
||||
&& prop != StrDateResultAutomationNamePropertyName && prop != IsDiffInDaysPropertyName)
|
||||
else if (
|
||||
prop != StrDateDiffResultAutomationNamePropertyName && prop != StrDateDiffResultInDaysPropertyName && prop != StrDateResultAutomationNamePropertyName
|
||||
&& prop != IsDiffInDaysPropertyName)
|
||||
{
|
||||
OnInputsChanged();
|
||||
}
|
||||
|
@ -216,7 +217,8 @@ void DateCalculatorViewModel::UpdateStrDateResultAutomationName()
|
|||
void DateCalculatorViewModel::InitializeDateOutputFormats(_In_ String ^ calendarIdentifier)
|
||||
{
|
||||
// Format for Add/Subtract days
|
||||
m_dateTimeFormatter = LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(L"longdate", calendarIdentifier,
|
||||
m_dateTimeFormatter = LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(
|
||||
L"longdate", calendarIdentifier,
|
||||
ClockIdentifiers::TwentyFourHour); // Clock Identifier is not used
|
||||
|
||||
// Format for Date Difference
|
||||
|
|
|
@ -10,7 +10,8 @@ using namespace CalculatorApp::ViewModel;
|
|||
using namespace std;
|
||||
using namespace Platform;
|
||||
|
||||
HistoryItemViewModel::HistoryItemViewModel(String ^ expression, String ^ result, _In_ const shared_ptr<CalculatorVector<pair<wstring, int>>>& spTokens,
|
||||
HistoryItemViewModel::HistoryItemViewModel(
|
||||
String ^ expression, String ^ result, _In_ const shared_ptr<CalculatorVector<pair<wstring, int>>>& spTokens,
|
||||
_In_ const shared_ptr<CalculatorVector<shared_ptr<IExpressionCommand>>>& spCommands)
|
||||
: m_expression(expression), m_result(result), m_spTokens(spTokens), m_spCommands(spCommands)
|
||||
{
|
||||
|
@ -20,8 +21,8 @@ HistoryItemViewModel::HistoryItemViewModel(String ^ expression, String ^ result,
|
|||
}
|
||||
|
||||
String
|
||||
^ HistoryItemViewModel::GetAccessibleExpressionFromTokens(_In_ shared_ptr<CalculatorVector<pair<wstring, int>>> const& spTokens,
|
||||
_In_ String ^ fallbackExpression)
|
||||
^ HistoryItemViewModel::GetAccessibleExpressionFromTokens(
|
||||
_In_ shared_ptr<CalculatorVector<pair<wstring, int>>> const& spTokens, _In_ String ^ fallbackExpression)
|
||||
{
|
||||
// updating accessibility names for expression and result
|
||||
wstringstream accExpression{};
|
||||
|
|
|
@ -14,7 +14,8 @@ namespace CalculatorApp
|
|||
{
|
||||
internal :
|
||||
|
||||
HistoryItemViewModel(Platform::String ^ expression, Platform::String ^ result,
|
||||
HistoryItemViewModel(
|
||||
Platform::String ^ expression, Platform::String ^ result,
|
||||
_In_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& spTokens,
|
||||
_In_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& spCommands);
|
||||
|
||||
|
@ -59,8 +60,8 @@ namespace CalculatorApp
|
|||
^ GetStringRepresentation() { return m_accExpression + " " + m_accResult; }
|
||||
|
||||
private : static Platform::String
|
||||
^ GetAccessibleExpressionFromTokens(_In_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& spTokens,
|
||||
_In_ Platform::String ^ fallbackExpression);
|
||||
^ GetAccessibleExpressionFromTokens(
|
||||
_In_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& spTokens, _In_ Platform::String ^ fallbackExpression);
|
||||
|
||||
private:
|
||||
Platform::String ^ m_expression;
|
||||
|
|
|
@ -69,8 +69,9 @@ void HistoryViewModel::ReloadHistory(_In_ ViewMode currentMode)
|
|||
localizer.LocalizeDisplayValue(&expression);
|
||||
localizer.LocalizeDisplayValue(&result);
|
||||
|
||||
auto item = ref new HistoryItemViewModel(ref new Platform::String(expression.c_str()), ref new Platform::String(result.c_str()),
|
||||
(*ritr)->historyItemVector.spTokens, (*ritr)->historyItemVector.spCommands);
|
||||
auto item = ref new HistoryItemViewModel(
|
||||
ref new Platform::String(expression.c_str()), ref new Platform::String(result.c_str()), (*ritr)->historyItemVector.spTokens,
|
||||
(*ritr)->historyItemVector.spCommands);
|
||||
historyListVM->Append(item);
|
||||
}
|
||||
}
|
||||
|
@ -87,8 +88,9 @@ void HistoryViewModel::OnHistoryItemAdded(_In_ unsigned int addedItemIndex)
|
|||
wstring result = newItem->historyItemVector.result;
|
||||
localizer.LocalizeDisplayValue(&expression);
|
||||
localizer.LocalizeDisplayValue(&result);
|
||||
auto item = ref new HistoryItemViewModel(ref new Platform::String(expression.c_str()), ref new Platform::String(result.c_str()),
|
||||
newItem->historyItemVector.spTokens, newItem->historyItemVector.spCommands);
|
||||
auto item = ref new HistoryItemViewModel(
|
||||
ref new Platform::String(expression.c_str()), ref new Platform::String(result.c_str()), newItem->historyItemVector.spTokens,
|
||||
newItem->historyItemVector.spCommands);
|
||||
|
||||
// check if we have not hit the max items
|
||||
if (Items->Size >= m_calculatorManager->MaxHistorySize())
|
||||
|
@ -310,8 +312,8 @@ Platform::String ^ HistoryViewModel::SerializeHistoryItem(_In_ std::shared_ptr<C
|
|||
return CryptographicBuffer::EncodeToBase64String(buffer);
|
||||
}
|
||||
|
||||
CalculationManager::HISTORYITEM HistoryViewModel::DeserializeHistoryItem(_In_ Platform::String ^ historyItemKey,
|
||||
_In_ ApplicationDataContainer ^ historyContainer)
|
||||
CalculationManager::HISTORYITEM
|
||||
HistoryViewModel::DeserializeHistoryItem(_In_ Platform::String ^ historyItemKey, _In_ ApplicationDataContainer ^ historyContainer)
|
||||
{
|
||||
CalculationManager::HISTORYITEM historyItem;
|
||||
if (historyContainer->Values->HasKey(historyItemKey))
|
||||
|
@ -352,7 +354,8 @@ CalculationManager::HISTORYITEM HistoryViewModel::DeserializeHistoryItem(_In_ Pl
|
|||
|
||||
bool HistoryViewModel::IsValid(_In_ CalculationManager::HISTORYITEM item)
|
||||
{
|
||||
return (!item.historyItemVector.expression.empty() && !item.historyItemVector.result.empty() && (bool)item.historyItemVector.spCommands
|
||||
return (
|
||||
!item.historyItemVector.expression.empty() && !item.historyItemVector.result.empty() && (bool)item.historyItemVector.spCommands
|
||||
&& (bool)item.historyItemVector.spTokens);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,8 +60,8 @@ namespace CalculatorApp
|
|||
Platform::String ^ m_localizedHistoryCleared;
|
||||
|
||||
void RestoreHistory(_In_ CalculationManager::CALCULATOR_MODE cMode);
|
||||
CalculationManager::HISTORYITEM DeserializeHistoryItem(_In_ Platform::String ^ historyItemKey,
|
||||
_In_ Windows::Storage::ApplicationDataContainer ^ historyContainer);
|
||||
CalculationManager::HISTORYITEM
|
||||
DeserializeHistoryItem(_In_ Platform::String ^ historyItemKey, _In_ Windows::Storage::ApplicationDataContainer ^ historyContainer);
|
||||
Windows::Storage::ApplicationDataContainer ^ GetHistoryContainer(_In_ CalculationManager::CALCULATOR_MODE cMode);
|
||||
Platform::String ^ GetHistoryContainerKey(_In_ CalculationManager::CALCULATOR_MODE cMode);
|
||||
void ClearHistoryContainer(_In_ CalculationManager::CALCULATOR_MODE cMode);
|
||||
|
|
|
@ -235,9 +235,9 @@ void StandardCalculatorViewModel::SetOpenParenthesisCountNarratorAnnouncement()
|
|||
wstring localizedParenthesisCount = to_wstring(m_OpenParenthesisCount).c_str();
|
||||
LocalizationSettings::GetInstance().LocalizeDisplayValue(&localizedParenthesisCount);
|
||||
|
||||
String ^ announcement =
|
||||
LocalizationStringUtil::GetLocalizedNarratorAnnouncement(CalculatorResourceKeys::OpenParenthesisCountAutomationFormat,
|
||||
m_localizedOpenParenthesisCountChangedAutomationFormat, localizedParenthesisCount.c_str());
|
||||
String ^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement(
|
||||
CalculatorResourceKeys::OpenParenthesisCountAutomationFormat, m_localizedOpenParenthesisCountChangedAutomationFormat,
|
||||
localizedParenthesisCount.c_str());
|
||||
|
||||
Announcement = CalculatorAnnouncement::GetOpenParenthesisCountChangedAnnouncement(announcement);
|
||||
}
|
||||
|
@ -283,7 +283,8 @@ void StandardCalculatorViewModel::DisableButtons(CommandType selectedExpressionC
|
|||
}
|
||||
}
|
||||
|
||||
void StandardCalculatorViewModel::SetExpressionDisplay(_Inout_ shared_ptr<CalculatorVector<pair<wstring, int>>> const& tokens,
|
||||
void StandardCalculatorViewModel::SetExpressionDisplay(
|
||||
_Inout_ shared_ptr<CalculatorVector<pair<wstring, int>>> const& tokens,
|
||||
_Inout_ shared_ptr<CalculatorVector<shared_ptr<IExpressionCommand>>> const& commands)
|
||||
{
|
||||
m_tokens = tokens;
|
||||
|
@ -298,7 +299,8 @@ void StandardCalculatorViewModel::SetExpressionDisplay(_Inout_ shared_ptr<Calcul
|
|||
AreTokensUpdated = true;
|
||||
}
|
||||
|
||||
void StandardCalculatorViewModel::SetHistoryExpressionDisplay(_Inout_ shared_ptr<CalculatorVector<pair<wstring, int>>> const& tokens,
|
||||
void StandardCalculatorViewModel::SetHistoryExpressionDisplay(
|
||||
_Inout_ shared_ptr<CalculatorVector<pair<wstring, int>>> const& tokens,
|
||||
_Inout_ shared_ptr<CalculatorVector<shared_ptr<IExpressionCommand>>> const& commands)
|
||||
{
|
||||
m_tokens = make_shared<CalculatorVector<pair<wstring, int>>>(*tokens);
|
||||
|
@ -1035,8 +1037,8 @@ void StandardCalculatorViewModel::OnMemoryButtonPressed()
|
|||
int windowId = Utils::GetWindowId();
|
||||
TraceLogger::GetInstance().InsertIntoMemoryMap(windowId, IsStandard, IsScientific, IsProgrammer);
|
||||
|
||||
String ^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement(CalculatorResourceKeys::MemorySave, m_localizedMemorySavedAutomationFormat,
|
||||
m_DisplayValue->Data());
|
||||
String ^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement(
|
||||
CalculatorResourceKeys::MemorySave, m_localizedMemorySavedAutomationFormat, m_DisplayValue->Data());
|
||||
|
||||
Announcement = CalculatorAnnouncement::GetMemoryItemAddedAnnouncement(announcement);
|
||||
}
|
||||
|
@ -1957,9 +1959,9 @@ NarratorAnnouncement ^ StandardCalculatorViewModel::GetDisplayUpdatedNarratorAnn
|
|||
}
|
||||
else
|
||||
{
|
||||
announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement(CalculatorResourceKeys::ButtonPressFeedbackFormat,
|
||||
m_localizedButtonPressFeedbackAutomationFormat,
|
||||
m_CalculationResultAutomationName->Data(), m_feedbackForButtonPress->Data());
|
||||
announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement(
|
||||
CalculatorResourceKeys::ButtonPressFeedbackFormat, m_localizedButtonPressFeedbackAutomationFormat, m_CalculationResultAutomationName->Data(),
|
||||
m_feedbackForButtonPress->Data());
|
||||
}
|
||||
|
||||
// Make sure we don't accidentally repeat an announcement.
|
||||
|
|
|
@ -334,9 +334,11 @@ namespace CalculatorApp
|
|||
void SetPrimaryDisplay(_In_ std::wstring const& displayString, _In_ bool isError);
|
||||
void DisplayPasteError();
|
||||
void SetTokens(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens);
|
||||
void SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
void SetExpressionDisplay(
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& commands);
|
||||
void SetHistoryExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
void SetHistoryExpressionDisplay(
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& commands);
|
||||
void SetParenthesisCount(_In_ unsigned int parenthesisCount);
|
||||
void SetOpenParenthesisCountNarratorAnnouncement();
|
||||
|
|
|
@ -1010,11 +1010,12 @@ String ^ UnitConverterViewModel::GetLocalizedAutomationName(_In_ String ^ displa
|
|||
}
|
||||
|
||||
String
|
||||
^ UnitConverterViewModel::GetLocalizedConversionResultStringFormat(_In_ String ^ fromValue, _In_ String ^ fromUnit, _In_ String ^ toValue,
|
||||
_In_ String ^ toUnit)
|
||||
^ UnitConverterViewModel::GetLocalizedConversionResultStringFormat(
|
||||
_In_ String ^ fromValue, _In_ String ^ fromUnit, _In_ String ^ toValue, _In_ String ^ toUnit)
|
||||
{
|
||||
String ^ localizedString = ref new String(LocalizationStringUtil::GetLocalizedString(m_localizedConversionResultFormat->Data(), fromValue->Data(),
|
||||
fromUnit->Data(), toValue->Data(), toUnit->Data())
|
||||
String ^ localizedString =
|
||||
ref new String(LocalizationStringUtil::GetLocalizedString(
|
||||
m_localizedConversionResultFormat->Data(), fromValue->Data(), fromUnit->Data(), toValue->Data(), toUnit->Data())
|
||||
.c_str());
|
||||
return localizedString;
|
||||
}
|
||||
|
|
|
@ -207,8 +207,8 @@ namespace CalculatorApp
|
|||
Platform::String
|
||||
^ GetLocalizedAutomationName(_In_ Platform::String ^ displayvalue, _In_ Platform::String ^ unitname, _In_ Platform::String ^ format);
|
||||
Platform::String
|
||||
^ GetLocalizedConversionResultStringFormat(_In_ Platform::String ^ fromValue, _In_ Platform::String ^ fromUnit, _In_ Platform::String ^ toValue,
|
||||
_In_ Platform::String ^ toUnit);
|
||||
^ GetLocalizedConversionResultStringFormat(
|
||||
_In_ Platform::String ^ fromValue, _In_ Platform::String ^ fromUnit, _In_ Platform::String ^ toValue, _In_ Platform::String ^ toUnit);
|
||||
void UpdateValue1AutomationName();
|
||||
void UpdateValue2AutomationName();
|
||||
Platform::String ^ Serialize();
|
||||
|
|
|
@ -356,8 +356,8 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument)
|
|||
auto activatedEventArgs = dynamic_cast<IApplicationViewActivatedEventArgs ^>(args);
|
||||
if ((activatedEventArgs != nullptr) && (activatedEventArgs->CurrentlyShownApplicationViewId != 0))
|
||||
{
|
||||
create_task(ApplicationViewSwitcher::TryShowAsStandaloneAsync(frameService->GetViewId(), ViewSizePreference::Default,
|
||||
activatedEventArgs->CurrentlyShownApplicationViewId,
|
||||
create_task(ApplicationViewSwitcher::TryShowAsStandaloneAsync(
|
||||
frameService->GetViewId(), ViewSizePreference::Default, activatedEventArgs->CurrentlyShownApplicationViewId,
|
||||
ViewSizePreference::Default))
|
||||
.then(
|
||||
[safeFrameServiceCreation](bool viewShown) {
|
||||
|
@ -385,8 +385,8 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument)
|
|||
|
||||
if (activationViewSwitcher != nullptr)
|
||||
{
|
||||
activationViewSwitcher->ShowAsStandaloneAsync(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()),
|
||||
ViewSizePreference::Default);
|
||||
activationViewSwitcher->ShowAsStandaloneAsync(
|
||||
ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), ViewSizePreference::Default);
|
||||
TraceLogger::GetInstance().LogNewWindowCreationEnd(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
TraceLogger::GetInstance().LogPrelaunchedAppActivatedByUser();
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ namespace CalculatorApp
|
|||
throw ref new Platform::NotImplementedException();
|
||||
}
|
||||
property Windows::Foundation::Collections::IObservableVector<Platform::Object ^> ^ CollectionGroups {
|
||||
virtual Windows::Foundation::Collections::IObservableVector<Platform::Object
|
||||
^> ^ get() = Windows::UI::Xaml::Data::ICollectionView::CollectionGroups::get
|
||||
virtual Windows::Foundation::Collections::IObservableVector<
|
||||
Platform::Object ^> ^ get() = Windows::UI::Xaml::Data::ICollectionView::CollectionGroups::get
|
||||
{
|
||||
return ref new Platform::Collections::Vector<Platform::Object ^>();
|
||||
}
|
||||
|
@ -80,8 +80,9 @@ namespace CalculatorApp
|
|||
// restore the selection to the way we wanted it to begin with
|
||||
if (m_currentPosition >= 0 && m_currentPosition < static_cast<int>(m_source->Size))
|
||||
{
|
||||
this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal,
|
||||
ref new Windows::UI::Core::DispatchedHandler([this]() { m_currentChanged(this, nullptr); }));
|
||||
this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this]() {
|
||||
m_currentChanged(this, nullptr);
|
||||
}));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -167,14 +168,14 @@ namespace CalculatorApp
|
|||
{
|
||||
throw ref new Platform::NotImplementedException();
|
||||
}
|
||||
virtual unsigned int
|
||||
GetMany(unsigned int /*startIndex*/,
|
||||
virtual unsigned int GetMany(
|
||||
unsigned int /*startIndex*/,
|
||||
Platform::WriteOnlyArray<Platform::Object ^> ^ /*items*/) = Windows::Foundation::Collections::IVector<Platform::Object ^>::GetMany
|
||||
{
|
||||
throw ref new Platform::NotImplementedException();
|
||||
}
|
||||
virtual Windows::Foundation::Collections::IVectorView<Platform::Object ^> ^ GetView() = Windows::Foundation::Collections::IVector<Platform::Object
|
||||
^>::GetView
|
||||
virtual Windows::Foundation::Collections::IVectorView<Platform::Object ^> ^ GetView() = Windows::Foundation::Collections::IVector<
|
||||
Platform::Object ^>::GetView
|
||||
{
|
||||
throw ref new Platform::NotImplementedException();
|
||||
}
|
||||
|
@ -263,7 +264,8 @@ namespace CalculatorApp
|
|||
|
||||
private:
|
||||
virtual Platform::Object
|
||||
^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
^ Convert(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::Convert
|
||||
{
|
||||
auto result = dynamic_cast<Windows::UI::Xaml::Interop::IBindableVector ^>(value);
|
||||
|
@ -275,7 +277,8 @@ namespace CalculatorApp
|
|||
}
|
||||
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(Platform::Object ^ /*value*/, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
^ ConvertBack(
|
||||
Platform::Object ^ /*value*/, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/,
|
||||
Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack
|
||||
{
|
||||
return Windows::UI::Xaml::DependencyProperty::UnsetValue;
|
||||
|
|
|
@ -58,8 +58,8 @@ namespace CalculatorApp
|
|||
#pragma region Tracing methods
|
||||
void AppLifecycleLogger::LogAppLifecycleEvent(hstring const& eventName, LoggingFields const& fields) const
|
||||
{
|
||||
m_appLifecycleProvider.LogEvent(eventName, fields, LoggingLevel::Information,
|
||||
LoggingOptions(MICROSOFT_KEYWORD_TELEMETRY | WINEVENT_KEYWORD_RESPONSE_TIME));
|
||||
m_appLifecycleProvider.LogEvent(
|
||||
eventName, fields, LoggingLevel::Information, LoggingOptions(MICROSOFT_KEYWORD_TELEMETRY | WINEVENT_KEYWORD_RESPONSE_TIME));
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
|
|
|
@ -155,7 +155,8 @@ void OverflowTextBlock::UpdateScrollButtons()
|
|||
ShowHideScrollButtons(::Visibility::Collapsed, ::Visibility::Collapsed);
|
||||
}
|
||||
// We have more number on both side. Show both arrows
|
||||
else if ((m_expressionContainer->HorizontalOffset > 0)
|
||||
else if (
|
||||
(m_expressionContainer->HorizontalOffset > 0)
|
||||
&& (m_expressionContainer->HorizontalOffset < (m_expressionContainer->ExtentWidth - m_expressionContainer->ViewportWidth)))
|
||||
{
|
||||
ShowHideScrollButtons(::Visibility::Visible, ::Visibility::Visible);
|
||||
|
|
|
@ -14,10 +14,12 @@ namespace CalculatorApp
|
|||
{
|
||||
public:
|
||||
virtual Platform::Object
|
||||
^ Convert(_In_ Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, _In_ Platform::Object ^ parameter,
|
||||
^ Convert(
|
||||
_In_ Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, _In_ Platform::Object ^ parameter,
|
||||
_In_ Platform::String ^ language);
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(_In_ Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, _In_ Platform::Object ^ parameter,
|
||||
^ ConvertBack(
|
||||
_In_ Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, _In_ Platform::Object ^ parameter,
|
||||
_In_ Platform::String ^ language);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace CalculatorApp
|
|||
virtual Platform::Object
|
||||
^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter,
|
||||
Platform::String ^ language);
|
||||
^ ConvertBack(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace CalculatorApp
|
|||
virtual Platform::Object
|
||||
^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter,
|
||||
Platform::String ^ language);
|
||||
^ ConvertBack(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
@ -38,8 +38,8 @@ namespace CalculatorApp
|
|||
virtual Platform::Object
|
||||
^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter,
|
||||
Platform::String ^ language);
|
||||
^ ConvertBack(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ namespace CalculatorApp
|
|||
virtual Platform::Object
|
||||
^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter,
|
||||
Platform::String ^ language);
|
||||
^ ConvertBack(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
};
|
||||
|
||||
public
|
||||
|
@ -24,8 +24,8 @@ namespace CalculatorApp
|
|||
virtual Platform::Object
|
||||
^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter,
|
||||
Platform::String ^ language);
|
||||
^ ConvertBack(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace CalculatorApp
|
|||
virtual Platform::Object
|
||||
^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter,
|
||||
Platform::String ^ language);
|
||||
^ ConvertBack(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace CalculatorApp
|
|||
virtual Platform::Object
|
||||
^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter,
|
||||
Platform::String ^ language);
|
||||
^ ConvertBack(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,8 +109,8 @@ public
|
|||
bool m_IsDigit = false;
|
||||
Memory ^ m_memory;
|
||||
void HistoryFlyout_Opened(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args);
|
||||
void HistoryFlyout_Closing(_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender,
|
||||
_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args);
|
||||
void HistoryFlyout_Closing(
|
||||
_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender, _In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args);
|
||||
void HistoryFlyout_Closed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args);
|
||||
void OnHideHistoryClicked();
|
||||
void OnHideMemoryClicked();
|
||||
|
@ -121,8 +121,8 @@ public
|
|||
bool m_fIsHistoryFlyoutOpen;
|
||||
bool m_fIsMemoryFlyoutOpen;
|
||||
void OnMemoryFlyoutOpened(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args);
|
||||
void OnMemoryFlyoutClosing(_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender,
|
||||
_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args);
|
||||
void OnMemoryFlyoutClosing(
|
||||
_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender, _In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args);
|
||||
void OnMemoryFlyoutClosed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args);
|
||||
void SetChildAsMemory();
|
||||
void SetChildAsHistory();
|
||||
|
|
|
@ -34,8 +34,8 @@ namespace CalculatorApp
|
|||
|
||||
void AssignFlipButtons();
|
||||
|
||||
void SetVisibilityBinding(_In_ Windows::UI::Xaml::FrameworkElement ^ element, _In_ Platform::String ^ path,
|
||||
_In_ Windows::UI::Xaml::Data::IValueConverter ^ converter);
|
||||
void SetVisibilityBinding(
|
||||
_In_ Windows::UI::Xaml::FrameworkElement ^ element, _In_ Platform::String ^ path, _In_ Windows::UI::Xaml::Data::IValueConverter ^ converter);
|
||||
void OnBitToggled(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void UpdateCheckedStates();
|
||||
|
||||
|
|
|
@ -68,8 +68,8 @@ void CalculatorScientificOperators::shiftButton_Check(_In_ Platform::Object ^ /*
|
|||
SetOperatorRowVisibility();
|
||||
}
|
||||
|
||||
void CalculatorScientificOperators::shiftButton_IsEnabledChanged(_In_ Platform::Object ^ /*sender*/,
|
||||
_In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ /*e*/)
|
||||
void CalculatorScientificOperators::shiftButton_IsEnabledChanged(
|
||||
_In_ Platform::Object ^ /*sender*/, _In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ /*e*/)
|
||||
{
|
||||
SetOperatorRowVisibility();
|
||||
Common::KeyboardShortcutManager::ShiftButtonChecked(ShiftButton->IsEnabled && ShiftButton->IsChecked->Value);
|
||||
|
|
|
@ -79,8 +79,8 @@ DateCalculator::DateCalculator()
|
|||
DateDiff_ToDate->MaxDate = maxYear;
|
||||
|
||||
// Set the PlaceHolderText for CalendarDatePicker
|
||||
DateTimeFormatter ^ dateTimeFormatter =
|
||||
LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(L"day month year", localizationSettings.GetCalendarIdentifier(),
|
||||
DateTimeFormatter ^ dateTimeFormatter = LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(
|
||||
L"day month year", localizationSettings.GetCalendarIdentifier(),
|
||||
ClockIdentifiers::TwentyFourHour); // Clock Identifier is not used
|
||||
|
||||
DateDiff_FromDate->DateFormat = L"day month year";
|
||||
|
@ -130,8 +130,8 @@ void DateCalculator::AddSubtract_DateChanged(_In_ CalendarDatePicker ^ sender, _
|
|||
{
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||
dateCalcViewModel->StartDate = e->NewDate->Value;
|
||||
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()),
|
||||
dateCalcViewModel->IsAddMode);
|
||||
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(
|
||||
ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -142,8 +142,8 @@ void DateCalculator::AddSubtract_DateChanged(_In_ CalendarDatePicker ^ sender, _
|
|||
void CalculatorApp::DateCalculator::OffsetValue_Changed(_In_ Platform::Object ^ sender, _In_ SelectionChangedEventArgs ^ e)
|
||||
{
|
||||
auto dateCalcViewModel = safe_cast<DateCalculatorViewModel ^>(this->DataContext);
|
||||
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()),
|
||||
dateCalcViewModel->IsAddMode);
|
||||
TraceLogger::GetInstance().LogDateAddSubtractModeUsed(
|
||||
ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode);
|
||||
}
|
||||
|
||||
void DateCalculator::OnCopyMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||
|
|
|
@ -29,12 +29,12 @@ namespace CalculatorApp
|
|||
void SetDefaultFocus();
|
||||
|
||||
private:
|
||||
void FromDate_DateChanged(_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender,
|
||||
_In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e);
|
||||
void ToDate_DateChanged(_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender,
|
||||
_In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e);
|
||||
void AddSubtract_DateChanged(_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender,
|
||||
_In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e);
|
||||
void FromDate_DateChanged(
|
||||
_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender, _In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e);
|
||||
void ToDate_DateChanged(
|
||||
_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender, _In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e);
|
||||
void AddSubtract_DateChanged(
|
||||
_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender, _In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e);
|
||||
void OffsetValue_Changed(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Controls::SelectionChangedEventArgs ^ e);
|
||||
void OnCopyMenuItemClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnLoaded(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
|
|
|
@ -49,8 +49,8 @@ public
|
|||
void OnNavPaneOpened(_In_ Microsoft::UI::Xaml::Controls::NavigationView ^ sender, _In_ Platform::Object ^ args);
|
||||
void OnNavPaneClosed(_In_ Microsoft::UI::Xaml::Controls::NavigationView ^ sender, _In_ Platform::Object ^ args);
|
||||
void OnNavSelectionChanged(_In_ Platform::Object ^ sender, _In_ Microsoft::UI::Xaml::Controls::NavigationViewSelectionChangedEventArgs ^ e);
|
||||
void OnNavItemInvoked(Microsoft::UI::Xaml::Controls::NavigationView ^ /*sender*/,
|
||||
_In_ Microsoft::UI::Xaml::Controls::NavigationViewItemInvokedEventArgs ^ e);
|
||||
void OnNavItemInvoked(
|
||||
Microsoft::UI::Xaml::Controls::NavigationView ^ /*sender*/, _In_ Microsoft::UI::Xaml::Controls::NavigationViewItemInvokedEventArgs ^ e);
|
||||
|
||||
void OnAboutButtonClick(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Controls::ItemClickEventArgs ^ e);
|
||||
void OnAboutFlyoutOpened(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e);
|
||||
|
|
|
@ -26,10 +26,12 @@ public
|
|||
}
|
||||
|
||||
internal : virtual Platform::Object
|
||||
^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter,
|
||||
^ Convert(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter,
|
||||
Platform::String ^ language) = Windows::UI::Xaml::Data::IValueConverter::Convert;
|
||||
virtual Platform::Object
|
||||
^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter,
|
||||
^ ConvertBack(
|
||||
Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter,
|
||||
Platform::String ^ language) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack;
|
||||
|
||||
private:
|
||||
|
|
|
@ -163,7 +163,7 @@ namespace CalculatorApp
|
|||
|
||||
void TitleBar::OnWindowActivated(_In_ Object ^ /*sender*/, _In_ WindowActivatedEventArgs ^ e)
|
||||
{
|
||||
VisualStateManager::GoToState(this, e->WindowActivationState == CoreWindowActivationState::Deactivated ? WindowNotFocused->Name : WindowFocused->Name,
|
||||
false);
|
||||
VisualStateManager::GoToState(
|
||||
this, e->WindowActivationState == CoreWindowActivationState::Deactivated ? WindowNotFocused->Name : WindowFocused->Name, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ public
|
|||
WindowFrameService(_In_ Windows::UI::Xaml::Controls::Frame ^ viewFrame, Platform::WeakReference parent);
|
||||
void InitializeFrameService(bool createdByUs);
|
||||
|
||||
void OnConsolidated(_In_ Windows::UI::ViewManagement::ApplicationView ^ sender,
|
||||
_In_ Windows::UI::ViewManagement::ApplicationViewConsolidatedEventArgs ^ e);
|
||||
void
|
||||
OnConsolidated(_In_ Windows::UI::ViewManagement::ApplicationView ^ sender, _In_ Windows::UI::ViewManagement::ApplicationViewConsolidatedEventArgs ^ e);
|
||||
void OnClosed(_In_ Windows::UI::Core::CoreWindow ^ sender, _In_ Windows::UI::Core::CoreWindowEventArgs ^ args);
|
||||
|
||||
void LogOnViewClosed(_In_ Windows::UI::Core::CoreWindow ^ coreWindow);
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace CalculatorEngineTests
|
|||
m_resourceProvider = make_shared<EngineResourceProvider>();
|
||||
m_history = make_shared<CalculatorHistory>(MAX_HISTORY_SIZE);
|
||||
CCalcEngine::InitialOneTimeOnlySetup(*(m_resourceProvider.get()));
|
||||
m_calcEngine = make_unique<CCalcEngine>(false /* Respect Order of Operations */, false /* Set to Integer Mode */, m_resourceProvider.get(), nullptr,
|
||||
m_history);
|
||||
m_calcEngine = make_unique<CCalcEngine>(
|
||||
false /* Respect Order of Operations */, false /* Set to Integer Mode */, m_resourceProvider.get(), nullptr, m_history);
|
||||
}
|
||||
TEST_METHOD_CLEANUP(Cleanup)
|
||||
{
|
||||
|
@ -52,8 +52,8 @@ namespace CalculatorEngineTests
|
|||
VERIFY_ARE_EQUAL(L"1,234,567,890", m_calcEngine->GroupDigitsPerRadix(L"1234567890", 10), L"Verify grouping in base10.");
|
||||
VERIFY_ARE_EQUAL(L"1,234,567.89", m_calcEngine->GroupDigitsPerRadix(L"1234567.89", 10), L"Verify grouping in base10 with decimal.");
|
||||
VERIFY_ARE_EQUAL(L"1,234,567e89", m_calcEngine->GroupDigitsPerRadix(L"1234567e89", 10), L"Verify grouping in base10 with exponent.");
|
||||
VERIFY_ARE_EQUAL(L"1,234,567.89e5", m_calcEngine->GroupDigitsPerRadix(L"1234567.89e5", 10),
|
||||
L"Verify grouping in base10 with decimal and exponent.");
|
||||
VERIFY_ARE_EQUAL(
|
||||
L"1,234,567.89e5", m_calcEngine->GroupDigitsPerRadix(L"1234567.89e5", 10), L"Verify grouping in base10 with decimal and exponent.");
|
||||
VERIFY_ARE_EQUAL(L"-123,456,789", m_calcEngine->GroupDigitsPerRadix(L"-123456789", 10), L"Verify grouping in base10 with negative.");
|
||||
}
|
||||
|
||||
|
@ -204,15 +204,16 @@ namespace CalculatorEngineTests
|
|||
VERIFY_ARE_EQUAL(result, m_calcEngine->GroupDigits(L",", { 3, 0, 0 }, L"1234567890123456", false), L"Verify expanded form non-repeating grouping.");
|
||||
|
||||
result = L"12,34,56,78,901,23456";
|
||||
VERIFY_ARE_EQUAL(result, m_calcEngine->GroupDigits(L",", { 5, 3, 2, 0 }, L"1234567890123456", false),
|
||||
L"Verify multigroup with repeating grouping.");
|
||||
VERIFY_ARE_EQUAL(
|
||||
result, m_calcEngine->GroupDigits(L",", { 5, 3, 2, 0 }, L"1234567890123456", false), L"Verify multigroup with repeating grouping.");
|
||||
|
||||
result = L"1234,5678,9012,3456";
|
||||
VERIFY_ARE_EQUAL(result, m_calcEngine->GroupDigits(L",", { 4, 0 }, L"1234567890123456", false), L"Verify repeating non-standard grouping.");
|
||||
|
||||
result = L"123456,78,901,23456";
|
||||
VERIFY_ARE_EQUAL(result, m_calcEngine->GroupDigits(L",", { 5, 3, 2 }, L"1234567890123456", false), L"Verify multigroup non-repeating grouping.");
|
||||
VERIFY_ARE_EQUAL(result, m_calcEngine->GroupDigits(L",", { 5, 3, 2, 0, 0 }, L"1234567890123456", false),
|
||||
VERIFY_ARE_EQUAL(
|
||||
result, m_calcEngine->GroupDigits(L",", { 5, 3, 2, 0, 0 }, L"1234567890123456", false),
|
||||
L"Verify expanded form multigroup non-repeating grouping.");
|
||||
}
|
||||
|
||||
|
|
|
@ -173,8 +173,8 @@ namespace CalculatorEngineTests
|
|||
m_calcInput.Backspace();
|
||||
m_calcInput.TryToggleSign(true, L"127");
|
||||
VERIFY_IS_FALSE(m_calcInput.TryAddDigit(9, 10, true, L"127", 8, 2), L"Negative value: verify we cannot add a digit if digit exceeds max value.");
|
||||
VERIFY_IS_TRUE(m_calcInput.TryAddDigit(8, 10, true, L"127", 8, 2),
|
||||
L"Negative value: verify we can add a digit if digit does not exceed max value.");
|
||||
VERIFY_IS_TRUE(
|
||||
m_calcInput.TryAddDigit(8, 10, true, L"127", 8, 2), L"Negative value: verify we can add a digit if digit does not exceed max value.");
|
||||
}
|
||||
|
||||
TEST_METHOD(TryAddDecimalPtEmpty)
|
||||
|
|
|
@ -40,7 +40,8 @@ namespace CalculatorManagerTest
|
|||
{
|
||||
m_isError = isError;
|
||||
}
|
||||
void SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
void SetExpressionDisplay(
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const& tokens,
|
||||
_Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const& /*commands*/)
|
||||
{
|
||||
m_expression.clear();
|
||||
|
|
|
@ -66,14 +66,17 @@ namespace CalculatorUnitTests
|
|||
m_CopyPasteManager.ValidatePasteExpression(StringReference(exp_TooLong.c_str()), ViewMode::Standard, CategoryGroupType::Calculator, -1, -1),
|
||||
StringReference(L"NoOp"), L"Verify ValidatePasteExpression returns NoOp for strings over max length");
|
||||
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.ValidatePasteExpression(StringReference(L""), ViewMode::Standard, CategoryGroupType::Calculator, -1, -1),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.ValidatePasteExpression(StringReference(L""), ViewMode::Standard, CategoryGroupType::Calculator, -1, -1),
|
||||
StringReference(L"NoOp"), L"Verify empty string is invalid");
|
||||
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.ValidatePasteExpression(StringReference(L"123e456"), ViewMode::Standard, CategoryGroupType::Calculator, -1, -1),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.ValidatePasteExpression(StringReference(L"123e456"), ViewMode::Standard, CategoryGroupType::Calculator, -1, -1),
|
||||
StringReference(L"NoOp"), L"Verify pasting unsupported strings for the current mode is invalid");
|
||||
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.ValidatePasteExpression(StringReference(L"123"), ViewMode::None, CategoryGroupType::None, -1, -1),
|
||||
StringReference(L"NoOp"), L"Verify pasting without a ViewMode or Category is invalid");
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.ValidatePasteExpression(StringReference(L"123"), ViewMode::None, CategoryGroupType::None, -1, -1), StringReference(L"NoOp"),
|
||||
L"Verify pasting without a ViewMode or Category is invalid");
|
||||
};
|
||||
|
||||
TEST_METHOD(ValidateExtractOperands)
|
||||
|
@ -107,53 +110,63 @@ namespace CalculatorUnitTests
|
|||
{
|
||||
exp_OperandLimit += L"+1";
|
||||
}
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.ExtractOperands(exp_OperandLimit, ViewMode::Standard).size(), 100,
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.ExtractOperands(exp_OperandLimit, ViewMode::Standard).size(), 100,
|
||||
L"Verify ExtractOperands handles up to MaxOperandCount operands");
|
||||
|
||||
exp_OperandLimit += L"+1";
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.ExtractOperands(exp_OperandLimit, ViewMode::Standard).size(), 0,
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.ExtractOperands(exp_OperandLimit, ViewMode::Standard).size(), 0,
|
||||
L"Verify ExtractOperands returns empty vector on too many operands");
|
||||
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.ExtractOperands(L"12e9999", ViewMode::Standard).size(), 1,
|
||||
L"Verify ExtractOperands handles up to 4 digit exponents");
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.ExtractOperands(L"12e10000", ViewMode::Standard).size(), 0,
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.ExtractOperands(L"12e9999", ViewMode::Standard).size(), 1, L"Verify ExtractOperands handles up to 4 digit exponents");
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.ExtractOperands(L"12e10000", ViewMode::Standard).size(), 0,
|
||||
L"Verify ExtractOperands returns empty vector when the exponent is too long");
|
||||
};
|
||||
|
||||
TEST_METHOD(ValidateExpressionRegExMatch)
|
||||
{
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{}, ViewMode::Standard, CategoryGroupType::Calculator, -1, -1),
|
||||
VERIFY_IS_FALSE(
|
||||
m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{}, ViewMode::Standard, CategoryGroupType::Calculator, -1, -1),
|
||||
L"Verify empty list of operands returns false.");
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"123" }, ViewMode::None, CategoryGroupType::Calculator, -1, -1),
|
||||
VERIFY_IS_FALSE(
|
||||
m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"123" }, ViewMode::None, CategoryGroupType::Calculator, -1, -1),
|
||||
L"Verify invalid ViewMode/CategoryGroups return false.");
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"123" }, ViewMode::Currency, CategoryGroupType::None, -1, -1),
|
||||
VERIFY_IS_FALSE(
|
||||
m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"123" }, ViewMode::Currency, CategoryGroupType::None, -1, -1),
|
||||
L"Verify invalid ViewMode/CategoryGroups return false.");
|
||||
|
||||
Logger::WriteMessage(L"Verify operand lengths > max return false.");
|
||||
VERIFY_IS_FALSE(
|
||||
m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"12345678901234567" }, ViewMode::Standard, CategoryGroupType::Calculator, -1, -1));
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"123456789012345678901234567890123" }, ViewMode::Scientific,
|
||||
CategoryGroupType::Calculator, -1, -1));
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(
|
||||
vector<wstring>{ L"123456789012345678901234567890123" }, ViewMode::Scientific, CategoryGroupType::Calculator, -1, -1));
|
||||
VERIFY_IS_FALSE(
|
||||
m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"12345678901234567" }, ViewMode::None, CategoryGroupType::Converter, -1, -1));
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"11111111111111111" }, ViewMode::Programmer,
|
||||
CategoryGroupType::Calculator, HexBase, QwordType));
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"12345678901234567890" }, ViewMode::Programmer,
|
||||
CategoryGroupType::Calculator, DecBase, QwordType));
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"11111111111111111111111" }, ViewMode::Programmer,
|
||||
CategoryGroupType::Calculator, OctBase, QwordType));
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"10000000000000000000000000000000000000000000000000000000000000000" },
|
||||
ViewMode::Programmer, CategoryGroupType::Calculator, BinBase, QwordType));
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(
|
||||
vector<wstring>{ L"11111111111111111" }, ViewMode::Programmer, CategoryGroupType::Calculator, HexBase, QwordType));
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(
|
||||
vector<wstring>{ L"12345678901234567890" }, ViewMode::Programmer, CategoryGroupType::Calculator, DecBase, QwordType));
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(
|
||||
vector<wstring>{ L"11111111111111111111111" }, ViewMode::Programmer, CategoryGroupType::Calculator, OctBase, QwordType));
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(
|
||||
vector<wstring>{ L"10000000000000000000000000000000000000000000000000000000000000000" }, ViewMode::Programmer, CategoryGroupType::Calculator,
|
||||
BinBase, QwordType));
|
||||
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"9223372036854775808" }, ViewMode::Programmer,
|
||||
CategoryGroupType::Calculator, DecBase, QwordType),
|
||||
VERIFY_IS_FALSE(
|
||||
m_CopyPasteManager.ExpressionRegExMatch(
|
||||
vector<wstring>{ L"9223372036854775808" }, ViewMode::Programmer, CategoryGroupType::Calculator, DecBase, QwordType),
|
||||
L"Verify operand values > max return false.");
|
||||
|
||||
VERIFY_IS_TRUE(m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"((((((((((((((((((((123))))))))))))))))))))" }, ViewMode::Scientific,
|
||||
CategoryGroupType::Calculator, -1, -1),
|
||||
VERIFY_IS_TRUE(
|
||||
m_CopyPasteManager.ExpressionRegExMatch(
|
||||
vector<wstring>{ L"((((((((((((((((((((123))))))))))))))))))))" }, ViewMode::Scientific, CategoryGroupType::Calculator, -1, -1),
|
||||
L"Verify sanitized operand is detected as within max length.");
|
||||
VERIFY_IS_TRUE(m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"9223372036854775807" }, ViewMode::Programmer,
|
||||
CategoryGroupType::Calculator, DecBase, QwordType),
|
||||
VERIFY_IS_TRUE(
|
||||
m_CopyPasteManager.ExpressionRegExMatch(
|
||||
vector<wstring>{ L"9223372036854775807" }, ViewMode::Programmer, CategoryGroupType::Calculator, DecBase, QwordType),
|
||||
L"Verify operand values == max return true.");
|
||||
|
||||
Logger::WriteMessage(L"Verify all operands must match patterns.");
|
||||
|
@ -166,11 +179,13 @@ namespace CalculatorUnitTests
|
|||
m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"1.23e+456" }, ViewMode::Scientific, CategoryGroupType::Calculator, -1, -1),
|
||||
L"Verify operand only needs to match one pattern.");
|
||||
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"123", L"12345678901234567" }, ViewMode::Standard,
|
||||
CategoryGroupType::Calculator, -1, -1),
|
||||
VERIFY_IS_FALSE(
|
||||
m_CopyPasteManager.ExpressionRegExMatch(
|
||||
vector<wstring>{ L"123", L"12345678901234567" }, ViewMode::Standard, CategoryGroupType::Calculator, -1, -1),
|
||||
L"Verify all operands must be within maxlength");
|
||||
VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector<wstring>{ L"123", L"9223372036854775808" }, ViewMode::Programmer,
|
||||
CategoryGroupType::Calculator, DecBase, QwordType),
|
||||
VERIFY_IS_FALSE(
|
||||
m_CopyPasteManager.ExpressionRegExMatch(
|
||||
vector<wstring>{ L"123", L"9223372036854775808" }, ViewMode::Programmer, CategoryGroupType::Calculator, DecBase, QwordType),
|
||||
L"Verify all operand must be within max value.");
|
||||
};
|
||||
|
||||
|
@ -179,11 +194,14 @@ namespace CalculatorUnitTests
|
|||
pair<size_t, unsigned long long int> standardModeMaximums = make_pair(m_CopyPasteManager.MaxStandardOperandLength, 0);
|
||||
pair<size_t, unsigned long long int> scientificModeMaximums = make_pair(m_CopyPasteManager.MaxScientificOperandLength, 0);
|
||||
pair<size_t, unsigned long long int> converterModeMaximums = make_pair(m_CopyPasteManager.MaxConverterInputLength, 0);
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Standard, CategoryGroupType::None, -1, -1), standardModeMaximums,
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Standard, CategoryGroupType::None, -1, -1), standardModeMaximums,
|
||||
L"Verify Standard mode maximum values");
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Scientific, CategoryGroupType::None, -1, -1), scientificModeMaximums,
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Scientific, CategoryGroupType::None, -1, -1), scientificModeMaximums,
|
||||
L"Verify Scientific mode maximum values");
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::None, CategoryGroupType::Converter, -1, -1), converterModeMaximums,
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::None, CategoryGroupType::Converter, -1, -1), converterModeMaximums,
|
||||
L"Verify Converter mode maximum values");
|
||||
|
||||
unsigned long long int ullQwordMax = UINT64_MAX;
|
||||
|
@ -191,43 +209,59 @@ namespace CalculatorUnitTests
|
|||
unsigned long long int ullWordMax = UINT16_MAX;
|
||||
unsigned long long int ullByteMax = UINT8_MAX;
|
||||
Logger::WriteMessage(L"Verify Programmer Mode HexBase maximum values");
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, QwordType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, QwordType),
|
||||
make_pair((size_t)16u, ullQwordMax));
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, DwordType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, DwordType),
|
||||
make_pair((size_t)8u, ullDwordMax));
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, WordType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, WordType),
|
||||
make_pair((size_t)4u, ullWordMax));
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, ByteType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, ByteType),
|
||||
make_pair((size_t)2u, ullByteMax));
|
||||
|
||||
Logger::WriteMessage(L"Verify Programmer Mode DecBase maximum values");
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, QwordType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, QwordType),
|
||||
make_pair((size_t)19u, ullQwordMax >> 1));
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, DwordType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, DwordType),
|
||||
make_pair((size_t)10u, ullDwordMax >> 1));
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, WordType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, WordType),
|
||||
make_pair((size_t)5u, ullWordMax >> 1));
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, ByteType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, ByteType),
|
||||
make_pair((size_t)3u, ullByteMax >> 1));
|
||||
|
||||
Logger::WriteMessage(L"Verify Programmer Mode OctBase maximum values");
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, QwordType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, QwordType),
|
||||
make_pair((size_t)22u, ullQwordMax));
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, DwordType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, DwordType),
|
||||
make_pair((size_t)11u, ullDwordMax));
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, WordType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, WordType),
|
||||
make_pair((size_t)6u, ullWordMax));
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, ByteType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, ByteType),
|
||||
make_pair((size_t)3u, ullByteMax));
|
||||
|
||||
Logger::WriteMessage(L"Verify Programmer Mode BinBase maximum values");
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, QwordType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, QwordType),
|
||||
make_pair((size_t)64u, ullQwordMax));
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, DwordType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, DwordType),
|
||||
make_pair((size_t)32u, ullDwordMax));
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, WordType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, WordType),
|
||||
make_pair((size_t)16u, ullWordMax));
|
||||
VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, ByteType),
|
||||
VERIFY_ARE_EQUAL(
|
||||
m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, ByteType),
|
||||
make_pair((size_t)8u, ullByteMax));
|
||||
|
||||
Logger::WriteMessage(L"Verify invalid ViewModes/Categories return 0 for max values");
|
||||
|
|
|
@ -343,8 +343,8 @@ TEST_METHOD(TestSubtractOob)
|
|||
DateTime endDate;
|
||||
|
||||
// Subtract Duration
|
||||
bool isValid = m_DateCalcEngine.SubtractDuration(DateUtils::SystemTimeToDateTime(datetimeBoundSubtract[testIndex].startDate),
|
||||
datetimeBoundSubtract[testIndex].dateDiff, &endDate);
|
||||
bool isValid = m_DateCalcEngine.SubtractDuration(
|
||||
DateUtils::SystemTimeToDateTime(datetimeBoundSubtract[testIndex].startDate), datetimeBoundSubtract[testIndex].dateDiff, &endDate);
|
||||
|
||||
// Assert for the result
|
||||
VERIFY_IS_FALSE(isValid);
|
||||
|
|
|
@ -221,7 +221,8 @@ namespace CalculatorFunctionalTests
|
|||
m_historyViewModel->SaveHistory();
|
||||
m_historyViewModel->ReloadHistory(ViewMode::Scientific);
|
||||
auto itemAfterSerializeDeserialize = m_standardViewModel->m_standardCalculatorManager.GetHistoryItem(0);
|
||||
VERIFY_IS_TRUE((itemBeforeSerializeDeserialize->historyItemVector.expression == itemAfterSerializeDeserialize->historyItemVector.expression)
|
||||
VERIFY_IS_TRUE(
|
||||
(itemBeforeSerializeDeserialize->historyItemVector.expression == itemAfterSerializeDeserialize->historyItemVector.expression)
|
||||
&& (itemBeforeSerializeDeserialize->historyItemVector.result == itemAfterSerializeDeserialize->historyItemVector.result)
|
||||
&& (itemBeforeSerializeDeserialize->historyItemVector.spCommands == itemAfterSerializeDeserialize->historyItemVector.spCommands)
|
||||
&& (itemBeforeSerializeDeserialize->historyItemVector.spTokens == itemAfterSerializeDeserialize->historyItemVector.spTokens));
|
||||
|
|
|
@ -549,7 +549,8 @@ namespace CalculatorUnitTests
|
|||
VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->HexDisplayValue), StringReference(L"FFFF FFFF FFFF FFFE"));
|
||||
VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->DecimalDisplayValue), StringReference(L"-2"));
|
||||
VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->OctalDisplayValue), StringReference(L"1 777 777 777 777 777 777 776"));
|
||||
VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->BinaryDisplayValue),
|
||||
VERIFY_ARE_EQUAL(
|
||||
Utils::GetStringValue(m_viewModel->BinaryDisplayValue),
|
||||
StringReference(L"1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1110"));
|
||||
VERIFY_ARE_EQUAL(m_viewModel->DisplayValue, StringReference(L"-2"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue