Check deferred load button

This commit is contained in:
Lee-WonJun 2020-08-20 20:22:37 +09:00
commit 0a08456d43
2 changed files with 26 additions and 5 deletions

View file

@ -47,7 +47,15 @@ void CalculatorProgrammerRadixOperators::FlyoutButton_Clicked(_In_ Platform::Obj
void CalculatorProgrammerRadixOperators::checkDefaultBitShift() void CalculatorProgrammerRadixOperators::checkDefaultBitShift()
{ {
LoadDeferredLoadButtons();
if (IsButtonLoaded())
{
return;
}
CollapseBitshiftButtons(); CollapseBitshiftButtons();
m_selectedShiftButtonMode = BitShiftMode::Arithmetic; m_selectedShiftButtonMode = BitShiftMode::Arithmetic;
LshButton->Visibility = ::Visibility::Visible; LshButton->Visibility = ::Visibility::Visible;
RshButton->Visibility = ::Visibility::Visible; RshButton->Visibility = ::Visibility::Visible;
@ -55,7 +63,15 @@ void CalculatorProgrammerRadixOperators::checkDefaultBitShift()
RshButton->IsEnabled = true; RshButton->IsEnabled = true;
} }
void CalculatorProgrammerRadixOperators::BitshiftFlyout_Checked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e) bool CalculatorApp::CalculatorProgrammerRadixOperators::IsButtonLoaded()
{
// Since arithmeticShiftButton defaults to IsChecked = true, this event an fire before we can load the deferred loaded controls. If that is the case, just
// return and do nothing.
return RolButton == nullptr || RorButton == nullptr || RolCarryButton == nullptr || RorCarryButton == nullptr || LshLogicalButton == nullptr
|| RshLogicalButton == nullptr;
}
void CalculatorApp::CalculatorProgrammerRadixOperators::LoadDeferredLoadButtons()
{ {
// Load deferred load buttons // Load deferred load buttons
if (RolButton == nullptr) if (RolButton == nullptr)
@ -67,11 +83,14 @@ void CalculatorProgrammerRadixOperators::BitshiftFlyout_Checked(Platform::Object
FindName("LshLogicalButton"); FindName("LshLogicalButton");
FindName("RshLogicalButton"); FindName("RshLogicalButton");
} }
}
// Since arithmeticShiftButton defaults to IsChecked = true, this event an fire before we can load the deferred loaded controls. If that is the case, just void CalculatorProgrammerRadixOperators::BitshiftFlyout_Checked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
// return and do nothing. {
if (RolButton == nullptr || RorButton == nullptr || RolCarryButton == nullptr || RorCarryButton == nullptr || LshLogicalButton == nullptr // Load deferred load buttons
|| RshLogicalButton == nullptr) LoadDeferredLoadButtons();
if (IsButtonLoaded())
{ {
return; return;
} }

View file

@ -44,6 +44,8 @@ namespace CalculatorApp
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);
void CollapseBitshiftButtons(); void CollapseBitshiftButtons();
void LoadResourceStrings(); void LoadResourceStrings();
void LoadDeferredLoadButtons();
bool IsButtonLoaded();
bool m_isErrorVisualState; bool m_isErrorVisualState;
void OpenParenthesisButton_GotFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e); void OpenParenthesisButton_GotFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);