mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-13 00:32:52 -07:00
ViewModelProperties namespaces converted to static member properties. (#306)
This commit is contained in:
parent
4b6b8fa8fa
commit
3bff99b323
15 changed files with 142 additions and 183 deletions
|
@ -30,40 +30,34 @@ constexpr int StandardModePrecision = 16;
|
|||
constexpr int ScientificModePrecision = 32;
|
||||
constexpr int ProgrammerModePrecision = 64;
|
||||
|
||||
namespace CalculatorApp::ViewModel
|
||||
namespace
|
||||
{
|
||||
namespace CalculatorViewModelProperties
|
||||
{
|
||||
StringReference IsMemoryEmpty(L"IsMemoryEmpty");
|
||||
StringReference IsScientific(L"IsScientific");
|
||||
StringReference IsStandard(L"IsStandard");
|
||||
StringReference IsProgrammer(L"IsProgrammer");
|
||||
StringReference DisplayValue(L"DisplayValue");
|
||||
StringReference IsInError(L"IsInError");
|
||||
StringReference BinaryDisplayValue(L"BinaryDisplayValue");
|
||||
StringReference OpenParenthesisCount(L"OpenParenthesisCount");
|
||||
}
|
||||
StringReference IsStandardPropertyName(L"IsStandard");
|
||||
StringReference IsScientificPropertyName(L"IsScientific");
|
||||
StringReference IsProgrammerPropertyName(L"IsProgrammer");
|
||||
StringReference DisplayValuePropertyName(L"DisplayValue");
|
||||
StringReference CalculationResultAutomationNamePropertyName(L"CalculationResultAutomationName");
|
||||
}
|
||||
|
||||
namespace CalculatorResourceKeys
|
||||
{
|
||||
StringReference CalculatorExpression(L"Format_CalculatorExpression");
|
||||
StringReference CalculatorResults(L"Format_CalculatorResults");
|
||||
StringReference CalculatorResults_DecimalSeparator_Announced(L"Format_CalculatorResults_Decimal");
|
||||
StringReference HexButton(L"Format_HexButtonValue");
|
||||
StringReference DecButton(L"Format_DecButtonValue");
|
||||
StringReference OctButton(L"Format_OctButtonValue");
|
||||
StringReference BinButton(L"Format_BinButtonValue");
|
||||
StringReference LeftParenthesisAutomationFormat(L"Format_OpenParenthesisAutomationNamePrefix");
|
||||
StringReference OpenParenthesisCountAutomationFormat(L"Format_OpenParenthesisCountAutomationNamePrefix");
|
||||
StringReference NoParenthesisAdded(L"NoRightParenthesisAdded_Announcement");
|
||||
StringReference MaxDigitsReachedFormat(L"Format_MaxDigitsReached");
|
||||
StringReference ButtonPressFeedbackFormat(L"Format_ButtonPressAuditoryFeedback");
|
||||
StringReference MemorySave(L"Format_MemorySave");
|
||||
StringReference MemoryItemChanged(L"Format_MemorySlotChanged");
|
||||
StringReference MemoryItemCleared(L"Format_MemorySlotCleared");
|
||||
StringReference MemoryCleared(L"Memory_Cleared");
|
||||
StringReference DisplayCopied(L"Display_Copied");
|
||||
}
|
||||
namespace CalculatorResourceKeys
|
||||
{
|
||||
StringReference CalculatorExpression(L"Format_CalculatorExpression");
|
||||
StringReference CalculatorResults(L"Format_CalculatorResults");
|
||||
StringReference CalculatorResults_DecimalSeparator_Announced(L"Format_CalculatorResults_Decimal");
|
||||
StringReference HexButton(L"Format_HexButtonValue");
|
||||
StringReference DecButton(L"Format_DecButtonValue");
|
||||
StringReference OctButton(L"Format_OctButtonValue");
|
||||
StringReference BinButton(L"Format_BinButtonValue");
|
||||
StringReference LeftParenthesisAutomationFormat(L"Format_OpenParenthesisAutomationNamePrefix");
|
||||
StringReference OpenParenthesisCountAutomationFormat(L"Format_OpenParenthesisCountAutomationNamePrefix");
|
||||
StringReference NoParenthesisAdded(L"NoRightParenthesisAdded_Announcement");
|
||||
StringReference MaxDigitsReachedFormat(L"Format_MaxDigitsReached");
|
||||
StringReference ButtonPressFeedbackFormat(L"Format_ButtonPressAuditoryFeedback");
|
||||
StringReference MemorySave(L"Format_MemorySave");
|
||||
StringReference MemoryItemChanged(L"Format_MemorySlotChanged");
|
||||
StringReference MemoryItemCleared(L"Format_MemorySlotCleared");
|
||||
StringReference MemoryCleared(L"Memory_Cleared");
|
||||
StringReference DisplayCopied(L"Display_Copied");
|
||||
}
|
||||
|
||||
StandardCalculatorViewModel::StandardCalculatorViewModel() :
|
||||
|
@ -1276,30 +1270,30 @@ void StandardCalculatorViewModel::Deserialize(Array<unsigned char>^ state)
|
|||
|
||||
void StandardCalculatorViewModel::OnPropertyChanged(String^ propertyname)
|
||||
{
|
||||
if (propertyname == CalculatorViewModelProperties::IsScientific)
|
||||
if (propertyname == IsScientificPropertyName)
|
||||
{
|
||||
if (IsScientific)
|
||||
{
|
||||
OnButtonPressed(NumbersAndOperatorsEnum::IsScientificMode);
|
||||
}
|
||||
}
|
||||
else if (propertyname == CalculatorViewModelProperties::IsProgrammer)
|
||||
else if (propertyname == IsProgrammerPropertyName)
|
||||
{
|
||||
if (IsProgrammer)
|
||||
{
|
||||
OnButtonPressed(NumbersAndOperatorsEnum::IsProgrammerMode);
|
||||
}
|
||||
}
|
||||
else if (propertyname == CalculatorViewModelProperties::IsStandard)
|
||||
else if (propertyname == IsStandardPropertyName)
|
||||
{
|
||||
if (IsStandard)
|
||||
{
|
||||
OnButtonPressed(NumbersAndOperatorsEnum::IsStandardMode);
|
||||
}
|
||||
}
|
||||
else if (propertyname == CalculatorViewModelProperties::DisplayValue)
|
||||
else if (propertyname == DisplayValuePropertyName)
|
||||
{
|
||||
RaisePropertyChanged(CalculationResultAutomationName_PropertyName);
|
||||
RaisePropertyChanged(CalculationResultAutomationNamePropertyName);
|
||||
Announcement = GetDisplayUpdatedNarratorAnnouncement();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue