Resolution for Bit Shift radio button announcements (#1317)

This commit is contained in:
Vignesh M
2020-07-21 03:35:22 +05:30
committed by GitHub
parent ed7bfb8142
commit 264babc608
7 changed files with 72 additions and 22 deletions

View File

@@ -4727,4 +4727,20 @@
<value>Calculator back to full view</value>
<comment>Announcement to indicate calculator window is now back to full view.</comment>
</data>
<data name="arithmeticShiftButtonSelected" xml:space="preserve">
<value>Arithmetic Shift selected</value>
<comment>Label for a radio button that toggles arithmetic shift behavior for the shift operations.</comment>
</data>
<data name="logicalShiftButtonSelected" xml:space="preserve">
<value>Logical Shift selected</value>
<comment>Label for a radio button that toggles logical shift behavior for the shift operations.</comment>
</data>
<data name="rotateCircularButtonSelected" xml:space="preserve">
<value>Rotate Circular Shift selected</value>
<comment>Label for a radio button that toggles rotate circular behavior for the shift operations.</comment>
</data>
<data name="rotateCarryShiftButtonSelected" xml:space="preserve">
<value>Rotate Through Carry Circular Shift selected</value>
<comment>Label for a radio button that toggles rotate circular with carry behavior for the shift operations.</comment>
</data>
</root>

View File

@@ -11,6 +11,7 @@
#include "Controls/CalculatorButton.h"
#include "Converters/BooleanToVisibilityConverter.h"
#include "Views/NumberPad.xaml.h"
#include <CalcViewModel\Common\AppResourceProvider.h>
using namespace std;
using namespace CalculatorApp;
@@ -27,6 +28,16 @@ CalculatorProgrammerRadixOperators::CalculatorProgrammerRadixOperators()
: m_isErrorVisualState(false)
{
InitializeComponent();
LoadResourceStrings();
}
void CalculatorProgrammerRadixOperators::LoadResourceStrings()
{
auto resProvider = AppResourceProvider::GetInstance();
m_arithmeticShiftButtonContent = resProvider->GetResourceString(L"arithmeticShiftButtonSelected");
m_logicalShiftButtonContent = resProvider->GetResourceString(L"logicalShiftButtonSelected");
m_rotateCircularButtonContent = resProvider->GetResourceString(L"rotateCircularButtonSelected");
m_rotateCarryShiftButtonContent = resProvider->GetResourceString(L"rotateCarryShiftButtonSelected");
}
void CalculatorProgrammerRadixOperators::FlyoutButton_Clicked(_In_ Platform::Object ^ /*sender*/, _In_ Windows::UI::Xaml::RoutedEventArgs ^ /*e*/)
@@ -63,6 +74,7 @@ void CalculatorProgrammerRadixOperators::BitshiftFlyout_Checked(Platform::Object
CollapseBitshiftButtons();
auto radioButton = static_cast<RadioButton ^>(sender);
Platform::String ^ announcementString = L"";
if (radioButton == ArithmeticShiftButton)
{
@@ -70,6 +82,7 @@ void CalculatorProgrammerRadixOperators::BitshiftFlyout_Checked(Platform::Object
RshButton->Visibility = ::Visibility::Visible;
LshButton->IsEnabled = true;
RshButton->IsEnabled = true;
announcementString = m_arithmeticShiftButtonContent;
}
else if (radioButton == LogicalShiftButton)
{
@@ -77,6 +90,7 @@ void CalculatorProgrammerRadixOperators::BitshiftFlyout_Checked(Platform::Object
RshLogicalButton->Visibility = ::Visibility::Visible;
LshLogicalButton->IsEnabled = true;
RshLogicalButton->IsEnabled = true;
announcementString = m_logicalShiftButtonContent;
}
else if (radioButton == RotateCircularButton)
{
@@ -84,6 +98,7 @@ void CalculatorProgrammerRadixOperators::BitshiftFlyout_Checked(Platform::Object
RorButton->Visibility = ::Visibility::Visible;
RolButton->IsEnabled = true;
RorButton->IsEnabled = true;
announcementString = m_rotateCircularButtonContent;
}
else if (radioButton == RotateCarryShiftButton)
{
@@ -91,9 +106,11 @@ void CalculatorProgrammerRadixOperators::BitshiftFlyout_Checked(Platform::Object
RorCarryButton->Visibility = ::Visibility::Visible;
RolCarryButton->IsEnabled = true;
RorCarryButton->IsEnabled = true;
announcementString = m_rotateCarryShiftButtonContent;
}
this->BitShiftFlyout->Hide();
Model->SetBitshiftRadioButtonCheckedAnnouncement(announcementString);
}
void CalculatorProgrammerRadixOperators::CollapseBitshiftButtons()

View File

@@ -36,10 +36,15 @@ namespace CalculatorApp
void BitshiftFlyout_Checked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void FlyoutButton_Clicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
void CollapseBitshiftButtons();
void LoadResourceStrings();
bool m_isErrorVisualState;
void OpenParenthesisButton_GotFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void ClearEntryButton_LostFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void ClearButton_LostFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
Platform::String ^ m_arithmeticShiftButtonContent;
Platform::String ^ m_logicalShiftButtonContent;
Platform::String ^ m_rotateCircularButtonContent;
Platform::String ^ m_rotateCarryShiftButtonContent;
};
}