mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 06:13:14 -07:00
Merge branch 'master' into dabelc/StaticPropertyNameProperties
This commit is contained in:
commit
68ab5b6fe6
100 changed files with 720 additions and 572 deletions
|
@ -413,7 +413,7 @@ int CHistoryCollector::AddCommand(_In_ const std::shared_ptr<IExpressionCommand>
|
||||||
return nCommands - 1;
|
return nCommands - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//To Update the operands in the Expression according to the current Radix
|
// To Update the operands in the Expression according to the current Radix
|
||||||
void CHistoryCollector::UpdateHistoryExpression(uint32_t radix, int32_t precision)
|
void CHistoryCollector::UpdateHistoryExpression(uint32_t radix, int32_t precision)
|
||||||
{
|
{
|
||||||
if (m_spTokens != nullptr)
|
if (m_spTokens != nullptr)
|
||||||
|
@ -451,7 +451,7 @@ void CHistoryCollector::SetDecimalSymbol(wchar_t decimalSymbol)
|
||||||
m_decimalSymbol = decimalSymbol;
|
m_decimalSymbol = decimalSymbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the commands corresponding to the passed string Number
|
// Update the commands corresponding to the passed string Number
|
||||||
std::shared_ptr<CalculatorVector<int>> CHistoryCollector::GetOperandCommandsFromString(wstring_view numStr)
|
std::shared_ptr<CalculatorVector<int>> CHistoryCollector::GetOperandCommandsFromString(wstring_view numStr)
|
||||||
{
|
{
|
||||||
std::shared_ptr<CalculatorVector<int>> commands = std::make_shared<CalculatorVector<int>>();
|
std::shared_ptr<CalculatorVector<int>> commands = std::make_shared<CalculatorVector<int>>();
|
||||||
|
|
|
@ -29,7 +29,7 @@ using namespace CalcEngine;
|
||||||
namespace {
|
namespace {
|
||||||
// NPrecedenceOfOp
|
// NPrecedenceOfOp
|
||||||
//
|
//
|
||||||
// returns a virtual number for precedence for the operator. We expect binary operator only, otherwise the lowest number
|
// returns a virtual number for precedence for the operator. We expect binary operator only, otherwise the lowest number
|
||||||
// 0 is returned. Higher the number, higher the precedence of the operator.
|
// 0 is returned. Higher the number, higher the precedence of the operator.
|
||||||
INT NPrecedenceOfOp(int nopCode)
|
INT NPrecedenceOfOp(int nopCode)
|
||||||
{
|
{
|
||||||
|
@ -39,11 +39,11 @@ namespace {
|
||||||
int iPrec;
|
int iPrec;
|
||||||
|
|
||||||
iPrec = 0;
|
iPrec = 0;
|
||||||
while ((iPrec < ARRAYSIZE(rgbPrec)) && (nopCode != rgbPrec[iPrec]))
|
while ((iPrec < size(rgbPrec)) && (nopCode != rgbPrec[iPrec]))
|
||||||
{
|
{
|
||||||
iPrec += 2;
|
iPrec += 2;
|
||||||
}
|
}
|
||||||
if (iPrec >= ARRAYSIZE(rgbPrec))
|
if (iPrec >= size(rgbPrec))
|
||||||
{
|
{
|
||||||
iPrec = 0;
|
iPrec = 0;
|
||||||
}
|
}
|
||||||
|
@ -54,13 +54,13 @@ namespace {
|
||||||
|
|
||||||
// HandleErrorCommand
|
// HandleErrorCommand
|
||||||
//
|
//
|
||||||
// When it is discovered by the state machine that at this point the input is not valid (eg. "1+)"), we want to proceed as though this input never
|
// When it is discovered by the state machine that at this point the input is not valid (eg. "1+)"), we want to proceed as though this input never
|
||||||
// occurred and may be some feedback to user like Beep. The rest of input can then continue by just ignoring this command.
|
// occurred and may be some feedback to user like Beep. The rest of input can then continue by just ignoring this command.
|
||||||
void CCalcEngine::HandleErrorCommand(WPARAM idc)
|
void CCalcEngine::HandleErrorCommand(WPARAM idc)
|
||||||
{
|
{
|
||||||
if (!IsGuiSettingOpCode(idc))
|
if (!IsGuiSettingOpCode(idc))
|
||||||
{
|
{
|
||||||
// we would have saved the prev command. Need to forget this state
|
// We would have saved the prev command. Need to forget this state
|
||||||
m_nTempCom = m_nLastCom;
|
m_nTempCom = m_nLastCom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
|
||||||
// BINARY OPERATORS:
|
// BINARY OPERATORS:
|
||||||
if (IsBinOpCode(wParam))
|
if (IsBinOpCode(wParam))
|
||||||
{
|
{
|
||||||
/* Change the operation if last input was operation. */
|
// Change the operation if last input was operation.
|
||||||
if (IsBinOpCode(m_nLastCom))
|
if (IsBinOpCode(m_nLastCom))
|
||||||
{
|
{
|
||||||
INT nPrev;
|
INT nPrev;
|
||||||
|
@ -546,6 +546,11 @@ void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
|
||||||
if ((m_openParenCount >= MAXPRECDEPTH && nx) || (!m_openParenCount && !nx)
|
if ((m_openParenCount >= MAXPRECDEPTH && nx) || (!m_openParenCount && !nx)
|
||||||
|| ((m_precedenceOpCount >= MAXPRECDEPTH && m_nPrecOp[m_precedenceOpCount - 1] != 0)))
|
|| ((m_precedenceOpCount >= MAXPRECDEPTH && m_nPrecOp[m_precedenceOpCount - 1] != 0)))
|
||||||
{
|
{
|
||||||
|
if (!m_openParenCount && !nx)
|
||||||
|
{
|
||||||
|
m_pCalcDisplay->OnNoRightParenAdded();
|
||||||
|
}
|
||||||
|
|
||||||
HandleErrorCommand(wParam);
|
HandleErrorCommand(wParam);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -942,7 +947,7 @@ wstring_view CCalcEngine::OpCodeToUnaryString(int nOpCode, bool fInv, ANGLE_TYPE
|
||||||
// Try to lookup the ID in the UFNE table
|
// Try to lookup the ID in the UFNE table
|
||||||
int ids = 0;
|
int ids = 0;
|
||||||
int iufne = nOpCode - IDC_UNARYFIRST;
|
int iufne = nOpCode - IDC_UNARYFIRST;
|
||||||
if (iufne >= 0 && iufne < ARRAYSIZE(rgUfne))
|
if (iufne >= 0 && iufne < size(rgUfne))
|
||||||
{
|
{
|
||||||
if (fInv)
|
if (fInv)
|
||||||
{
|
{
|
||||||
|
@ -1022,7 +1027,7 @@ wstring CCalcEngine::GetCurrentResultForRadix(uint32_t radix, int32_t precision)
|
||||||
wstring numberString = GetStringForDisplay(rat, radix);
|
wstring numberString = GetStringForDisplay(rat, radix);
|
||||||
if (!numberString.empty())
|
if (!numberString.empty())
|
||||||
{
|
{
|
||||||
//revert the precision to previously stored precision
|
// Revert the precision to previously stored precision
|
||||||
ChangeConstants(m_radix, m_precision);
|
ChangeConstants(m_radix, m_precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
||||||
|
|
||||||
uint64_t w64Bits = result.ToUInt64_t();
|
uint64_t w64Bits = result.ToUInt64_t();
|
||||||
uint64_t lsb = ((w64Bits & 0x01) == 1) ? 1 : 0;
|
uint64_t lsb = ((w64Bits & 0x01) == 1) ? 1 : 0;
|
||||||
w64Bits >>= 1; //RShift by 1
|
w64Bits >>= 1; // RShift by 1
|
||||||
w64Bits |= (lsb << (m_dwWordBitWidth - 1));
|
w64Bits |= (lsb << (m_dwWordBitWidth - 1));
|
||||||
|
|
||||||
result = w64Bits;
|
result = w64Bits;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
using namespace CalcEngine;
|
using namespace CalcEngine;
|
||||||
using namespace CalcEngine::RationalMath;
|
using namespace CalcEngine::RationalMath;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
// To be called when either the radix or num width changes. You can use -1 in either of these values to mean
|
// To be called when either the radix or num width changes. You can use -1 in either of these values to mean
|
||||||
// dont change that.
|
// dont change that.
|
||||||
|
@ -55,7 +56,7 @@ LONG CCalcEngine::DwWordBitWidthFromeNumWidth(NUM_WIDTH /*numwidth*/)
|
||||||
static constexpr int nBitMax[] = { 64, 32, 16, 8 };
|
static constexpr int nBitMax[] = { 64, 32, 16, 8 };
|
||||||
LONG wmax = nBitMax[0];
|
LONG wmax = nBitMax[0];
|
||||||
|
|
||||||
if (m_numwidth >= 0 && m_numwidth < ARRAYSIZE(nBitMax))
|
if (m_numwidth >= 0 && m_numwidth < size(nBitMax))
|
||||||
{
|
{
|
||||||
wmax = nBitMax[m_numwidth];
|
wmax = nBitMax[m_numwidth];
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,7 @@ uint32_t CCalcEngine::NRadixFromRadixType(RADIX_TYPE radixtype)
|
||||||
uint32_t radix = 10;
|
uint32_t radix = 10;
|
||||||
|
|
||||||
// convert special bases into symbolic values
|
// convert special bases into symbolic values
|
||||||
if (radixtype >= 0 && radixtype < ARRAYSIZE(rgnRadish))
|
if (radixtype >= 0 && radixtype < size(rgnRadish))
|
||||||
{
|
{
|
||||||
radix = rgnRadish[radixtype];
|
radix = rgnRadish[radixtype];
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,6 @@ namespace CalculationManager
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback from the engine
|
/// Callback from the engine
|
||||||
/// Used to set the current unmatched open parenthesis count
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="parenthesisCount">string containing the parenthesis count</param>
|
/// <param name="parenthesisCount">string containing the parenthesis count</param>
|
||||||
void CalculatorManager::SetParenDisplayText(const wstring& parenthesisCount)
|
void CalculatorManager::SetParenDisplayText(const wstring& parenthesisCount)
|
||||||
|
@ -117,6 +116,14 @@ namespace CalculationManager
|
||||||
m_displayCallback->SetParenDisplayText(parenthesisCount);
|
m_displayCallback->SetParenDisplayText(parenthesisCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Callback from the engine
|
||||||
|
/// </summary>
|
||||||
|
void CalculatorManager::OnNoRightParenAdded()
|
||||||
|
{
|
||||||
|
m_displayCallback->OnNoRightParenAdded();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reset CalculatorManager.
|
/// Reset CalculatorManager.
|
||||||
/// Set the mode to the standard calculator
|
/// Set the mode to the standard calculator
|
||||||
|
@ -428,9 +435,9 @@ namespace CalculationManager
|
||||||
if (*commandItr >= MEMORY_COMMAND_TO_UNSIGNED_CHAR(MemoryCommand::MemorizeNumber) &&
|
if (*commandItr >= MEMORY_COMMAND_TO_UNSIGNED_CHAR(MemoryCommand::MemorizeNumber) &&
|
||||||
*commandItr <= MEMORY_COMMAND_TO_UNSIGNED_CHAR(MemoryCommand::MemorizedNumberClearAll))
|
*commandItr <= MEMORY_COMMAND_TO_UNSIGNED_CHAR(MemoryCommand::MemorizedNumberClearAll))
|
||||||
{
|
{
|
||||||
//MemoryCommands(which have values above 255) are pushed on m_savedCommands upon casting to unsigned char.
|
// MemoryCommands(which have values above 255) are pushed on m_savedCommands upon casting to unsigned char.
|
||||||
//SerializeCommands uses m_savedCommands, which is then used in DeSerializeCommands.
|
// SerializeCommands uses m_savedCommands, which is then used in DeSerializeCommands.
|
||||||
//Hence, a simple cast to MemoryCommand is not sufficient.
|
// Hence, a simple cast to MemoryCommand is not sufficient.
|
||||||
MemoryCommand memoryCommand = static_cast<MemoryCommand>(*commandItr + UCHAR_MAX + 1);
|
MemoryCommand memoryCommand = static_cast<MemoryCommand>(*commandItr + UCHAR_MAX + 1);
|
||||||
unsigned int indexOfMemory = 0;
|
unsigned int indexOfMemory = 0;
|
||||||
switch (memoryCommand)
|
switch (memoryCommand)
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace CalculationManager
|
||||||
MemorizedNumberClear = 335
|
MemorizedNumberClear = 335
|
||||||
};
|
};
|
||||||
|
|
||||||
class CalculatorManager sealed : public virtual ICalcDisplay
|
class CalculatorManager sealed : public ICalcDisplay
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
ICalcDisplay* const m_displayCallback;
|
ICalcDisplay* const m_displayCallback;
|
||||||
|
@ -94,7 +94,8 @@ namespace CalculationManager
|
||||||
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 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 SetMemorizedNumbers(_In_ const std::vector<std::wstring>& memorizedNumbers) override;
|
||||||
void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) override;
|
void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) override;
|
||||||
void SetParenDisplayText(const std::wstring& parenthesisCount);
|
void SetParenDisplayText(const std::wstring& parenthesisCount) override;
|
||||||
|
void OnNoRightParenAdded() override;
|
||||||
void DisplayPasteError();
|
void DisplayPasteError();
|
||||||
void MaxDigitsReached() override;
|
void MaxDigitsReached() override;
|
||||||
void BinaryOperatorReceived() override;
|
void BinaryOperatorReceived() override;
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace CalculationManager
|
||||||
CommandFAC = 113,
|
CommandFAC = 113,
|
||||||
CommandREC = 114,
|
CommandREC = 114,
|
||||||
CommandDMS = 115,
|
CommandDMS = 115,
|
||||||
CommandCUBEROOT = 116, //x ^ 1/3
|
CommandCUBEROOT = 116, // x ^ 1/3
|
||||||
CommandPOW10 = 117, // 10 ^ x
|
CommandPOW10 = 117, // 10 ^ x
|
||||||
CommandPERCENT = 118,
|
CommandPERCENT = 118,
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
#define IDC_FAC 113
|
#define IDC_FAC 113
|
||||||
#define IDC_REC 114
|
#define IDC_REC 114
|
||||||
#define IDC_DMS 115
|
#define IDC_DMS 115
|
||||||
#define IDC_CUBEROOT 116 //x ^ 1/3
|
#define IDC_CUBEROOT 116 // x ^ 1/3
|
||||||
#define IDC_POW10 117 // 10 ^ x
|
#define IDC_POW10 117 // 10 ^ x
|
||||||
#define IDC_PERCENT 118
|
#define IDC_PERCENT 118
|
||||||
#define IDC_UNARYLAST IDC_PERCENT
|
#define IDC_UNARYLAST IDC_PERCENT
|
||||||
|
|
|
@ -85,7 +85,7 @@ private:
|
||||||
// if it hasn't yet been computed
|
// if it hasn't yet been computed
|
||||||
bool m_bChangeOp; /* Flag for changing operation. */
|
bool m_bChangeOp; /* Flag for changing operation. */
|
||||||
bool m_bRecord; // Global mode: recording or displaying
|
bool m_bRecord; // Global mode: recording or displaying
|
||||||
bool m_bSetCalcState; //Flag for setting the engine result state
|
bool m_bSetCalcState; // Flag for setting the engine result state
|
||||||
CalcEngine::CalcInput m_input; // Global calc input object for decimal strings
|
CalcEngine::CalcInput m_input; // Global calc input object for decimal strings
|
||||||
eNUMOBJ_FMT m_nFE; /* Scientific notation conversion flag. */
|
eNUMOBJ_FMT m_nFE; /* Scientific notation conversion flag. */
|
||||||
CalcEngine::Rational m_maxTrigonometricNum;
|
CalcEngine::Rational m_maxTrigonometricNum;
|
||||||
|
|
|
@ -13,6 +13,7 @@ public:
|
||||||
virtual void SetIsInError(bool isInError) = 0;
|
virtual void SetIsInError(bool isInError) = 0;
|
||||||
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 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 SetParenDisplayText(const std::wstring& pszText) = 0;
|
virtual void SetParenDisplayText(const std::wstring& pszText) = 0;
|
||||||
|
virtual void OnNoRightParenAdded() = 0;
|
||||||
virtual void MaxDigitsReached() = 0; // not an error but still need to inform UI layer.
|
virtual void MaxDigitsReached() = 0; // not an error but still need to inform UI layer.
|
||||||
virtual void BinaryOperatorReceived() = 0;
|
virtual void BinaryOperatorReceived() = 0;
|
||||||
virtual void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) = 0;
|
virtual void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) = 0;
|
||||||
|
|
|
@ -211,9 +211,8 @@ void modrat( PRAT *pa, PRAT b )
|
||||||
remnum( &((*pa)->pp), tmp->pp, BASEX );
|
remnum( &((*pa)->pp), tmp->pp, BASEX );
|
||||||
mulnumx( &((*pa)->pq), tmp->pq );
|
mulnumx( &((*pa)->pq), tmp->pq );
|
||||||
|
|
||||||
//Get *pa back in the integer over integer form.
|
// Get *pa back in the integer over integer form.
|
||||||
RENORMALIZE(*pa);
|
RENORMALIZE(*pa);
|
||||||
|
|
||||||
destroyrat( tmp );
|
destroyrat( tmp );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ void fracrat( PRAT *pa , uint32_t radix, int32_t precision)
|
||||||
|
|
||||||
remnum( &((*pa)->pp), (*pa)->pq, BASEX );
|
remnum( &((*pa)->pp), (*pa)->pq, BASEX );
|
||||||
|
|
||||||
//Get *pa back in the integer over integer form.
|
// Get *pa back in the integer over integer form.
|
||||||
RENORMALIZE(*pa);
|
RENORMALIZE(*pa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ UnitConverter::UnitConverter(_In_ const shared_ptr<IConverterDataLoader>& dataLo
|
||||||
{
|
{
|
||||||
m_dataLoader = dataLoader;
|
m_dataLoader = dataLoader;
|
||||||
m_currencyDataLoader = currencyDataLoader;
|
m_currencyDataLoader = currencyDataLoader;
|
||||||
//declaring the delimiter character conversion map
|
// declaring the delimiter character conversion map
|
||||||
quoteConversions[L'|'] = L"{p}";
|
quoteConversions[L'|'] = L"{p}";
|
||||||
quoteConversions[L'['] = L"{lc}";
|
quoteConversions[L'['] = L"{lc}";
|
||||||
quoteConversions[L']'] = L"{rc}";
|
quoteConversions[L']'] = L"{rc}";
|
||||||
|
@ -441,7 +441,7 @@ wstring UnitConverter::Quote(const wstring& s)
|
||||||
{
|
{
|
||||||
wstringstream quotedString(wstringstream::out);
|
wstringstream quotedString(wstringstream::out);
|
||||||
|
|
||||||
//Iterate over the delimiter characters we need to quote
|
// Iterate over the delimiter characters we need to quote
|
||||||
wstring::const_iterator cursor = s.begin();
|
wstring::const_iterator cursor = s.begin();
|
||||||
while(cursor != s.end())
|
while(cursor != s.end())
|
||||||
{
|
{
|
||||||
|
@ -479,7 +479,7 @@ wstring UnitConverter::Unquote(const wstring& s)
|
||||||
}
|
}
|
||||||
if (cursor == s.end())
|
if (cursor == s.end())
|
||||||
{
|
{
|
||||||
//badly formatted
|
// Badly formatted
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -505,7 +505,7 @@ void UnitConverter::SendCommand(Command command)
|
||||||
{
|
{
|
||||||
if (CheckLoad())
|
if (CheckLoad())
|
||||||
{
|
{
|
||||||
//TODO: Localization of characters
|
// TODO: Localization of characters
|
||||||
bool clearFront = false;
|
bool clearFront = false;
|
||||||
if (m_currentDisplay == L"0")
|
if (m_currentDisplay == L"0")
|
||||||
{
|
{
|
||||||
|
@ -728,7 +728,7 @@ vector<tuple<wstring, Unit>> UnitConverter::CalculateSuggested()
|
||||||
vector<SuggestedValueIntermediate> intermediateVector;
|
vector<SuggestedValueIntermediate> intermediateVector;
|
||||||
vector<SuggestedValueIntermediate> intermediateWhimsicalVector;
|
vector<SuggestedValueIntermediate> intermediateWhimsicalVector;
|
||||||
unordered_map<Unit, ConversionData, UnitHash> ratios = m_ratioMap[m_fromType];
|
unordered_map<Unit, ConversionData, UnitHash> ratios = m_ratioMap[m_fromType];
|
||||||
//Calculate converted values for every other unit type in this category, along with their magnitude
|
// Calculate converted values for every other unit type in this category, along with their magnitude
|
||||||
for (const auto& cur : ratios)
|
for (const auto& cur : ratios)
|
||||||
{
|
{
|
||||||
if (cur.first != m_fromType && cur.first != m_toType)
|
if (cur.first != m_fromType && cur.first != m_toType)
|
||||||
|
@ -745,7 +745,7 @@ vector<tuple<wstring, Unit>> UnitConverter::CalculateSuggested()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sort the resulting list by absolute magnitude, breaking ties by choosing the positive value
|
// Sort the resulting list by absolute magnitude, breaking ties by choosing the positive value
|
||||||
sort(intermediateVector.begin(), intermediateVector.end(), []
|
sort(intermediateVector.begin(), intermediateVector.end(), []
|
||||||
(SuggestedValueIntermediate first, SuggestedValueIntermediate second)
|
(SuggestedValueIntermediate first, SuggestedValueIntermediate second)
|
||||||
{
|
{
|
||||||
|
@ -759,7 +759,7 @@ vector<tuple<wstring, Unit>> UnitConverter::CalculateSuggested()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Now that the list is sorted, iterate over it and populate the return vector with properly rounded and formatted return strings
|
// Now that the list is sorted, iterate over it and populate the return vector with properly rounded and formatted return strings
|
||||||
for (const auto& entry : intermediateVector)
|
for (const auto& entry : intermediateVector)
|
||||||
{
|
{
|
||||||
wstring roundedString;
|
wstring roundedString;
|
||||||
|
@ -783,7 +783,7 @@ vector<tuple<wstring, Unit>> UnitConverter::CalculateSuggested()
|
||||||
}
|
}
|
||||||
|
|
||||||
// The Whimsicals are determined differently
|
// The Whimsicals are determined differently
|
||||||
//Sort the resulting list by absolute magnitude, breaking ties by choosing the positive value
|
// Sort the resulting list by absolute magnitude, breaking ties by choosing the positive value
|
||||||
sort(intermediateWhimsicalVector.begin(), intermediateWhimsicalVector.end(), []
|
sort(intermediateWhimsicalVector.begin(), intermediateWhimsicalVector.end(), []
|
||||||
(SuggestedValueIntermediate first, SuggestedValueIntermediate second)
|
(SuggestedValueIntermediate first, SuggestedValueIntermediate second)
|
||||||
{
|
{
|
||||||
|
@ -797,7 +797,7 @@ vector<tuple<wstring, Unit>> UnitConverter::CalculateSuggested()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Now that the list is sorted, iterate over it and populate the return vector with properly rounded and formatted return strings
|
// Now that the list is sorted, iterate over it and populate the return vector with properly rounded and formatted return strings
|
||||||
vector<tuple<wstring, Unit>> whimsicalReturnVector;
|
vector<tuple<wstring, Unit>> whimsicalReturnVector;
|
||||||
|
|
||||||
for (const auto& entry : intermediateWhimsicalVector)
|
for (const auto& entry : intermediateWhimsicalVector)
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <winerror.h>
|
#include <winerror.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <iterator>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
@ -20,6 +20,8 @@ namespace CalculatorApp::Common::Automation
|
||||||
StringReference CategoryNameChanged(L"CategoryNameChanged");
|
StringReference CategoryNameChanged(L"CategoryNameChanged");
|
||||||
StringReference UpdateCurrencyRates(L"UpdateCurrencyRates");
|
StringReference UpdateCurrencyRates(L"UpdateCurrencyRates");
|
||||||
StringReference DisplayCopied(L"DisplayCopied");
|
StringReference DisplayCopied(L"DisplayCopied");
|
||||||
|
StringReference OpenParenthesisCountChanged(L"OpenParenthesisCountChanged");
|
||||||
|
StringReference NoParenthesisAdded(L"NoParenthesisAdded");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,3 +144,21 @@ NarratorAnnouncement^ CalculatorAnnouncement::GetDisplayCopiedAnnouncement(Strin
|
||||||
AutomationNotificationKind::ActionCompleted,
|
AutomationNotificationKind::ActionCompleted,
|
||||||
AutomationNotificationProcessing::ImportantMostRecent);
|
AutomationNotificationProcessing::ImportantMostRecent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NarratorAnnouncement^ CalculatorAnnouncement::GetOpenParenthesisCountChangedAnnouncement(String^ announcement)
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
AutomationNotificationProcessing::ImportantMostRecent);
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -90,5 +90,8 @@ namespace CalculatorApp::Common::Automation
|
||||||
static NarratorAnnouncement^ GetUpdateCurrencyRatesAnnouncement(Platform::String^ announcement);
|
static NarratorAnnouncement^ GetUpdateCurrencyRatesAnnouncement(Platform::String^ announcement);
|
||||||
|
|
||||||
static NarratorAnnouncement^ GetDisplayCopiedAnnouncement(Platform::String^ announcement);
|
static NarratorAnnouncement^ GetDisplayCopiedAnnouncement(Platform::String^ announcement);
|
||||||
|
|
||||||
|
static NarratorAnnouncement^ GetOpenParenthesisCountChangedAnnouncement(Platform::String^ announcement);
|
||||||
|
static NarratorAnnouncement^ GetNoRightParenthesisAddedAnnouncement(Platform::String ^ announcement);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,7 @@ void CalculatorDisplay::SetPrimaryDisplay(_In_ const wstring& displayStringValue
|
||||||
{
|
{
|
||||||
if (m_callbackReference)
|
if (m_callbackReference)
|
||||||
{
|
{
|
||||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
if (calcVM)
|
|
||||||
{
|
{
|
||||||
calcVM->SetPrimaryDisplay(displayStringValue, isError);
|
calcVM->SetPrimaryDisplay(displayStringValue, isError);
|
||||||
}
|
}
|
||||||
|
@ -41,20 +40,29 @@ void CalculatorDisplay::SetParenDisplayText(_In_ const std::wstring& parenthesis
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
if (calcVM)
|
|
||||||
{
|
{
|
||||||
calcVM->SetParenthesisCount(parenthesisCount);
|
calcVM->SetParenthesisCount(parenthesisCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CalculatorDisplay::OnNoRightParenAdded()
|
||||||
|
{
|
||||||
|
if (m_callbackReference != nullptr)
|
||||||
|
{
|
||||||
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
|
{
|
||||||
|
calcVM->OnNoRightParenAdded();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CalculatorDisplay::SetIsInError(bool isError)
|
void CalculatorDisplay::SetIsInError(bool isError)
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
if (calcVM)
|
|
||||||
{
|
{
|
||||||
calcVM->IsInError = isError;
|
calcVM->IsInError = isError;
|
||||||
}
|
}
|
||||||
|
@ -65,8 +73,7 @@ void CalculatorDisplay::SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorV
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
if(auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
if (calcVM)
|
|
||||||
{
|
{
|
||||||
calcVM->SetExpressionDisplay(tokens, commands);
|
calcVM->SetExpressionDisplay(tokens, commands);
|
||||||
}
|
}
|
||||||
|
@ -77,8 +84,7 @@ void CalculatorDisplay::SetMemorizedNumbers(_In_ const vector<std::wstring>& new
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
if (calcVM)
|
|
||||||
{
|
{
|
||||||
calcVM->SetMemorizedNumbers(newMemorizedNumbers);
|
calcVM->SetMemorizedNumbers(newMemorizedNumbers);
|
||||||
}
|
}
|
||||||
|
@ -89,8 +95,7 @@ void CalculatorDisplay::OnHistoryItemAdded(_In_ unsigned int addedItemIndex)
|
||||||
{
|
{
|
||||||
if (m_historyCallbackReference != nullptr)
|
if (m_historyCallbackReference != nullptr)
|
||||||
{
|
{
|
||||||
auto historyVM = m_historyCallbackReference.Resolve<ViewModel::HistoryViewModel>();
|
if (auto historyVM = m_historyCallbackReference.Resolve<ViewModel::HistoryViewModel>())
|
||||||
if (historyVM)
|
|
||||||
{
|
{
|
||||||
historyVM->OnHistoryItemAdded(addedItemIndex);
|
historyVM->OnHistoryItemAdded(addedItemIndex);
|
||||||
}
|
}
|
||||||
|
@ -101,8 +106,7 @@ void CalculatorDisplay::MaxDigitsReached()
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
if (calcVM)
|
|
||||||
{
|
{
|
||||||
calcVM->OnMaxDigitsReached();
|
calcVM->OnMaxDigitsReached();
|
||||||
}
|
}
|
||||||
|
@ -113,8 +117,7 @@ void CalculatorDisplay::BinaryOperatorReceived()
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
if (calcVM)
|
|
||||||
{
|
{
|
||||||
calcVM->OnBinaryOperatorReceived();
|
calcVM->OnBinaryOperatorReceived();
|
||||||
}
|
}
|
||||||
|
@ -125,8 +128,7 @@ void CalculatorDisplay::MemoryItemChanged(unsigned int indexOfMemory)
|
||||||
{
|
{
|
||||||
if (m_callbackReference != nullptr)
|
if (m_callbackReference != nullptr)
|
||||||
{
|
{
|
||||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||||
if (calcVM)
|
|
||||||
{
|
{
|
||||||
calcVM->OnMemoryItemChanged(indexOfMemory);
|
calcVM->OnMemoryItemChanged(indexOfMemory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace CalculatorApp
|
||||||
void SetMemorizedNumbers(_In_ const std::vector<std::wstring>& memorizedNumbers) override;
|
void SetMemorizedNumbers(_In_ const std::vector<std::wstring>& memorizedNumbers) override;
|
||||||
void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) override;
|
void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) override;
|
||||||
void SetParenDisplayText(_In_ const std::wstring& parenthesisCount) override;
|
void SetParenDisplayText(_In_ const std::wstring& parenthesisCount) override;
|
||||||
|
void OnNoRightParenAdded() override;
|
||||||
void MaxDigitsReached() override;
|
void MaxDigitsReached() override;
|
||||||
void BinaryOperatorReceived() override;
|
void BinaryOperatorReceived() override;
|
||||||
void MemoryItemChanged(unsigned int indexOfMemory) override;
|
void MemoryItemChanged(unsigned int indexOfMemory) override;
|
||||||
|
|
|
@ -404,7 +404,7 @@ wstring CopyPasteManager::SanitizeOperand(const wstring& operand)
|
||||||
{
|
{
|
||||||
wchar_t unWantedChars[] = { L'\'', L'_', L'`', L'(', L')', L'-' };
|
wchar_t unWantedChars[] = { L'\'', L'_', L'`', L'(', L')', L'-' };
|
||||||
|
|
||||||
return Utils::RemoveUnwantedCharsFromWstring(operand, unWantedChars, ARRAYSIZE(unWantedChars));
|
return Utils::RemoveUnwantedCharsFromWstring(operand, unWantedChars, static_cast<int>(size(unWantedChars)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CopyPasteManager::TryOperandToULL(const wstring& operand, int numberBase, unsigned long long int& result)
|
bool CopyPasteManager::TryOperandToULL(const wstring& operand, int numberBase, unsigned long long int& result)
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "LocalizationService.h"
|
#include "LocalizationService.h"
|
||||||
|
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
{
|
{
|
||||||
namespace Common
|
namespace Common
|
||||||
|
@ -41,7 +43,7 @@ namespace CalculatorApp
|
||||||
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
||||||
LOCALE_SDECIMAL,
|
LOCALE_SDECIMAL,
|
||||||
decimalString,
|
decimalString,
|
||||||
ARRAYSIZE(decimalString));
|
static_cast<int>(std::size(decimalString)));
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Unexpected error while getting locale info");
|
throw std::runtime_error("Unexpected error while getting locale info");
|
||||||
|
@ -51,7 +53,7 @@ namespace CalculatorApp
|
||||||
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
||||||
LOCALE_STHOUSAND,
|
LOCALE_STHOUSAND,
|
||||||
groupingSymbolString,
|
groupingSymbolString,
|
||||||
ARRAYSIZE(groupingSymbolString));
|
static_cast<int>(std::size(groupingSymbolString)));
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Unexpected error while getting locale info");
|
throw std::runtime_error("Unexpected error while getting locale info");
|
||||||
|
@ -61,7 +63,7 @@ namespace CalculatorApp
|
||||||
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
||||||
LOCALE_SGROUPING,
|
LOCALE_SGROUPING,
|
||||||
numberGroupingString,
|
numberGroupingString,
|
||||||
ARRAYSIZE(numberGroupingString));
|
static_cast<int>(std::size(numberGroupingString)));
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Unexpected error while getting locale info");
|
throw std::runtime_error("Unexpected error while getting locale info");
|
||||||
|
@ -72,7 +74,7 @@ namespace CalculatorApp
|
||||||
result = ::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT,
|
result = ::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT,
|
||||||
LOCALE_SLIST,
|
LOCALE_SLIST,
|
||||||
listSeparatorString,
|
listSeparatorString,
|
||||||
ARRAYSIZE(listSeparatorString)); // Max length of the expected return value is 4
|
static_cast<int>(std::size(listSeparatorString))); // Max length of the expected return value is 4
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Unexpected error while getting locale info");
|
throw std::runtime_error("Unexpected error while getting locale info");
|
||||||
|
@ -122,7 +124,7 @@ namespace CalculatorApp
|
||||||
::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT,
|
::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT,
|
||||||
LOCALE_IFIRSTDAYOFWEEK, // The first day in a week
|
LOCALE_IFIRSTDAYOFWEEK, // The first day in a week
|
||||||
reinterpret_cast<PWSTR>(day), // Argument is of type PWSTR
|
reinterpret_cast<PWSTR>(day), // Argument is of type PWSTR
|
||||||
ARRAYSIZE(day)); // Max return size are 80 characters
|
static_cast<int>(std::size(day))); // Max return size are 80 characters
|
||||||
|
|
||||||
// The LOCALE_IFIRSTDAYOFWEEK integer value varies from 0, 1, .. 6 for Monday, Tuesday, ... Sunday
|
// The LOCALE_IFIRSTDAYOFWEEK integer value varies from 0, 1, .. 6 for Monday, Tuesday, ... Sunday
|
||||||
// DayOfWeek enum value varies from 0, 1, .. 6 for Sunday, Monday, ... Saturday
|
// DayOfWeek enum value varies from 0, 1, .. 6 for Sunday, Monday, ... Saturday
|
||||||
|
|
|
@ -103,7 +103,7 @@ namespace CalculatorApp
|
||||||
g_calculatorProvider(
|
g_calculatorProvider(
|
||||||
L"MicrosoftCalculator",
|
L"MicrosoftCalculator",
|
||||||
LoggingChannelOptions(GUID{ 0x4f50731a, 0x89cf, 0x4782, 0xb3, 0xe0, 0xdc, 0xe8, 0xc9, 0x4, 0x76, 0xba }), // Microsoft Telemetry group
|
LoggingChannelOptions(GUID{ 0x4f50731a, 0x89cf, 0x4782, 0xb3, 0xe0, 0xdc, 0xe8, 0xc9, 0x4, 0x76, 0xba }), // Microsoft Telemetry group
|
||||||
GUID{ 0x905ca09, 0x610e, 0x401e, 0xb6, 0x50, 0x2f, 0x21, 0x29, 0x80, 0xb9, 0xe0 }), //Unique providerID {0905CA09-610E-401E-B650-2F212980B9E0}
|
GUID{ 0x905ca09, 0x610e, 0x401e, 0xb6, 0x50, 0x2f, 0x21, 0x29, 0x80, 0xb9, 0xe0 }), // Unique providerID {0905CA09-610E-401E-B650-2F212980B9E0}
|
||||||
m_appLaunchActivity{ nullptr }
|
m_appLaunchActivity{ nullptr }
|
||||||
{
|
{
|
||||||
// initialize the function array
|
// initialize the function array
|
||||||
|
@ -482,9 +482,9 @@ namespace CalculatorApp
|
||||||
LogTelemetryEvent(EVENT_NAME_MEMORY_BODY_OPENED, fields);
|
LogTelemetryEvent(EVENT_NAME_MEMORY_BODY_OPENED, fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
//If calculator is launched in any mode other than standard then this call will come which is not intended. But there is no way to avoid it.
|
// If calculator is launched in any mode other than standard then this call will come which is not intended. But there is no way to avoid it.
|
||||||
//So don't use this function to analyze the count of mode change in session instead use CalculatorViewedInSession and ConverterViewedInSession to do that.
|
// So don't use this function to analyze the count of mode change in session instead use CalculatorViewedInSession and ConverterViewedInSession to do that.
|
||||||
//Use of this function is to analyze perf of mode change.
|
// Use of this function is to analyze perf of mode change.
|
||||||
void TraceLogger::LogModeChangeBegin(ViewMode fromMode, ViewMode toMode, int windowId)
|
void TraceLogger::LogModeChangeBegin(ViewMode fromMode, ViewMode toMode, int windowId)
|
||||||
{
|
{
|
||||||
if (!GetTraceLoggingProviderEnabled()) return;
|
if (!GetTraceLoggingProviderEnabled()) return;
|
||||||
|
@ -499,7 +499,7 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//comment: same as LogModeChangeBegin
|
// comment: same as LogModeChangeBegin
|
||||||
void TraceLogger::LogModeChangeEnd(ViewMode toMode, int windowId) const
|
void TraceLogger::LogModeChangeEnd(ViewMode toMode, int windowId) const
|
||||||
{
|
{
|
||||||
if (!GetTraceLoggingProviderEnabled()) return;
|
if (!GetTraceLoggingProviderEnabled()) return;
|
||||||
|
|
|
@ -54,7 +54,7 @@ double Utils::GetDoubleFromWstring(wstring input)
|
||||||
return ::atof(inputString.c_str());
|
return ::atof(inputString.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
//returns windowId for the current view
|
// Returns windowId for the current view
|
||||||
int Utils::GetWindowId()
|
int Utils::GetWindowId()
|
||||||
{
|
{
|
||||||
int windowId = -1;
|
int windowId = -1;
|
||||||
|
@ -80,20 +80,20 @@ void Utils::RunOnUIThreadNonblocking(std::function<void()>&& function, _In_ Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns if the last character of a wstring is the target wchar_t
|
// Returns if the last character of a wstring is the target wchar_t
|
||||||
bool Utils::IsLastCharacterTarget(_In_ wstring const &input, _In_ wchar_t target)
|
bool Utils::IsLastCharacterTarget(_In_ wstring const &input, _In_ wchar_t target)
|
||||||
{
|
{
|
||||||
return !input.empty() && input.back() == target;
|
return !input.empty() && input.back() == target;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return wstring after removing characters like space, comma, and double quotes
|
// Returns wstring after removing characters like space, comma, and double quotes
|
||||||
wstring Utils::RemoveUnwantedCharsFromWstring(wstring input)
|
wstring Utils::RemoveUnwantedCharsFromWstring(wstring input)
|
||||||
{
|
{
|
||||||
wchar_t unWantedChars[] = { L' ', L',', L'"', 8234, 8235, 8236, 8237 };
|
wchar_t unWantedChars[] = { L' ', L',', L'"', 8234, 8235, 8236, 8237 };
|
||||||
return RemoveUnwantedCharsFromWstring(input, unWantedChars, 6);
|
return RemoveUnwantedCharsFromWstring(input, unWantedChars, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
//return wstring after removing characters specified by unwantedChars array
|
// Returns wstring after removing characters specified by unwantedChars array
|
||||||
wstring Utils::RemoveUnwantedCharsFromWstring(wstring input, wchar_t* unwantedChars, unsigned int size)
|
wstring Utils::RemoveUnwantedCharsFromWstring(wstring input, wchar_t* unwantedChars, unsigned int size)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < size; ++i)
|
for (unsigned int i = 0; i < size; ++i)
|
||||||
|
@ -110,7 +110,7 @@ void Utils::SerializeCommandsAndTokens(_In_ shared_ptr<CalculatorVector <pair<ws
|
||||||
unsigned int commandsSize;
|
unsigned int commandsSize;
|
||||||
IFTPlatformException(commands->GetSize(&commandsSize));
|
IFTPlatformException(commands->GetSize(&commandsSize));
|
||||||
|
|
||||||
// save the size of the commands vector
|
// Save the size of the commands vector
|
||||||
writer->WriteUInt32(commandsSize);
|
writer->WriteUInt32(commandsSize);
|
||||||
|
|
||||||
SerializeCommandVisitor cmdVisitor(writer);
|
SerializeCommandVisitor cmdVisitor(writer);
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace
|
||||||
StringReference CalculationResultAutomationNamePropertyName(L"CalculationResultAutomationName");
|
StringReference CalculationResultAutomationNamePropertyName(L"CalculationResultAutomationName");
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CalculatorApp::ViewModel::CalculatorResourceKeys
|
namespace CalculatorResourceKeys
|
||||||
{
|
{
|
||||||
StringReference CalculatorExpression(L"Format_CalculatorExpression");
|
StringReference CalculatorExpression(L"Format_CalculatorExpression");
|
||||||
StringReference CalculatorResults(L"Format_CalculatorResults");
|
StringReference CalculatorResults(L"Format_CalculatorResults");
|
||||||
|
@ -49,6 +49,8 @@ namespace CalculatorApp::ViewModel::CalculatorResourceKeys
|
||||||
StringReference OctButton(L"Format_OctButtonValue");
|
StringReference OctButton(L"Format_OctButtonValue");
|
||||||
StringReference BinButton(L"Format_BinButtonValue");
|
StringReference BinButton(L"Format_BinButtonValue");
|
||||||
StringReference LeftParenthesisAutomationFormat(L"Format_OpenParenthesisAutomationNamePrefix");
|
StringReference LeftParenthesisAutomationFormat(L"Format_OpenParenthesisAutomationNamePrefix");
|
||||||
|
StringReference OpenParenthesisCountAutomationFormat(L"Format_OpenParenthesisCountAutomationNamePrefix");
|
||||||
|
StringReference NoParenthesisAdded(L"NoRightParenthesisAdded_Announcement");
|
||||||
StringReference MaxDigitsReachedFormat(L"Format_MaxDigitsReached");
|
StringReference MaxDigitsReachedFormat(L"Format_MaxDigitsReached");
|
||||||
StringReference ButtonPressFeedbackFormat(L"Format_ButtonPressAuditoryFeedback");
|
StringReference ButtonPressFeedbackFormat(L"Format_ButtonPressAuditoryFeedback");
|
||||||
StringReference MemorySave(L"Format_MemorySave");
|
StringReference MemorySave(L"Format_MemorySave");
|
||||||
|
@ -87,7 +89,9 @@ StandardCalculatorViewModel::StandardCalculatorViewModel() :
|
||||||
m_localizedMemorySavedAutomationFormat(nullptr),
|
m_localizedMemorySavedAutomationFormat(nullptr),
|
||||||
m_localizedMemoryItemChangedAutomationFormat(nullptr),
|
m_localizedMemoryItemChangedAutomationFormat(nullptr),
|
||||||
m_localizedMemoryItemClearedAutomationFormat(nullptr),
|
m_localizedMemoryItemClearedAutomationFormat(nullptr),
|
||||||
m_localizedMemoryCleared(nullptr)
|
m_localizedMemoryCleared(nullptr),
|
||||||
|
m_localizedOpenParenthesisCountChangedAutomationFormat(nullptr),
|
||||||
|
m_localizedNoRightParenthesisAddedFormat(nullptr)
|
||||||
{
|
{
|
||||||
WeakReference calculatorViewModel(this);
|
WeakReference calculatorViewModel(this);
|
||||||
m_calculatorDisplay.SetCallback(calculatorViewModel);
|
m_calculatorDisplay.SetCallback(calculatorViewModel);
|
||||||
|
@ -221,6 +225,34 @@ void StandardCalculatorViewModel::SetParenthesisCount(_In_ const wstring& parent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StandardCalculatorViewModel::SetOpenParenthesisCountNarratorAnnouncement()
|
||||||
|
{
|
||||||
|
String^ parenthesisCount = ((m_OpenParenthesisCount == nullptr) ? "0" : m_OpenParenthesisCount);
|
||||||
|
wstring localizedParenthesisCount = parenthesisCount->Data();
|
||||||
|
LocalizationSettings::GetInstance().LocalizeDisplayValue(&localizedParenthesisCount);
|
||||||
|
|
||||||
|
String^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement(
|
||||||
|
CalculatorResourceKeys::OpenParenthesisCountAutomationFormat,
|
||||||
|
m_localizedOpenParenthesisCountChangedAutomationFormat,
|
||||||
|
localizedParenthesisCount.c_str());
|
||||||
|
|
||||||
|
Announcement = CalculatorAnnouncement::GetOpenParenthesisCountChangedAnnouncement(announcement);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StandardCalculatorViewModel::OnNoRightParenAdded()
|
||||||
|
{
|
||||||
|
SetNoParenAddedNarratorAnnouncement();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StandardCalculatorViewModel::SetNoParenAddedNarratorAnnouncement()
|
||||||
|
{
|
||||||
|
String^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement(
|
||||||
|
CalculatorResourceKeys::NoParenthesisAdded,
|
||||||
|
m_localizedNoRightParenthesisAddedFormat);
|
||||||
|
|
||||||
|
Announcement = CalculatorAnnouncement::GetNoRightParenthesisAddedAnnouncement(announcement);
|
||||||
|
}
|
||||||
|
|
||||||
void StandardCalculatorViewModel::DisableButtons(CommandType selectedExpressionCommandType)
|
void StandardCalculatorViewModel::DisableButtons(CommandType selectedExpressionCommandType)
|
||||||
{
|
{
|
||||||
if (selectedExpressionCommandType == CommandType::OperandCommand)
|
if (selectedExpressionCommandType == CommandType::OperandCommand)
|
||||||
|
@ -478,7 +510,7 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum)
|
||||||
|
|
||||||
if (IsOperandTextCompletelySelected)
|
if (IsOperandTextCompletelySelected)
|
||||||
{
|
{
|
||||||
//Clear older text;
|
// Clear older text;
|
||||||
m_selectedExpressionLastData = L"";
|
m_selectedExpressionLastData = L"";
|
||||||
if (ch == L'x')
|
if (ch == L'x')
|
||||||
{
|
{
|
||||||
|
@ -520,6 +552,7 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum)
|
||||||
length = m_selectedExpressionLastData->Length() + 1;
|
length = m_selectedExpressionLastData->Length() + 1;
|
||||||
if (length > 50)
|
if (length > 50)
|
||||||
{
|
{
|
||||||
|
delete [] temp;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (; i < length; ++i)
|
for (; i < length; ++i)
|
||||||
|
@ -1157,10 +1190,10 @@ Array<unsigned char>^ StandardCalculatorViewModel::Serialize()
|
||||||
writer->WriteInt32(data);
|
writer->WriteInt32(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//For ProgrammerMode
|
// For ProgrammerMode
|
||||||
writer->WriteUInt32(static_cast<UINT32>(CurrentRadixType));
|
writer->WriteUInt32(static_cast<UINT32>(CurrentRadixType));
|
||||||
|
|
||||||
//Serialize commands of calculator manager
|
// Serialize commands of calculator manager
|
||||||
vector<unsigned char> serializedCommand = m_standardCalculatorManager.SerializeCommands();
|
vector<unsigned char> serializedCommand = m_standardCalculatorManager.SerializeCommands();
|
||||||
writer->WriteUInt32(static_cast<UINT32>(serializedCommand.size()));
|
writer->WriteUInt32(static_cast<UINT32>(serializedCommand.size()));
|
||||||
writer->WriteBytes(ref new Array<unsigned char>(serializedCommand.data(), static_cast<unsigned int>(serializedCommand.size())));
|
writer->WriteBytes(ref new Array<unsigned char>(serializedCommand.data(), static_cast<unsigned int>(serializedCommand.size())));
|
||||||
|
@ -1170,7 +1203,7 @@ Array<unsigned char>^ StandardCalculatorViewModel::Serialize()
|
||||||
Utils::SerializeCommandsAndTokens(m_tokens, m_commands, writer);
|
Utils::SerializeCommandsAndTokens(m_tokens, m_commands, writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Convert viewmodel data in writer to bytes
|
// Convert viewmodel data in writer to bytes
|
||||||
IBuffer^ buffer = writer->DetachBuffer();
|
IBuffer^ buffer = writer->DetachBuffer();
|
||||||
DataReader^ reader = DataReader::FromBuffer(buffer);
|
DataReader^ reader = DataReader::FromBuffer(buffer);
|
||||||
Platform::Array<unsigned char>^ viewModelDataAsBytes = ref new Array<unsigned char>(buffer->Length);
|
Platform::Array<unsigned char>^ viewModelDataAsBytes = ref new Array<unsigned char>(buffer->Length);
|
||||||
|
@ -1218,7 +1251,7 @@ void StandardCalculatorViewModel::Deserialize(Array<unsigned char>^ state)
|
||||||
m_standardCalculatorManager.DeSerializePrimaryDisplay(serializedPrimaryDisplay);
|
m_standardCalculatorManager.DeSerializePrimaryDisplay(serializedPrimaryDisplay);
|
||||||
|
|
||||||
CurrentRadixType = reader->ReadUInt32();
|
CurrentRadixType = reader->ReadUInt32();
|
||||||
//Read command data and Deserialize
|
// Read command data and Deserialize
|
||||||
UINT32 modeldatalength = reader->ReadUInt32();
|
UINT32 modeldatalength = reader->ReadUInt32();
|
||||||
Array<unsigned char>^ modelDataAsBytes = ref new Array<unsigned char>(modeldatalength);
|
Array<unsigned char>^ modelDataAsBytes = ref new Array<unsigned char>(modeldatalength);
|
||||||
reader->ReadBytes(modelDataAsBytes);
|
reader->ReadBytes(modelDataAsBytes);
|
||||||
|
@ -1609,7 +1642,7 @@ bool StandardCalculatorViewModel::IsOpnd(int nOpCode)
|
||||||
Command::CommandPNT
|
Command::CommandPNT
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYSIZE(opnd); i++)
|
for (int i = 0; i < size(opnd); i++)
|
||||||
{
|
{
|
||||||
if (nOpCode == static_cast<int>(opnd[i]))
|
if (nOpCode == static_cast<int>(opnd[i]))
|
||||||
{
|
{
|
||||||
|
@ -1640,7 +1673,7 @@ bool StandardCalculatorViewModel::IsUnaryOp(int nOpCode)
|
||||||
Command::CommandCUB
|
Command::CommandCUB
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYSIZE(unaryOp); i++)
|
for (int i = 0; i < size(unaryOp); i++)
|
||||||
{
|
{
|
||||||
if (nOpCode == static_cast<int>(unaryOp[i]))
|
if (nOpCode == static_cast<int>(unaryOp[i]))
|
||||||
{
|
{
|
||||||
|
@ -1667,7 +1700,7 @@ bool StandardCalculatorViewModel::IsTrigOp(int nOpCode)
|
||||||
Command::CommandATAN
|
Command::CommandATAN
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYSIZE(trigOp); i++)
|
for (int i = 0; i < size(trigOp); i++)
|
||||||
{
|
{
|
||||||
if (nOpCode == static_cast<int>(trigOp[i]))
|
if (nOpCode == static_cast<int>(trigOp[i]))
|
||||||
{
|
{
|
||||||
|
@ -1690,7 +1723,7 @@ bool StandardCalculatorViewModel::IsBinOp(int nOpCode)
|
||||||
Command::CommandPWR
|
Command::CommandPWR
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYSIZE(binOp); i++)
|
for (int i = 0; i < size(binOp); i++)
|
||||||
{
|
{
|
||||||
if (nOpCode == static_cast<int>(binOp[i]))
|
if (nOpCode == static_cast<int>(binOp[i]))
|
||||||
{
|
{
|
||||||
|
@ -1724,7 +1757,7 @@ bool StandardCalculatorViewModel::IsRecoverableCommand(int nOpCode)
|
||||||
Command::CommandF
|
Command::CommandF
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYSIZE(recoverableCommands); i++)
|
for (int i = 0; i < size(recoverableCommands); i++)
|
||||||
{
|
{
|
||||||
if (nOpCode == static_cast<int>(recoverableCommands[i]))
|
if (nOpCode == static_cast<int>(recoverableCommands[i]))
|
||||||
{
|
{
|
||||||
|
@ -1942,7 +1975,7 @@ void StandardCalculatorViewModel::UpdatecommandsInRecordingMode()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//reset all vars
|
// Reset all vars
|
||||||
isDecimal = false;
|
isDecimal = false;
|
||||||
isNegative = false;
|
isNegative = false;
|
||||||
isExpMode = false;
|
isExpMode = false;
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace CalculatorApp
|
||||||
OBSERVABLE_PROPERTY_RW(bool, IsDwordEnabled);
|
OBSERVABLE_PROPERTY_RW(bool, IsDwordEnabled);
|
||||||
OBSERVABLE_PROPERTY_RW(bool, IsWordEnabled);
|
OBSERVABLE_PROPERTY_RW(bool, IsWordEnabled);
|
||||||
OBSERVABLE_PROPERTY_RW(bool, IsByteEnabled);
|
OBSERVABLE_PROPERTY_RW(bool, IsByteEnabled);
|
||||||
OBSERVABLE_PROPERTY_RW(Platform::String^, OpenParenthesisCount);
|
OBSERVABLE_NAMED_PROPERTY_RW(Platform::String^, OpenParenthesisCount);
|
||||||
OBSERVABLE_PROPERTY_RW(int, CurrentRadixType);
|
OBSERVABLE_PROPERTY_RW(int, CurrentRadixType);
|
||||||
OBSERVABLE_PROPERTY_RW(bool, AreTokensUpdated);
|
OBSERVABLE_PROPERTY_RW(bool, AreTokensUpdated);
|
||||||
OBSERVABLE_PROPERTY_RW(bool, AreHistoryShortcutsEnabled);
|
OBSERVABLE_PROPERTY_RW(bool, AreHistoryShortcutsEnabled);
|
||||||
|
@ -270,7 +270,7 @@ namespace CalculatorApp
|
||||||
|
|
||||||
NumbersAndOperatorsEnum MapCharacterToButtonId(const wchar_t ch, bool& canSendNegate);
|
NumbersAndOperatorsEnum MapCharacterToButtonId(const wchar_t ch, bool& canSendNegate);
|
||||||
|
|
||||||
//Memory feature related methods. They are internal because they need to called from the MainPage code-behind
|
// Memory feature related methods. They are internal because they need to called from the MainPage code-behind
|
||||||
void OnMemoryButtonPressed();
|
void OnMemoryButtonPressed();
|
||||||
void OnMemoryItemPressed(Platform::Object^ memoryItemPosition);
|
void OnMemoryItemPressed(Platform::Object^ memoryItemPosition);
|
||||||
void OnMemoryAdd(Platform::Object^ memoryItemPosition);
|
void OnMemoryAdd(Platform::Object^ memoryItemPosition);
|
||||||
|
@ -284,6 +284,9 @@ namespace CalculatorApp
|
||||||
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 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, _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, _Inout_ std::shared_ptr<CalculatorVector <std::shared_ptr<IExpressionCommand>>> const &commands);
|
||||||
void SetParenthesisCount(_In_ const std::wstring& parenthesisCount);
|
void SetParenthesisCount(_In_ const std::wstring& parenthesisCount);
|
||||||
|
void SetOpenParenthesisCountNarratorAnnouncement();
|
||||||
|
void OnNoRightParenAdded();
|
||||||
|
void SetNoParenAddedNarratorAnnouncement();
|
||||||
void OnMaxDigitsReached();
|
void OnMaxDigitsReached();
|
||||||
void OnBinaryOperatorReceived();
|
void OnBinaryOperatorReceived();
|
||||||
void OnMemoryItemChanged(unsigned int indexOfMemory);
|
void OnMemoryItemChanged(unsigned int indexOfMemory);
|
||||||
|
@ -331,6 +334,8 @@ namespace CalculatorApp
|
||||||
Platform::String^ m_localizedMemoryItemChangedAutomationFormat;
|
Platform::String^ m_localizedMemoryItemChangedAutomationFormat;
|
||||||
Platform::String^ m_localizedMemoryItemClearedAutomationFormat;
|
Platform::String^ m_localizedMemoryItemClearedAutomationFormat;
|
||||||
Platform::String^ m_localizedMemoryCleared;
|
Platform::String^ m_localizedMemoryCleared;
|
||||||
|
Platform::String^ m_localizedOpenParenthesisCountChangedAutomationFormat;
|
||||||
|
Platform::String^ m_localizedNoRightParenthesisAddedFormat;
|
||||||
|
|
||||||
bool m_pinned;
|
bool m_pinned;
|
||||||
bool m_isOperandEnabled;
|
bool m_isOperandEnabled;
|
||||||
|
|
|
@ -469,7 +469,7 @@ void UnitConverterViewModel::OnButtonPressed(Platform::Object^ parameter)
|
||||||
NumbersAndOperatorsEnum numOpEnum = CalculatorButtonPressedEventArgs::GetOperationFromCommandParameter(parameter);
|
NumbersAndOperatorsEnum numOpEnum = CalculatorButtonPressedEventArgs::GetOperationFromCommandParameter(parameter);
|
||||||
UCM::Command command = CommandFromButtonId(numOpEnum);
|
UCM::Command command = CommandFromButtonId(numOpEnum);
|
||||||
|
|
||||||
//Don't clear the display if combo box is open and escape is pressed
|
// Don't clear the display if combo box is open and escape is pressed
|
||||||
if (command == UCM::Command::Clear && IsDropDownOpen)
|
if (command == UCM::Command::Clear && IsDropDownOpen)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -664,7 +664,7 @@ void UnitConverterViewModel::Deserialize(Platform::String^ state)
|
||||||
RaisePropertyChanged(nullptr); // Update since all props have been updated.
|
RaisePropertyChanged(nullptr); // Update since all props have been updated.
|
||||||
}
|
}
|
||||||
|
|
||||||
//Saving User Preferences of Category and Associated-Units across Sessions.
|
// Saving User Preferences of Category and Associated-Units across Sessions.
|
||||||
void UnitConverterViewModel::SaveUserPreferences()
|
void UnitConverterViewModel::SaveUserPreferences()
|
||||||
{
|
{
|
||||||
if (UnitsAreValid())
|
if (UnitsAreValid())
|
||||||
|
@ -685,7 +685,7 @@ void UnitConverterViewModel::SaveUserPreferences()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Restoring User Preferences of Category and Associated-Units.
|
// Restoring User Preferences of Category and Associated-Units.
|
||||||
void UnitConverterViewModel::RestoreUserPreferences()
|
void UnitConverterViewModel::RestoreUserPreferences()
|
||||||
{
|
{
|
||||||
if (!IsCurrencyCurrentCategory)
|
if (!IsCurrencyCurrentCategory)
|
||||||
|
|
|
@ -224,7 +224,7 @@ namespace CalculatorApp
|
||||||
Platform::String^ Serialize();
|
Platform::String^ Serialize();
|
||||||
void Deserialize(Platform::String^ state);
|
void Deserialize(Platform::String^ state);
|
||||||
|
|
||||||
//Saving And Restoring User Preferences of Category and Associated-Units across Sessions.
|
// Saving And Restoring User Preferences of Category and Associated-Units across Sessions.
|
||||||
void SaveUserPreferences();
|
void SaveUserPreferences();
|
||||||
void RestoreUserPreferences();
|
void RestoreUserPreferences();
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <concrt.h>
|
#include <concrt.h>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
#include <iterator>
|
||||||
// C++\WinRT Headers
|
// C++\WinRT Headers
|
||||||
#include "winrt/base.h"
|
#include "winrt/base.h"
|
||||||
#include "winrt/Windows.Foundation.Diagnostics.h"
|
#include "winrt/Windows.Foundation.Diagnostics.h"
|
||||||
|
|
|
@ -371,12 +371,13 @@
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<VisualStateManager.VisualStateGroups>
|
<VisualStateManager.VisualStateGroups>
|
||||||
<VisualStateGroup x:Name="ActiveStates">
|
<VisualStateGroup x:Name="ActiveStates">
|
||||||
<VisualState x:Name="Active"/>
|
<VisualState x:Name="Active">
|
||||||
<VisualState x:Name="Normal">
|
|
||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Target="normalOutput.FontWeight" Value="Light"/>
|
<Setter Target="normalOutput.FontWeight" Value="SemiBold"/>
|
||||||
|
<Setter Target="normalOutput.IsTextSelectionEnabled" Value="True"/>
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
|
<VisualState x:Name="Normal"/>
|
||||||
</VisualStateGroup>
|
</VisualStateGroup>
|
||||||
</VisualStateManager.VisualStateGroups>
|
</VisualStateManager.VisualStateGroups>
|
||||||
<ScrollViewer x:Name="textContainer"
|
<ScrollViewer x:Name="textContainer"
|
||||||
|
@ -390,7 +391,7 @@
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
Foreground="{TemplateBinding Foreground}"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
FontSize="{TemplateBinding FontSize}"
|
FontSize="{TemplateBinding FontSize}"
|
||||||
FontWeight="SemiBold"
|
FontWeight="Light"
|
||||||
AutomationProperties.AccessibilityView="Raw"
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
Text="{TemplateBinding DisplayValue}"
|
Text="{TemplateBinding DisplayValue}"
|
||||||
TextAlignment="{TemplateBinding HorizontalContentAlignment}"
|
TextAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
@ -457,12 +458,13 @@
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<VisualStateManager.VisualStateGroups>
|
<VisualStateManager.VisualStateGroups>
|
||||||
<VisualStateGroup x:Name="ActiveStates">
|
<VisualStateGroup x:Name="ActiveStates">
|
||||||
<VisualState x:Name="Active"/>
|
<VisualState x:Name="Active">
|
||||||
<VisualState x:Name="Normal">
|
|
||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Target="normalOutput.FontWeight" Value="Light"/>
|
<Setter Target="normalOutput.IsTextSelectionEnabled" Value="True"/>
|
||||||
|
<Setter Target="normalOutput.FontWeight" Value="SemiBold"/>
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
|
<VisualState x:Name="Normal"/>
|
||||||
</VisualStateGroup>
|
</VisualStateGroup>
|
||||||
</VisualStateManager.VisualStateGroups>
|
</VisualStateManager.VisualStateGroups>
|
||||||
<ScrollViewer x:Name="textContainer"
|
<ScrollViewer x:Name="textContainer"
|
||||||
|
@ -476,7 +478,7 @@
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
Foreground="{TemplateBinding Foreground}"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
FontSize="{TemplateBinding FontSize}"
|
FontSize="{TemplateBinding FontSize}"
|
||||||
FontWeight="SemiBold"
|
FontWeight="Light"
|
||||||
AutomationProperties.AccessibilityView="Raw"
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
Text="{TemplateBinding DisplayValue}"
|
Text="{TemplateBinding DisplayValue}"
|
||||||
TextAlignment="{TemplateBinding HorizontalContentAlignment}"
|
TextAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
@ -544,12 +546,13 @@
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<VisualStateManager.VisualStateGroups>
|
<VisualStateManager.VisualStateGroups>
|
||||||
<VisualStateGroup x:Name="ActiveStates">
|
<VisualStateGroup x:Name="ActiveStates">
|
||||||
<VisualState x:Name="Active"/>
|
<VisualState x:Name="Active">
|
||||||
<VisualState x:Name="Normal">
|
|
||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Target="normalOutput.FontWeight" Value="Light"/>
|
<Setter Target="normalOutput.FontWeight" Value="SemiBold"/>
|
||||||
|
<Setter Target="normalOutput.IsTextSelectionEnabled" Value="True"/>
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
|
<VisualState x:Name="Normal"/>
|
||||||
</VisualStateGroup>
|
</VisualStateGroup>
|
||||||
</VisualStateManager.VisualStateGroups>
|
</VisualStateManager.VisualStateGroups>
|
||||||
<ScrollViewer x:Name="textContainer"
|
<ScrollViewer x:Name="textContainer"
|
||||||
|
@ -563,7 +566,7 @@
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
Foreground="{TemplateBinding Foreground}"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
FontSize="{TemplateBinding FontSize}"
|
FontSize="{TemplateBinding FontSize}"
|
||||||
FontWeight="SemiBold"
|
FontWeight="Light"
|
||||||
AutomationProperties.AccessibilityView="Raw"
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
Text="{TemplateBinding DisplayValue}"
|
Text="{TemplateBinding DisplayValue}"
|
||||||
TextAlignment="{TemplateBinding HorizontalContentAlignment}"
|
TextAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace CalculatorApp
|
||||||
m_appLifecycleProvider(
|
m_appLifecycleProvider(
|
||||||
L"Microsoft.Windows.AppLifeCycle",
|
L"Microsoft.Windows.AppLifeCycle",
|
||||||
LoggingChannelOptions(GUID{ 0x4f50731a, 0x89cf, 0x4782, 0xb3, 0xe0, 0xdc, 0xe8, 0xc9, 0x4, 0x76, 0xba }), // Microsoft Telemetry group
|
LoggingChannelOptions(GUID{ 0x4f50731a, 0x89cf, 0x4782, 0xb3, 0xe0, 0xdc, 0xe8, 0xc9, 0x4, 0x76, 0xba }), // Microsoft Telemetry group
|
||||||
GUID{ 0xef00584a, 0x2655, 0x462c, 0xbc, 0x24, 0xe7, 0xde, 0x63, 0xe, 0x7f, 0xbf }) //Unique provider ID {EF00584A-2655-462C-BC24-E7DE630E7FBF}
|
GUID{ 0xef00584a, 0x2655, 0x462c, 0xbc, 0x24, 0xe7, 0xde, 0x63, 0xe, 0x7f, 0xbf }) // Unique provider ID {EF00584A-2655-462C-BC24-E7DE630E7FBF}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,9 @@ namespace CalculatorApp
|
||||||
AppLifecycleLogger();
|
AppLifecycleLogger();
|
||||||
|
|
||||||
// Any new Log method should
|
// Any new Log method should
|
||||||
// a) decide the level of logging. This will help us in limiting recording of events only up to a certain level. See this link for guidance https://msdn.microsoft.com/en-us/library/windows/desktop/aa363742(v=vs.85).aspx
|
// a) Decide the level of logging. This will help us in limiting recording of events only up to a certain level. See this link for guidance https://msdn.microsoft.com/en-us/library/windows/desktop/aa363742(v=vs.85).aspx
|
||||||
// We're using Verbose level for events that are called frequently and needed only for debugging or capturing perf for specific scenarios
|
// We're using Verbose level for events that are called frequently and needed only for debugging or capturing perf for specific scenarios
|
||||||
// b) should decide whether or not to log to telemetry and pass TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY) accordingly
|
// b) Should decide whether or not to log to telemetry and pass TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY) accordingly
|
||||||
// c) Should accept a variable number of additional data arguments if needed
|
// c) Should accept a variable number of additional data arguments if needed
|
||||||
void LogAppLifecycleEvent(winrt::hstring const& eventName, winrt::Windows::Foundation::Diagnostics::LoggingFields const& fields) const;
|
void LogAppLifecycleEvent(winrt::hstring const& eventName, winrt::Windows::Foundation::Diagnostics::LoggingFields const& fields) const;
|
||||||
void PopulateAppInfo(winrt::Windows::Foundation::Diagnostics::LoggingFields& fields) const;
|
void PopulateAppInfo(winrt::Windows::Foundation::Diagnostics::LoggingFields& fields) const;
|
||||||
|
|
|
@ -192,8 +192,8 @@ void CalculationResult::UpdateTextState()
|
||||||
String^ oldText = m_textBlock->Text;
|
String^ oldText = m_textBlock->Text;
|
||||||
String^ newText = Utils::LRO + DisplayValue + Utils::PDF;
|
String^ newText = Utils::LRO + DisplayValue + Utils::PDF;
|
||||||
|
|
||||||
//Initiate the scaling operation
|
// Initiate the scaling operation
|
||||||
//UpdateLayout will keep calling us until we make it through the below 2 if-statements
|
// UpdateLayout will keep calling us until we make it through the below 2 if-statements
|
||||||
if (!m_isScalingText || oldText != newText)
|
if (!m_isScalingText || oldText != newText)
|
||||||
{
|
{
|
||||||
m_textBlock->Text = newText;
|
m_textBlock->Text = newText;
|
||||||
|
|
|
@ -1321,6 +1321,14 @@
|
||||||
<value>Right parenthesis</value>
|
<value>Right parenthesis</value>
|
||||||
<comment>Screen reader prompt for the Calculator ")" button on the scientific operator keypad</comment>
|
<comment>Screen reader prompt for the Calculator ")" button on the scientific operator keypad</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Format_OpenParenthesisCountAutomationNamePrefix" xml:space="preserve">
|
||||||
|
<value>Open parenthesis count %1</value>
|
||||||
|
<comment>{Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific and programmer operator keypad. %1 is the localized count of open parenthesis, e.g. "2".</comment>
|
||||||
|
</data>
|
||||||
|
<data name="NoRightParenthesisAdded_Announcement" xml:space="preserve">
|
||||||
|
<value>There are no open parentheses to close.</value>
|
||||||
|
<comment>{Locked="%1"} Screen reader prompt for the Calculator when the ")" button on the scientific and programmer operator keypad cannot be added to the equation. e.g. "1+)".</comment>
|
||||||
|
</data>
|
||||||
<data name="ftoeButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
<data name="ftoeButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||||
<value>Scientific notation</value>
|
<value>Scientific notation</value>
|
||||||
<comment>Screen reader prompt for the Calculator F-E the scientific operator keypad</comment>
|
<comment>Screen reader prompt for the Calculator F-E the scientific operator keypad</comment>
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
d:DesignHeight="395"
|
d:DesignHeight="395"
|
||||||
d:DesignWidth="315"
|
d:DesignWidth="315"
|
||||||
Loaded="OnLoaded"
|
Loaded="OnLoaded"
|
||||||
|
Unloaded="OnUnloaded"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<Grid x:Name="ProgRadixOps">
|
<Grid x:Name="ProgRadixOps">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -34,8 +34,13 @@ CalculatorProgrammerRadixOperators::CalculatorProgrammerRadixOperators() :
|
||||||
|
|
||||||
void CalculatorProgrammerRadixOperators::OnLoaded(Object^, RoutedEventArgs^)
|
void CalculatorProgrammerRadixOperators::OnLoaded(Object^, RoutedEventArgs^)
|
||||||
{
|
{
|
||||||
auto viewmodel = safe_cast<StandardCalculatorViewModel^>(this->DataContext);
|
m_progModeRadixChangeToken = Model->ProgModeRadixChange += ref new ProgModeRadixChangeHandler(this, &CalculatorProgrammerRadixOperators::ProgModeRadixChange);
|
||||||
viewmodel->ProgModeRadixChange += ref new ProgModeRadixChangeHandler(this, &CalculatorProgrammerRadixOperators::ProgModeRadixChange);
|
m_propertyChangedToken = Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &CalculatorProgrammerRadixOperators::OnViewModelPropertyChanged);
|
||||||
|
}
|
||||||
|
void CalculatorProgrammerRadixOperators::OnUnloaded(Object^, RoutedEventArgs^)
|
||||||
|
{
|
||||||
|
Model->ProgModeRadixChange -= m_progModeRadixChangeToken;
|
||||||
|
Model->PropertyChanged -= m_propertyChangedToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalculatorProgrammerRadixOperators::Shift_Clicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
|
void CalculatorProgrammerRadixOperators::Shift_Clicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
|
||||||
|
@ -94,3 +99,11 @@ void CalculatorProgrammerRadixOperators::IsErrorVisualState::set(bool value)
|
||||||
NumberPad->IsErrorVisualState = m_isErrorVisualState;
|
NumberPad->IsErrorVisualState = m_isErrorVisualState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CalculatorProgrammerRadixOperators::OnViewModelPropertyChanged(Object^ sender, PropertyChangedEventArgs^ e)
|
||||||
|
{
|
||||||
|
if (e->PropertyName == StandardCalculatorViewModel::OpenParenthesisCountPropertyName && closeParenthesisButton->FocusState != ::FocusState::Unfocused)
|
||||||
|
{
|
||||||
|
Model->SetOpenParenthesisCountNarratorAnnouncement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -33,8 +33,12 @@ namespace CalculatorApp
|
||||||
void Shift_Clicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
void Shift_Clicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||||
void SetVisibilityBinding(Windows::UI::Xaml::FrameworkElement^ element, Platform::String^ path, Windows::UI::Xaml::Data::IValueConverter^ converter);
|
void SetVisibilityBinding(Windows::UI::Xaml::FrameworkElement^ element, Platform::String^ path, Windows::UI::Xaml::Data::IValueConverter^ converter);
|
||||||
void OnLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
void OnLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||||
|
void OnUnloaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||||
void ProgModeRadixChange();
|
void ProgModeRadixChange();
|
||||||
|
void OnViewModelPropertyChanged(Platform::Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e);
|
||||||
|
|
||||||
bool m_isErrorVisualState;
|
bool m_isErrorVisualState;
|
||||||
|
Windows::Foundation::EventRegistrationToken m_progModeRadixChangeToken;
|
||||||
|
Windows::Foundation::EventRegistrationToken m_propertyChangedToken;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
x:Name="ControlRoot"
|
x:Name="ControlRoot"
|
||||||
d:DesignHeight="400"
|
d:DesignHeight="400"
|
||||||
d:DesignWidth="315"
|
d:DesignWidth="315"
|
||||||
|
Loaded="OnLoaded"
|
||||||
|
Unloaded="OnUnloaded"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<converters:BooleanNegationConverter x:Key="BooleanNegationConverter"/>
|
<converters:BooleanNegationConverter x:Key="BooleanNegationConverter"/>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -38,6 +38,15 @@ CalculatorScientificOperators::CalculatorScientificOperators()
|
||||||
Common::KeyboardShortcutManager::ShiftButtonChecked(false);
|
Common::KeyboardShortcutManager::ShiftButtonChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CalculatorScientificOperators::OnLoaded(Object^, RoutedEventArgs^)
|
||||||
|
{
|
||||||
|
m_propertyChangedToken = Model->PropertyChanged += ref new PropertyChangedEventHandler(this, &CalculatorScientificOperators::OnViewModelPropertyChanged);
|
||||||
|
}
|
||||||
|
void CalculatorScientificOperators::OnUnloaded(Object^, RoutedEventArgs^)
|
||||||
|
{
|
||||||
|
Model->PropertyChanged -= m_propertyChangedToken;
|
||||||
|
}
|
||||||
|
|
||||||
void CalculatorScientificOperators::ShortLayout_Completed(_In_ Platform::Object^ /*sender*/, _In_ Platform::Object^ /*e*/)
|
void CalculatorScientificOperators::ShortLayout_Completed(_In_ Platform::Object^ /*sender*/, _In_ Platform::Object^ /*e*/)
|
||||||
{
|
{
|
||||||
IsWideLayout = false;
|
IsWideLayout = false;
|
||||||
|
@ -97,3 +106,11 @@ void CalculatorScientificOperators::SetOperatorRowVisibility()
|
||||||
InvRow1->Visibility = invRowVis;
|
InvRow1->Visibility = invRowVis;
|
||||||
InvRow2->Visibility = invRowVis;
|
InvRow2->Visibility = invRowVis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CalculatorScientificOperators::OnViewModelPropertyChanged(Object^ sender, PropertyChangedEventArgs^ e)
|
||||||
|
{
|
||||||
|
if (e->PropertyName == StandardCalculatorViewModel::OpenParenthesisCountPropertyName && closeParenthesisButton->FocusState != ::FocusState::Unfocused)
|
||||||
|
{
|
||||||
|
Model->SetOpenParenthesisCountNarratorAnnouncement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -41,5 +41,10 @@ namespace CalculatorApp
|
||||||
void shiftButton_Check(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
void shiftButton_Check(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||||
void shiftButton_IsEnabledChanged(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ e);
|
void shiftButton_IsEnabledChanged(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ e);
|
||||||
void SetOperatorRowVisibility();
|
void SetOperatorRowVisibility();
|
||||||
|
void OnViewModelPropertyChanged(Platform::Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e);
|
||||||
|
void OnLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||||
|
void OnUnloaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||||
|
|
||||||
|
Windows::Foundation::EventRegistrationToken m_propertyChangedToken;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -459,11 +459,13 @@
|
||||||
AutomationProperties.LiveSetting="Polite"
|
AutomationProperties.LiveSetting="Polite"
|
||||||
AutomationProperties.Name="{Binding StrDateDiffResultAutomationName}"
|
AutomationProperties.Name="{Binding StrDateDiffResultAutomationName}"
|
||||||
ContextFlyout="{StaticResource ResultsContextMenu}"
|
ContextFlyout="{StaticResource ResultsContextMenu}"
|
||||||
|
IsTextSelectionEnabled="True"
|
||||||
Text="{Binding StrDateDiffResult}"/>
|
Text="{Binding StrDateDiffResult}"/>
|
||||||
<TextBlock Grid.Row="10"
|
<TextBlock Grid.Row="10"
|
||||||
Style="{ThemeResource BaseTextBlockStyle}"
|
Style="{ThemeResource BaseTextBlockStyle}"
|
||||||
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
|
Foreground="{ThemeResource SystemControlPageTextBaseMediumBrush}"
|
||||||
ContextFlyout="{StaticResource ResultsContextMenu}"
|
ContextFlyout="{StaticResource ResultsContextMenu}"
|
||||||
|
IsTextSelectionEnabled="True"
|
||||||
Text="{Binding StrDateDiffResultInDays, Mode=OneWay}"
|
Text="{Binding StrDateDiffResultInDays, Mode=OneWay}"
|
||||||
Visibility="{Binding IsDiffInDays, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
Visibility="{Binding IsDiffInDays, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -602,6 +604,7 @@
|
||||||
AutomationProperties.LiveSetting="Polite"
|
AutomationProperties.LiveSetting="Polite"
|
||||||
AutomationProperties.Name="{Binding StrDateResultAutomationName}"
|
AutomationProperties.Name="{Binding StrDateResultAutomationName}"
|
||||||
ContextFlyout="{StaticResource ResultsContextMenu}"
|
ContextFlyout="{StaticResource ResultsContextMenu}"
|
||||||
|
IsTextSelectionEnabled="True"
|
||||||
Text="{Binding StrDateResult}"/>
|
Text="{Binding StrDateResult}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
@ -64,15 +64,19 @@
|
||||||
ContextFlyout="{StaticResource HistoryContextMenu}">
|
ContextFlyout="{StaticResource HistoryContextMenu}">
|
||||||
<TextBlock x:Name="exprTextBlock"
|
<TextBlock x:Name="exprTextBlock"
|
||||||
Margin="0,0,0,4"
|
Margin="0,0,0,4"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
Style="{ThemeResource BodyTextBlockMediumStyle}"
|
Style="{ThemeResource BodyTextBlockMediumStyle}"
|
||||||
AutomationProperties.Name="{x:Bind AccExpression}"
|
AutomationProperties.Name="{x:Bind AccExpression}"
|
||||||
|
IsTextSelectionEnabled="True"
|
||||||
Text="{x:Bind Expression}"
|
Text="{x:Bind Expression}"
|
||||||
TextAlignment="Right"
|
TextAlignment="Right"
|
||||||
TextWrapping="Wrap"/>
|
TextWrapping="Wrap"/>
|
||||||
<TextBlock x:Name="resultTextBlock"
|
<TextBlock x:Name="resultTextBlock"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
Style="{ThemeResource TitleTextBlockStyle}"
|
Style="{ThemeResource TitleTextBlockStyle}"
|
||||||
FontWeight="SemiBold"
|
FontWeight="SemiBold"
|
||||||
AutomationProperties.Name="{x:Bind AccResult}"
|
AutomationProperties.Name="{x:Bind AccResult}"
|
||||||
|
IsTextSelectionEnabled="True"
|
||||||
Text="{x:Bind Result}"
|
Text="{x:Bind Result}"
|
||||||
TextAlignment="Right"
|
TextAlignment="Right"
|
||||||
TextWrapping="Wrap"/>
|
TextWrapping="Wrap"/>
|
||||||
|
|
|
@ -56,9 +56,11 @@
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock Margin="0,2,14,0"
|
<TextBlock Margin="0,2,14,0"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
Style="{ThemeResource TitleTextBlockStyle}"
|
Style="{ThemeResource TitleTextBlockStyle}"
|
||||||
FontWeight="SemiBold"
|
FontWeight="SemiBold"
|
||||||
FlowDirection="LeftToRight"
|
FlowDirection="LeftToRight"
|
||||||
|
IsTextSelectionEnabled="True"
|
||||||
Text="{x:Bind Model.Value, Mode=OneWay}"
|
Text="{x:Bind Model.Value, Mode=OneWay}"
|
||||||
TextAlignment="Right"
|
TextAlignment="Right"
|
||||||
TextReadingOrder="DetectFromContent"
|
TextReadingOrder="DetectFromContent"
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
-->
|
-->
|
||||||
<controls:CalculatorButton x:Name="decimalSeparatorButton"
|
<controls:CalculatorButton x:Name="decimalSeparatorButton"
|
||||||
x:Uid="decimalSeparatorButton"
|
x:Uid="decimalSeparatorButton"
|
||||||
Grid.Row="4"
|
Grid.Row="3"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Style="{Binding ElementName=ControlRoot, Path=ButtonStyle}"
|
Style="{Binding ElementName=ControlRoot, Path=ButtonStyle}"
|
||||||
Background="{ThemeResource AppBackgroundAltMediumLowBrush}"
|
Background="{ThemeResource AppBackgroundAltMediumLowBrush}"
|
||||||
|
|
|
@ -51,7 +51,7 @@ UnitConverter::UnitConverter() :
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
//adding ESC key shortcut binding to clear button
|
// adding ESC key shortcut binding to clear button
|
||||||
clearEntryButtonPos0->SetValue(Common::KeyboardShortcutManager::VirtualKeyProperty, Common::MyVirtualKey::Escape);
|
clearEntryButtonPos0->SetValue(Common::KeyboardShortcutManager::VirtualKeyProperty, Common::MyVirtualKey::Escape);
|
||||||
|
|
||||||
m_layoutDirection = LocalizationService::GetInstance()->GetFlowDirection();
|
m_layoutDirection = LocalizationService::GetInstance()->GetFlowDirection();
|
||||||
|
@ -278,7 +278,7 @@ void UnitConverter::AnimateConverter()
|
||||||
void UnitConverter::OnValueSelected(_In_ Platform::Object^ sender)
|
void UnitConverter::OnValueSelected(_In_ Platform::Object^ sender)
|
||||||
{
|
{
|
||||||
auto value = safe_cast<CalculationResult^>(sender);
|
auto value = safe_cast<CalculationResult^>(sender);
|
||||||
//update the font size since the font is changed to bold
|
// update the font size since the font is changed to bold
|
||||||
value->UpdateTextState();
|
value->UpdateTextState();
|
||||||
safe_cast<UnitConverterViewModel^>(this->DataContext)->OnValueActivated(AsActivatable(value));
|
safe_cast<UnitConverterViewModel^>(this->DataContext)->OnValueActivated(AsActivatable(value));
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,11 @@ namespace CalculatorManagerTest
|
||||||
m_parenDisplay = parenthesisCount;
|
m_parenDisplay = parenthesisCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnNoRightParenAdded() override
|
||||||
|
{
|
||||||
|
// This method is used to create a narrator announcement when a close parenthesis cannot be added because there are no open parentheses
|
||||||
|
}
|
||||||
|
|
||||||
const wstring& GetPrimaryDisplay() const
|
const wstring& GetPrimaryDisplay() const
|
||||||
{
|
{
|
||||||
return m_primaryDisplay;
|
return m_primaryDisplay;
|
||||||
|
|
|
@ -663,7 +663,7 @@ namespace CalculatorUnitTests
|
||||||
// needs to be updated with correct expected value and viewmodel needs
|
// needs to be updated with correct expected value and viewmodel needs
|
||||||
// to be updated to calculate correct value.
|
// to be updated to calculate correct value.
|
||||||
|
|
||||||
//DateCalculatorViewModel^ viewModels[4];
|
// DateCalculatorViewModel^ viewModels[4];
|
||||||
|
|
||||||
//// Initialize the view models
|
//// Initialize the view models
|
||||||
//for (int i = 0; i < 4; i++)
|
//for (int i = 0; i < 4; i++)
|
||||||
|
@ -978,7 +978,7 @@ namespace CalculatorUnitTests
|
||||||
};
|
};
|
||||||
ValidateViewModelByCommands(viewModels[0], standardModeTestItems, false /*doReset*/);
|
ValidateViewModelByCommands(viewModels[0], standardModeTestItems, false /*doReset*/);
|
||||||
|
|
||||||
//Launch a new instance in standard mode
|
// Launch a new instance in standard mode
|
||||||
viewModels[2] = ref new StandardCalculatorViewModel();
|
viewModels[2] = ref new StandardCalculatorViewModel();
|
||||||
ChangeMode(viewModels[2], 0);
|
ChangeMode(viewModels[2], 0);
|
||||||
|
|
||||||
|
@ -994,7 +994,7 @@ namespace CalculatorUnitTests
|
||||||
};
|
};
|
||||||
ValidateViewModelByCommands(viewModels[2], standardModeTestItemsNew, false /*doReset*/);
|
ValidateViewModelByCommands(viewModels[2], standardModeTestItemsNew, false /*doReset*/);
|
||||||
|
|
||||||
//Radix in the programmer mode launched should still be hex.
|
// Radix in the programmer mode launched should still be hex.
|
||||||
// A + 1 = B
|
// A + 1 = B
|
||||||
TESTITEM programmerModeTestItemsNew[] = {
|
TESTITEM programmerModeTestItemsNew[] = {
|
||||||
{ NumbersAndOperatorsEnum::A, L"A", L"" },
|
{ NumbersAndOperatorsEnum::A, L"A", L"" },
|
||||||
|
|
|
@ -779,7 +779,7 @@ namespace CalculatorUnitTests
|
||||||
VERIFY_ARE_EQUAL(viewModel->IsOperatorCommand, false);
|
VERIFY_ARE_EQUAL(viewModel->IsOperatorCommand, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//When memory button is pressed - verify if display value is being stored in vector
|
// When memory button is pressed - verify if display value is being stored in vector
|
||||||
TEST_METHOD(OnMemoryButtonPressed)
|
TEST_METHOD(OnMemoryButtonPressed)
|
||||||
{
|
{
|
||||||
StandardCalculatorViewModel^ viewModel = ref new StandardCalculatorViewModel();
|
StandardCalculatorViewModel^ viewModel = ref new StandardCalculatorViewModel();
|
||||||
|
@ -790,7 +790,7 @@ namespace CalculatorUnitTests
|
||||||
VERIFY_ARE_EQUAL((int)viewModel->MemorizedNumbers->Size, 2);
|
VERIFY_ARE_EQUAL((int)viewModel->MemorizedNumbers->Size, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//when memory list is empty and M+ is pressed
|
// When memory list is empty and M+ is pressed
|
||||||
TEST_METHOD(OnMemoryAddWhenMemoryEmpty)
|
TEST_METHOD(OnMemoryAddWhenMemoryEmpty)
|
||||||
{
|
{
|
||||||
m_viewModel->IsStandard = true;
|
m_viewModel->IsStandard = true;
|
||||||
|
@ -808,7 +808,7 @@ namespace CalculatorUnitTests
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//when memory list is empty and M- is pressed
|
// When memory list is empty and M- is pressed
|
||||||
TEST_METHOD(OnMemorySubtractWhenMemoryEmpty)
|
TEST_METHOD(OnMemorySubtractWhenMemoryEmpty)
|
||||||
{
|
{
|
||||||
m_viewModel->IsStandard = true;
|
m_viewModel->IsStandard = true;
|
||||||
|
@ -825,7 +825,7 @@ namespace CalculatorUnitTests
|
||||||
VERIFY_ARE_EQUAL(Platform::StringReference(L"-1,001"), m_viewModel->DisplayValue);
|
VERIFY_ARE_EQUAL(Platform::StringReference(L"-1,001"), m_viewModel->DisplayValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
//when negative number is saved in memory
|
// When negative number is saved in memory
|
||||||
TEST_METHOD(OnNegativeEntryInMemory)
|
TEST_METHOD(OnNegativeEntryInMemory)
|
||||||
{
|
{
|
||||||
ChangeMode(m_viewModel, 0/*Standard*/);
|
ChangeMode(m_viewModel, 0/*Standard*/);
|
||||||
|
@ -851,7 +851,7 @@ namespace CalculatorUnitTests
|
||||||
VERIFY_ARE_EQUAL(Platform::StringReference(L"-1,001"), Utils::GetStringValue(memorySlotProgrammer->Value));
|
VERIFY_ARE_EQUAL(Platform::StringReference(L"-1,001"), Utils::GetStringValue(memorySlotProgrammer->Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
//when decimal number is saved in memory
|
// When decimal number is saved in memory
|
||||||
TEST_METHOD(OnDecimalEntryInMemory)
|
TEST_METHOD(OnDecimalEntryInMemory)
|
||||||
{
|
{
|
||||||
ChangeMode(m_viewModel, 0/*Standard*/);
|
ChangeMode(m_viewModel, 0/*Standard*/);
|
||||||
|
@ -878,7 +878,7 @@ namespace CalculatorUnitTests
|
||||||
VERIFY_ARE_EQUAL(Platform::StringReference(L"1,001"), Utils::GetStringValue(memorySlotProgrammer->Value));
|
VERIFY_ARE_EQUAL(Platform::StringReference(L"1,001"), Utils::GetStringValue(memorySlotProgrammer->Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
//when negative decimal number is saved in memory
|
// When negative decimal number is saved in memory
|
||||||
TEST_METHOD(OnNegativeDecimalInMemory)
|
TEST_METHOD(OnNegativeDecimalInMemory)
|
||||||
{
|
{
|
||||||
m_viewModel->IsStandard = true;
|
m_viewModel->IsStandard = true;
|
||||||
|
@ -898,7 +898,7 @@ namespace CalculatorUnitTests
|
||||||
VERIFY_ARE_EQUAL(Platform::StringReference(L"-1,001.1"), m_viewModel->DisplayValue);
|
VERIFY_ARE_EQUAL(Platform::StringReference(L"-1,001.1"), m_viewModel->DisplayValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
//when decimal number is added to the memory
|
// When decimal number is added to the memory
|
||||||
TEST_METHOD(OnDecimalAddedToMemory)
|
TEST_METHOD(OnDecimalAddedToMemory)
|
||||||
{
|
{
|
||||||
m_viewModel->IsStandard = true;
|
m_viewModel->IsStandard = true;
|
||||||
|
@ -928,7 +928,7 @@ namespace CalculatorUnitTests
|
||||||
VERIFY_ARE_EQUAL(Platform::StringReference(L"2,002.1"), m_viewModel->DisplayValue);
|
VERIFY_ARE_EQUAL(Platform::StringReference(L"2,002.1"), m_viewModel->DisplayValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
//when memory is saved in programmer as Hex value and then we switch to standard mode, test to see that memory gets converted to decimal
|
// When memory is saved in programmer as Hex value and then we switch to standard mode, test to see that memory gets converted to decimal
|
||||||
TEST_METHOD(OnMemorySavedInHexRadixAndSwitchedToStandardMode)
|
TEST_METHOD(OnMemorySavedInHexRadixAndSwitchedToStandardMode)
|
||||||
{
|
{
|
||||||
ChangeMode(m_viewModel, 2/*programmer*/);
|
ChangeMode(m_viewModel, 2/*programmer*/);
|
||||||
|
@ -971,8 +971,8 @@ namespace CalculatorUnitTests
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//When memory button is pressed more than max number of slots allowed,
|
// When memory button is pressed more than max number of slots allowed,
|
||||||
//the MemorizedNumbers vector size should not increase.
|
// the MemorizedNumbers vector size should not increase.
|
||||||
TEST_METHOD(OnMemoryButtonPressedMaxTimes)
|
TEST_METHOD(OnMemoryButtonPressedMaxTimes)
|
||||||
{
|
{
|
||||||
StandardCalculatorViewModel^ viewModel = ref new StandardCalculatorViewModel();
|
StandardCalculatorViewModel^ viewModel = ref new StandardCalculatorViewModel();
|
||||||
|
@ -1014,7 +1014,7 @@ namespace CalculatorUnitTests
|
||||||
VERIFY_ARE_EQUAL(Platform::StringReference(L"1,001"), m_viewModel->DisplayValue);
|
VERIFY_ARE_EQUAL(Platform::StringReference(L"1,001"), m_viewModel->DisplayValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify nothing happens if there is no memory and the memory slot pressed action is taken
|
// Verify nothing happens if there is no memory and the memory slot pressed action is taken
|
||||||
TEST_METHOD(OnMemoryItemPressedNoMemory)
|
TEST_METHOD(OnMemoryItemPressedNoMemory)
|
||||||
{
|
{
|
||||||
TESTITEM items[] = {
|
TESTITEM items[] = {
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace UnitConverterUnitTests
|
||||||
SetConversionDataParams(&conversion4, 0.453592, 0, false);
|
SetConversionDataParams(&conversion4, 0.453592, 0, false);
|
||||||
SetConversionDataParams(&conversion5, 2.20462, 0, false);
|
SetConversionDataParams(&conversion5, 2.20462, 0, false);
|
||||||
|
|
||||||
//Setting the conversion ratios for testing
|
// Setting the conversion ratios for testing
|
||||||
unit1Map[u1] = conversion1;
|
unit1Map[u1] = conversion1;
|
||||||
unit1Map[u2] = conversion2;
|
unit1Map[u2] = conversion2;
|
||||||
|
|
||||||
|
|
|
@ -286,7 +286,7 @@ namespace CalculatorUnitTests
|
||||||
VM::UnitConverterViewModel^ vm = ref new UnitConverterViewModel(make_shared<UnitConversionManager::UnitConverter>(make_shared<UnitConverterDataLoader>(ref new GeographicRegion()), nullptr));
|
VM::UnitConverterViewModel^ vm = ref new UnitConverterViewModel(make_shared<UnitConversionManager::UnitConverter>(make_shared<UnitConverterDataLoader>(ref new GeographicRegion()), nullptr));
|
||||||
IObservableVector<Category^>^ categoryList = vm->Categories;
|
IObservableVector<Category^>^ categoryList = vm->Categories;
|
||||||
ResourceLoader^ m_resLoader = ResourceLoader::GetForViewIndependentUse("Test");
|
ResourceLoader^ m_resLoader = ResourceLoader::GetForViewIndependentUse("Test");
|
||||||
double epsilon = 0.1; //Could be more precise like 0.001 except atm to pascal conversion
|
double epsilon = 0.1; // Could be more precise like 0.001 except atm to pascal conversion
|
||||||
|
|
||||||
for (unsigned int k = 0; k < categoryList->Size; k++)
|
for (unsigned int k = 0; k < categoryList->Size; k++)
|
||||||
{
|
{
|
||||||
|
@ -302,7 +302,7 @@ namespace CalculatorUnitTests
|
||||||
vm->Value1Active = false;
|
vm->Value1Active = false;
|
||||||
vm->Unit2 = unitList->GetAt(j);
|
vm->Unit2 = unitList->GetAt(j);
|
||||||
wstring unit2Name = vm->Unit2->Name->Data();
|
wstring unit2Name = vm->Unit2->Name->Data();
|
||||||
//change value2 as 1.
|
// Change value2 as 1.
|
||||||
vm->ButtonPressed->Execute(NumbersAndOperatorsEnum::One);
|
vm->ButtonPressed->Execute(NumbersAndOperatorsEnum::One);
|
||||||
String^ expectedResult = m_resLoader->GetString(ref new String((unit1Name + L"-" + unit2Name).c_str()));
|
String^ expectedResult = m_resLoader->GetString(ref new String((unit1Name + L"-" + unit2Name).c_str()));
|
||||||
|
|
||||||
|
@ -315,10 +315,10 @@ namespace CalculatorUnitTests
|
||||||
double actualConversion = GetDoubleFromWstring(GetStringValue(vm->Value1)->Data());
|
double actualConversion = GetDoubleFromWstring(GetStringValue(vm->Value1)->Data());
|
||||||
double diff = abs(expectedConversion - actualConversion);
|
double diff = abs(expectedConversion - actualConversion);
|
||||||
|
|
||||||
// assert for diff less than epsilonth fraction of expected conversion result
|
// Assert for diff less than epsilonth fraction of expected conversion result
|
||||||
VERIFY_IS_LESS_THAN_OR_EQUAL(diff, epsilon*expectedConversion);
|
VERIFY_IS_LESS_THAN_OR_EQUAL(diff, epsilon*expectedConversion);
|
||||||
}
|
}
|
||||||
//clearing the value1
|
// Clearing the value1
|
||||||
vm->ButtonPressed->Execute(NumbersAndOperatorsEnum::Clear);
|
vm->ButtonPressed->Execute(NumbersAndOperatorsEnum::Clear);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ namespace CalculatorUnitTests
|
||||||
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
|
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
|
||||||
VM::UnitConverterViewModel vm(mock);
|
VM::UnitConverterViewModel vm(mock);
|
||||||
vm.Unit1 = vm.Units->GetAt(1); // Change from u4 to u5
|
vm.Unit1 = vm.Units->GetAt(1); // Change from u4 to u5
|
||||||
// count will be 2 here since it was already called once at init
|
// Count will be 2 here since it was already called once at init
|
||||||
VERIFY_ARE_EQUAL((UINT)2, mock->m_setCurUnitTypesCallCount);
|
VERIFY_ARE_EQUAL((UINT)2, mock->m_setCurUnitTypesCallCount);
|
||||||
VERIFY_IS_TRUE(UNIT5 == mock->m_curFrom);
|
VERIFY_IS_TRUE(UNIT5 == mock->m_curFrom);
|
||||||
VERIFY_IS_TRUE(UNIT6 == mock->m_curTo);
|
VERIFY_IS_TRUE(UNIT6 == mock->m_curTo);
|
||||||
|
@ -409,7 +409,7 @@ namespace CalculatorUnitTests
|
||||||
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
|
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
|
||||||
VM::UnitConverterViewModel vm(mock);
|
VM::UnitConverterViewModel vm(mock);
|
||||||
vm.CurrentCategory = vm.Categories->GetAt(2); // Change from cat1 to cat3
|
vm.CurrentCategory = vm.Categories->GetAt(2); // Change from cat1 to cat3
|
||||||
// counts will be 2 here since the first call should have happened during init
|
// Counts will be 2 here since the first call should have happened during init
|
||||||
VERIFY_IS_GREATER_THAN_OR_EQUAL(2u, mock->m_setCurrentCategoryCallCount);
|
VERIFY_IS_GREATER_THAN_OR_EQUAL(2u, mock->m_setCurrentCategoryCallCount);
|
||||||
VERIFY_ARE_EQUAL((UINT)3, vm.Units->Size);
|
VERIFY_ARE_EQUAL((UINT)3, vm.Units->Size);
|
||||||
VERIFY_IS_TRUE(UNIT7 == vm.Units->GetAt(0)->GetModelUnit());
|
VERIFY_IS_TRUE(UNIT7 == vm.Units->GetAt(0)->GetModelUnit());
|
||||||
|
@ -424,7 +424,7 @@ namespace CalculatorUnitTests
|
||||||
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
|
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
|
||||||
VM::UnitConverterViewModel vm(mock);
|
VM::UnitConverterViewModel vm(mock);
|
||||||
vm.CurrentCategory = vm.Categories->GetAt(2); // Change from cat1 to cat3
|
vm.CurrentCategory = vm.Categories->GetAt(2); // Change from cat1 to cat3
|
||||||
// counts will be 2 here since the first call should have happened during init
|
// Counts will be 2 here since the first call should have happened during init
|
||||||
VERIFY_IS_GREATER_THAN_OR_EQUAL(2u, mock->m_setCurrentCategoryCallCount);
|
VERIFY_IS_GREATER_THAN_OR_EQUAL(2u, mock->m_setCurrentCategoryCallCount);
|
||||||
VERIFY_IS_TRUE(UNIT9 == vm.Unit1->GetModelUnit());
|
VERIFY_IS_TRUE(UNIT9 == vm.Unit1->GetModelUnit());
|
||||||
VERIFY_IS_TRUE(UNIT7 == vm.Unit2->GetModelUnit());
|
VERIFY_IS_TRUE(UNIT7 == vm.Unit2->GetModelUnit());
|
||||||
|
|
|
@ -96,7 +96,7 @@ void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
|
||||||
(void) sender; // Unused parameter
|
(void) sender; // Unused parameter
|
||||||
(void) e; // Unused parameter
|
(void) e; // Unused parameter
|
||||||
|
|
||||||
//TODO: Save application state and stop any background activity
|
// TODO: Save application state and stop any background activity
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace StandardPeers = Windows::UI::Xaml::Automation::Peers;
|
||||||
namespace CalculatorApp::Common::Automation {}
|
namespace CalculatorApp::Common::Automation {}
|
||||||
namespace CustomPeers = CalculatorApp::Common::Automation;
|
namespace CustomPeers = CalculatorApp::Common::Automation;
|
||||||
|
|
||||||
//CalcManager Headers
|
// CalcManager Headers
|
||||||
#include "CalcManager/CalculatorVector.h"
|
#include "CalcManager/CalculatorVector.h"
|
||||||
#include "CalcManager/ExpressionCommand.h"
|
#include "CalcManager/ExpressionCommand.h"
|
||||||
#include "CalcManager/CalculatorResource.h"
|
#include "CalcManager/CalculatorResource.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue