Change the initialization time of Radio button's isChecked

This commit is contained in:
Lee-WonJun 2020-07-21 23:49:53 +09:00
commit d1d5a6aef3
4 changed files with 32 additions and 16 deletions

View file

@ -346,13 +346,13 @@
<Flyout x:Name="BitShiftFlyout" <Flyout x:Name="BitShiftFlyout"
Windows10version1809:AreOpenCloseAnimationsEnabled="False" Windows10version1809:AreOpenCloseAnimationsEnabled="False"
FlyoutPresenterStyle="{ThemeResource OperatorPanelFlyoutStyle}" FlyoutPresenterStyle="{ThemeResource OperatorPanelFlyoutStyle}"
Placement="Bottom"> Placement="Bottom"
Opened="BitShiftFlyout_Opened">
<StackPanel MaxWidth="192" Padding="12"> <StackPanel MaxWidth="192" Padding="12">
<RadioButton x:Name="ArithmeticShiftButton" <RadioButton x:Name="ArithmeticShiftButton"
x:Uid="arithmeticShiftButton" x:Uid="arithmeticShiftButton"
AutomationProperties.AutomationId="arithmeticShiftButton" AutomationProperties.AutomationId="arithmeticShiftButton"
Checked="BitshiftFlyout_Checked" Checked="BitshiftFlyout_Checked"/>
IsChecked="True"/>
<RadioButton x:Name="LogicalShiftButton" <RadioButton x:Name="LogicalShiftButton"
x:Uid="logicalShiftButton" x:Uid="logicalShiftButton"
AutomationProperties.AutomationId="logicalShiftButton" AutomationProperties.AutomationId="logicalShiftButton"

View file

@ -38,6 +38,7 @@ void CalculatorProgrammerRadixOperators::LoadResourceStrings()
m_logicalShiftButtonContent = resProvider->GetResourceString(L"logicalShiftButtonSelected"); m_logicalShiftButtonContent = resProvider->GetResourceString(L"logicalShiftButtonSelected");
m_rotateCircularButtonContent = resProvider->GetResourceString(L"rotateCircularButtonSelected"); m_rotateCircularButtonContent = resProvider->GetResourceString(L"rotateCircularButtonSelected");
m_rotateCarryShiftButtonContent = resProvider->GetResourceString(L"rotateCarryShiftButtonSelected"); m_rotateCarryShiftButtonContent = resProvider->GetResourceString(L"rotateCarryShiftButtonSelected");
m_selectedShiftButtonContent = m_arithmeticShiftButtonContent;
} }
void CalculatorProgrammerRadixOperators::FlyoutButton_Clicked(_In_ Platform::Object ^ /*sender*/, _In_ Windows::UI::Xaml::RoutedEventArgs ^ /*e*/) void CalculatorProgrammerRadixOperators::FlyoutButton_Clicked(_In_ Platform::Object ^ /*sender*/, _In_ Windows::UI::Xaml::RoutedEventArgs ^ /*e*/)
@ -45,11 +46,6 @@ void CalculatorProgrammerRadixOperators::FlyoutButton_Clicked(_In_ Platform::Obj
this->BitwiseFlyout->Hide(); this->BitwiseFlyout->Hide();
} }
void CalculatorProgrammerRadixOperators::checkDefaultBitShift()
{
this->ArithmeticShiftButton->IsChecked = true;
}
void CalculatorProgrammerRadixOperators::BitshiftFlyout_Checked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e) void CalculatorProgrammerRadixOperators::BitshiftFlyout_Checked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
{ {
// Load deferred load buttons // Load deferred load buttons
@ -109,7 +105,12 @@ void CalculatorProgrammerRadixOperators::BitshiftFlyout_Checked(Platform::Object
announcementString = m_rotateCarryShiftButtonContent; announcementString = m_rotateCarryShiftButtonContent;
} }
this->BitShiftFlyout->Hide(); if (announcementString != m_selectedShiftButtonContent)
{
this->BitShiftFlyout->Hide();
m_selectedShiftButtonContent = announcementString;
}
Model->SetBitshiftRadioButtonCheckedAnnouncement(announcementString); Model->SetBitshiftRadioButtonCheckedAnnouncement(announcementString);
} }
@ -176,3 +177,23 @@ void CalculatorProgrammerRadixOperators::ClearButton_LostFocus(Object ^ sender,
ClearEntryButton->Focus(::FocusState::Programmatic); ClearEntryButton->Focus(::FocusState::Programmatic);
} }
} }
void CalculatorApp::CalculatorProgrammerRadixOperators::BitShiftFlyout_Opened(Platform::Object ^ sender, Platform::Object ^ e)
{
if (m_selectedShiftButtonContent == m_arithmeticShiftButtonContent)
{
ArithmeticShiftButton->IsChecked = true;
}
else if (m_selectedShiftButtonContent == m_logicalShiftButtonContent)
{
LogicalShiftButton->IsChecked = true;
}
else if (m_selectedShiftButtonContent == m_rotateCircularButtonContent)
{
RotateCircularButton->IsChecked = true;
}
else if (m_selectedShiftButtonContent == m_rotateCarryShiftButtonContent)
{
RotateCarryShiftButton->IsChecked = true;
}
}

View file

@ -30,8 +30,6 @@ namespace CalculatorApp
DEPENDENCY_PROPERTY_OWNER(CalculatorProgrammerRadixOperators); DEPENDENCY_PROPERTY_OWNER(CalculatorProgrammerRadixOperators);
void checkDefaultBitShift();
private: private:
void BitshiftFlyout_Checked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e); 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 FlyoutButton_Clicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
@ -42,6 +40,8 @@ namespace CalculatorApp
void OpenParenthesisButton_GotFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e); void OpenParenthesisButton_GotFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void ClearEntryButton_LostFocus(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); void ClearButton_LostFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
void BitShiftFlyout_Opened(Platform::Object ^ sender, Platform::Object ^ e);
Platform::String ^ m_selectedShiftButtonContent;
Platform::String ^ m_arithmeticShiftButtonContent; Platform::String ^ m_arithmeticShiftButtonContent;
Platform::String ^ m_logicalShiftButtonContent; Platform::String ^ m_logicalShiftButtonContent;
Platform::String ^ m_rotateCircularButtonContent; Platform::String ^ m_rotateCircularButtonContent;

View file

@ -71,11 +71,6 @@ void OperatorsPanel::EnsureProgrammerRadixOps()
{ {
this->FindName(L"ProgrammerRadixOperators"); this->FindName(L"ProgrammerRadixOperators");
} }
if (ProgrammerRadixOperators)
{
ProgrammerRadixOperators->checkDefaultBitShift();
}
} }
void OperatorsPanel::EnsureProgrammerBitFlipPanel() void OperatorsPanel::EnsureProgrammerBitFlipPanel()