mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 06:13:14 -07:00
Modify how we manage Narrator with parenthesis and refactor right parenthesis
This commit is contained in:
parent
4603d387ae
commit
0a7a3fa6fe
16 changed files with 77 additions and 103 deletions
|
@ -83,7 +83,7 @@ void CCalcEngine::ClearTemporaryValues()
|
|||
m_bError = false;
|
||||
}
|
||||
|
||||
void CCalcEngine::ProcessCommand(WPARAM wParam)
|
||||
void CCalcEngine::ProcessCommand(WPARAM wParam, bool useNarrator)
|
||||
{
|
||||
if (wParam == IDC_SET_RESULT)
|
||||
{
|
||||
|
@ -91,10 +91,10 @@ void CCalcEngine::ProcessCommand(WPARAM wParam)
|
|||
m_bSetCalcState = true;
|
||||
}
|
||||
|
||||
ProcessCommandWorker(wParam);
|
||||
ProcessCommandWorker(wParam, useNarrator);
|
||||
}
|
||||
|
||||
void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
|
||||
void CCalcEngine::ProcessCommandWorker(WPARAM wParam, bool useNarrator)
|
||||
{
|
||||
INT nx, ni;
|
||||
|
||||
|
@ -397,7 +397,7 @@ void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
|
|||
cleared for CENTR */
|
||||
if (nullptr != m_pCalcDisplay)
|
||||
{
|
||||
m_pCalcDisplay->SetParenDisplayText(L"");
|
||||
m_pCalcDisplay->SetParenDisplayText(0, false);
|
||||
m_pCalcDisplay->SetExpressionDisplay(make_shared<CalculatorVector<pair<wstring, int>>>(), make_shared<CalculatorVector<shared_ptr<IExpressionCommand>>>());
|
||||
}
|
||||
|
||||
|
@ -440,7 +440,7 @@ void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
|
|||
}
|
||||
// automatic closing of all the parenthesis to get a meaningful result as well as ensure data integrity
|
||||
m_nTempCom = m_nLastCom; // Put back this last saved command to the prev state so ) can be handled properly
|
||||
ProcessCommand(IDC_CLOSEP);
|
||||
ProcessCommand(IDC_CLOSEP, useNarrator);
|
||||
m_nLastCom = m_nTempCom; // Actually this is IDC_CLOSEP
|
||||
m_nTempCom = (INT)wParam; // put back in the state where last op seen was IDC_CLOSEP, and current op is IDC_EQU
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
|
|||
// Set the "(=xx" indicator.
|
||||
if (nullptr != m_pCalcDisplay)
|
||||
{
|
||||
m_pCalcDisplay->SetParenDisplayText(m_openParenCount ? to_wstring(m_openParenCount) : L"");
|
||||
m_pCalcDisplay->SetParenDisplayText(m_openParenCount >= 0 ? (unsigned int)m_openParenCount : 0, useNarrator);
|
||||
}
|
||||
|
||||
if (!m_bError)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -111,9 +111,9 @@ namespace CalculationManager
|
|||
/// Callback from the engine
|
||||
/// </summary>
|
||||
/// <param name="parenthesisCount">string containing the parenthesis count</param>
|
||||
void CalculatorManager::SetParenDisplayText(const wstring& parenthesisCount)
|
||||
void CalculatorManager::SetParenDisplayText(_In_ unsigned int parenthesisCount, bool useNarrator)
|
||||
{
|
||||
m_displayCallback->SetParenDisplayText(parenthesisCount);
|
||||
m_displayCallback->SetParenDisplayText(parenthesisCount, useNarrator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -216,7 +216,7 @@ namespace CalculationManager
|
|||
/// Handle special commands such as mode change and combination of two commands.
|
||||
/// </summary>
|
||||
/// <param name="command">Enum Command</command>
|
||||
void CalculatorManager::SendCommand(_In_ Command command)
|
||||
void CalculatorManager::SendCommand(_In_ Command command, bool useNarrator)
|
||||
{
|
||||
// When the expression line is cleared, we save the current state, which includes,
|
||||
// primary display, memory, and degree mode
|
||||
|
@ -235,7 +235,7 @@ namespace CalculationManager
|
|||
this->SetProgrammerMode();
|
||||
break;
|
||||
default:
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(command));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(command), useNarrator);
|
||||
}
|
||||
|
||||
m_savedCommands.clear(); // Clear the previous command history
|
||||
|
@ -263,38 +263,38 @@ namespace CalculationManager
|
|||
switch (command)
|
||||
{
|
||||
case Command::CommandASIN:
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandSIN));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV), useNarrator);
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandSIN), useNarrator);
|
||||
break;
|
||||
case Command::CommandACOS:
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandCOS));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV), useNarrator);
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandCOS), useNarrator);
|
||||
break;
|
||||
case Command::CommandATAN:
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandTAN));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV), useNarrator);
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandTAN), useNarrator);
|
||||
break;
|
||||
case Command::CommandPOWE:
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandLN));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV), useNarrator);
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandLN), useNarrator);
|
||||
break;
|
||||
case Command::CommandASINH:
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandSINH));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV), useNarrator);
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandSINH), useNarrator);
|
||||
break;
|
||||
case Command::CommandACOSH:
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandCOSH));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV), useNarrator);
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandCOSH), useNarrator);
|
||||
break;
|
||||
case Command::CommandATANH:
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandTANH));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandINV), useNarrator);
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(Command::CommandTANH), useNarrator);
|
||||
break;
|
||||
case Command::CommandFE:
|
||||
m_isExponentialFormat = !m_isExponentialFormat;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(command));
|
||||
m_currentCalculatorEngine->ProcessCommand(static_cast<WPARAM>(command), useNarrator);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ 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 SetMemorizedNumbers(_In_ const std::vector<std::wstring>& memorizedNumbers) override;
|
||||
void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) override;
|
||||
void SetParenDisplayText(const std::wstring& parenthesisCount) override;
|
||||
void SetParenDisplayText(_In_ unsigned int parenthesisCount, bool useNarrator=true) override;
|
||||
void OnNoRightParenAdded() override;
|
||||
void DisplayPasteError();
|
||||
void MaxDigitsReached() override;
|
||||
|
@ -109,7 +109,7 @@ namespace CalculationManager
|
|||
void SetStandardMode();
|
||||
void SetScientificMode();
|
||||
void SetProgrammerMode();
|
||||
void SendCommand(_In_ Command command);
|
||||
void SendCommand(_In_ Command command, bool useNarrator=true);
|
||||
std::vector<unsigned char> SerializeCommands();
|
||||
void DeSerializeCommands(_In_ const std::vector<unsigned char>& serializedData);
|
||||
void SerializeMemory();
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace CalculatorUnitTests
|
|||
class CCalcEngine {
|
||||
public:
|
||||
CCalcEngine(bool fPrecedence, bool fIntegerMode, CalculationManager::IResourceProvider* const pResourceProvider, __in_opt ICalcDisplay *pCalcDisplay, __in_opt std::shared_ptr<IHistoryDisplay> pHistoryDisplay);
|
||||
void ProcessCommand(WPARAM wID);
|
||||
void ProcessCommand(WPARAM wID, bool useNarrator=true);
|
||||
void DisplayError (DWORD nError);
|
||||
std::unique_ptr<CalcEngine::Rational> PersistedMemObject();
|
||||
void PersistedMemObject(CalcEngine::Rational const& memObject);
|
||||
|
@ -127,7 +127,7 @@ private:
|
|||
wchar_t m_groupSeparator;
|
||||
|
||||
private:
|
||||
void ProcessCommandWorker(WPARAM wParam);
|
||||
void ProcessCommandWorker(WPARAM wParam, bool useNarrator = true);
|
||||
void HandleErrorCommand(WPARAM idc);
|
||||
void HandleMaxDigitsReached();
|
||||
void DisplayNum(void);
|
||||
|
|
|
@ -12,7 +12,7 @@ public:
|
|||
virtual void SetPrimaryDisplay(const std::wstring& pszText, bool isError) = 0;
|
||||
virtual void SetIsInError(bool isInError) = 0;
|
||||
virtual void SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const &tokens, _Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const &commands) = 0;
|
||||
virtual void SetParenDisplayText(const std::wstring& pszText) = 0;
|
||||
virtual void SetParenDisplayText(_In_ unsigned int count, _In_ bool useNarrator) = 0;
|
||||
virtual void OnNoRightParenAdded() = 0;
|
||||
virtual void MaxDigitsReached() = 0; // not an error but still need to inform UI layer.
|
||||
virtual void BinaryOperatorReceived() = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
// Implementation of the NarratorNotifier class.
|
||||
|
@ -6,7 +6,7 @@
|
|||
#include "pch.h"
|
||||
#include "NarratorNotifier.h"
|
||||
#include "NarratorAnnouncementHostFactory.h"
|
||||
|
||||
#include <iostream>
|
||||
using namespace CalculatorApp::Common::Automation;
|
||||
using namespace Platform;
|
||||
using namespace Windows::UI::Xaml;
|
||||
|
@ -26,6 +26,7 @@ void NarratorNotifier::Announce(NarratorAnnouncement^ announcement)
|
|||
&& m_announcementHost != nullptr)
|
||||
{
|
||||
m_announcementHost->Announce(announcement);
|
||||
OutputDebugString(announcement->Announcement->Data());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,13 +36,13 @@ void CalculatorDisplay::SetPrimaryDisplay(_In_ const wstring& displayStringValue
|
|||
}
|
||||
}
|
||||
|
||||
void CalculatorDisplay::SetParenDisplayText(_In_ const std::wstring& parenthesisCount)
|
||||
void CalculatorDisplay::SetParenDisplayText(_In_ unsigned int parenthesisCount, _In_ bool useNarrator)
|
||||
{
|
||||
if (m_callbackReference != nullptr)
|
||||
{
|
||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||
{
|
||||
calcVM->SetParenthesisCount(parenthesisCount);
|
||||
calcVM->SetParenthesisCount(parenthesisCount, useNarrator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ 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) override;
|
||||
void SetMemorizedNumbers(_In_ const std::vector<std::wstring>& memorizedNumbers) override;
|
||||
void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) override;
|
||||
void SetParenDisplayText(_In_ const std::wstring& parenthesisCount) override;
|
||||
void SetParenDisplayText(_In_ unsigned int parenthesisCount, _In_ bool useNarrator=true) override;
|
||||
void OnNoRightParenAdded() override;
|
||||
void MaxDigitsReached() override;
|
||||
void BinaryOperatorReceived() override;
|
||||
|
|
|
@ -91,7 +91,8 @@ StandardCalculatorViewModel::StandardCalculatorViewModel() :
|
|||
m_localizedMemoryItemClearedAutomationFormat(nullptr),
|
||||
m_localizedMemoryCleared(nullptr),
|
||||
m_localizedOpenParenthesisCountChangedAutomationFormat(nullptr),
|
||||
m_localizedNoRightParenthesisAddedFormat(nullptr)
|
||||
m_localizedNoRightParenthesisAddedFormat(nullptr),
|
||||
m_parenthesisCount(0)
|
||||
{
|
||||
WeakReference calculatorViewModel(this);
|
||||
m_calculatorDisplay.SetCallback(calculatorViewModel);
|
||||
|
@ -216,13 +217,19 @@ void StandardCalculatorViewModel::DisplayPasteError()
|
|||
m_standardCalculatorManager.DisplayPasteError();
|
||||
}
|
||||
|
||||
void StandardCalculatorViewModel::SetParenthesisCount(_In_ const wstring& parenthesisCount)
|
||||
void StandardCalculatorViewModel::SetParenthesisCount(_In_ unsigned int parenthesisCount, _In_ bool useNarrator)
|
||||
{
|
||||
if (IsProgrammer || IsScientific)
|
||||
{
|
||||
OpenParenthesisCount = ref new String(parenthesisCount.c_str());
|
||||
OpenParenthesisCount = ref new String(parenthesisCount == 0 ? L"" : to_wstring(parenthesisCount).c_str());
|
||||
RaisePropertyChanged("LeftParenthesisAutomationName");
|
||||
if (useNarrator && m_parenthesisCount > parenthesisCount)
|
||||
{
|
||||
//only narrate the number of parenthesis when the counter decreases.
|
||||
SetOpenParenthesisCountNarratorAnnouncement();
|
||||
}
|
||||
}
|
||||
m_parenthesisCount = parenthesisCount;
|
||||
}
|
||||
|
||||
void StandardCalculatorViewModel::SetOpenParenthesisCountNarratorAnnouncement()
|
||||
|
@ -859,7 +866,7 @@ void StandardCalculatorViewModel::OnPaste(String^ pastedString, ViewMode mode)
|
|||
{
|
||||
sentEquals = (mappedNumOp == NumbersAndOperatorsEnum::Equals);
|
||||
Command cmdenum = ConvertToOperatorsEnum(mappedNumOp);
|
||||
m_standardCalculatorManager.SendCommand(cmdenum);
|
||||
m_standardCalculatorManager.SendCommand(cmdenum, false);
|
||||
|
||||
// The CalcEngine state machine won't allow the negate command to be sent before any
|
||||
// other digits, so instead a flag is set and the command is sent after the first appropriate
|
||||
|
@ -869,7 +876,7 @@ void StandardCalculatorViewModel::OnPaste(String^ pastedString, ViewMode mode)
|
|||
if (canSendNegate)
|
||||
{
|
||||
Command cmdNegate = ConvertToOperatorsEnum(NumbersAndOperatorsEnum::Negate);
|
||||
m_standardCalculatorManager.SendCommand(cmdNegate);
|
||||
m_standardCalculatorManager.SendCommand(cmdNegate, false);
|
||||
}
|
||||
|
||||
// Can't send negate on a leading zero, so wait until the appropriate time to send it.
|
||||
|
@ -888,7 +895,7 @@ void StandardCalculatorViewModel::OnPaste(String^ pastedString, ViewMode mode)
|
|||
if (!(MapCharacterToButtonId(*it, canSendNegate) == NumbersAndOperatorsEnum::Add))
|
||||
{
|
||||
Command cmdNegate = ConvertToOperatorsEnum(NumbersAndOperatorsEnum::Negate);
|
||||
m_standardCalculatorManager.SendCommand(cmdNegate);
|
||||
m_standardCalculatorManager.SendCommand(cmdNegate, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -283,7 +283,7 @@ namespace CalculatorApp
|
|||
void SetTokens(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const &tokens);
|
||||
void SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const &tokens, _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_ unsigned int parenthesisCount, _In_ bool useNarrator=true);
|
||||
void SetOpenParenthesisCountNarratorAnnouncement();
|
||||
void OnNoRightParenAdded();
|
||||
void SetNoParenAddedNarratorAnnouncement();
|
||||
|
@ -352,6 +352,7 @@ namespace CalculatorApp
|
|||
bool m_operandUpdated;
|
||||
bool m_completeTextSelection;
|
||||
bool m_isLastOperationHistoryLoad;
|
||||
unsigned int m_parenthesisCount;
|
||||
Platform::String^ m_selectedExpressionLastData;
|
||||
Common::DisplayExpressionToken^ m_selectedExpressionToken;
|
||||
Platform::String^ m_leftParenthesisAutomationFormat;
|
||||
|
|
|
@ -35,12 +35,10 @@ CalculatorProgrammerRadixOperators::CalculatorProgrammerRadixOperators() :
|
|||
void CalculatorProgrammerRadixOperators::OnLoaded(Object^, RoutedEventArgs^)
|
||||
{
|
||||
m_progModeRadixChangeToken = Model->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)
|
||||
|
@ -99,11 +97,3 @@ void CalculatorProgrammerRadixOperators::IsErrorVisualState::set(bool value)
|
|||
NumberPad->IsErrorVisualState = m_isErrorVisualState;
|
||||
}
|
||||
}
|
||||
|
||||
void CalculatorProgrammerRadixOperators::OnViewModelPropertyChanged(Object^ sender, PropertyChangedEventArgs^ e)
|
||||
{
|
||||
if (e->PropertyName == StandardCalculatorViewModel::OpenParenthesisCountPropertyName && closeParenthesisButton->FocusState != ::FocusState::Unfocused)
|
||||
{
|
||||
Model->SetOpenParenthesisCountNarratorAnnouncement();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,10 +35,8 @@ namespace CalculatorApp
|
|||
void OnLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnUnloaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void ProgModeRadixChange();
|
||||
void OnViewModelPropertyChanged(Platform::Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs ^ e);
|
||||
|
||||
bool m_isErrorVisualState;
|
||||
Windows::Foundation::EventRegistrationToken m_progModeRadixChangeToken;
|
||||
Windows::Foundation::EventRegistrationToken m_propertyChangedToken;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
x:Name="ControlRoot"
|
||||
d:DesignHeight="400"
|
||||
d:DesignWidth="315"
|
||||
Loaded="OnLoaded"
|
||||
Unloaded="OnUnloaded"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<converters:BooleanNegationConverter x:Key="BooleanNegationConverter"/>
|
||||
|
|
|
@ -38,15 +38,6 @@ CalculatorScientificOperators::CalculatorScientificOperators()
|
|||
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*/)
|
||||
{
|
||||
IsWideLayout = false;
|
||||
|
@ -107,10 +98,3 @@ void CalculatorScientificOperators::SetOperatorRowVisibility()
|
|||
InvRow2->Visibility = invRowVis;
|
||||
}
|
||||
|
||||
void CalculatorScientificOperators::OnViewModelPropertyChanged(Object^ sender, PropertyChangedEventArgs^ e)
|
||||
{
|
||||
if (e->PropertyName == StandardCalculatorViewModel::OpenParenthesisCountPropertyName && closeParenthesisButton->FocusState != ::FocusState::Unfocused)
|
||||
{
|
||||
Model->SetOpenParenthesisCountNarratorAnnouncement();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,10 +41,5 @@ namespace CalculatorApp
|
|||
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 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;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace CalculatorManagerTest
|
|||
m_memorizedNumberStrings = numbers;
|
||||
}
|
||||
|
||||
void SetParenDisplayText(const std::wstring& parenthesisCount) override
|
||||
void SetParenDisplayText(unsigned int parenthesisCount, bool /*useNarrator*/) override
|
||||
{
|
||||
m_parenDisplay = parenthesisCount;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ namespace CalculatorManagerTest
|
|||
private:
|
||||
wstring m_primaryDisplay;
|
||||
wstring m_expression;
|
||||
wstring m_parenDisplay;
|
||||
unsigned int m_parenDisplay;
|
||||
bool m_isError;
|
||||
vector<wstring> m_memorizedNumberStrings;
|
||||
int m_maxDigitsCalledCount;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue