calculator/src/Calculator/Views/OperatorsPanel.xaml.cpp
Lee Won Jun 9206520121
Change the initialization time of Radio button's isChecked (#1312)
* Change the initialization time of Radio button's isChecked

* Rollback checkDefaultBitShift and Use Enum instead of String

* Fix Check Default
- In previous versions, there was an issue where button availability was reset when opening BitShift Flyout not when the mode is changed

* Reset Calculator Type in Calculator ViewModel when mode change to not Calculator mode

* Revert "Reset Calculator Type in Calculator ViewModel when mode change to not Calculator mode"

This reverts commit a0d2f84513bc2d36fea3d75445782e1c67bc2e8d.

* Check deferred load button
2020-08-20 15:30:48 -07:00

85 lines
2.1 KiB
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "pch.h"
#include "OperatorsPanel.xaml.h"
using namespace CalculatorApp;
using namespace CalculatorApp::ViewModel;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
using namespace CalculatorApp::Common;
using namespace CalculatorApp::Converters;
DEPENDENCY_PROPERTY_INITIALIZATION(OperatorsPanel, IsBitFlipChecked);
DEPENDENCY_PROPERTY_INITIALIZATION(OperatorsPanel, IsErrorVisualState);
OperatorsPanel::OperatorsPanel()
{
InitializeComponent();
}
StandardCalculatorViewModel ^ OperatorsPanel::Model::get()
{
return static_cast<CalculatorApp::ViewModel::StandardCalculatorViewModel ^>(this->DataContext);
}
void OperatorsPanel::OnIsBitFlipCheckedPropertyChanged(bool /*oldValue*/, bool newValue)
{
if (newValue)
{
EnsureProgrammerBitFlipPanel();
}
}
void OperatorsPanel::OnIsErrorVisualStatePropertyChanged(bool /*oldValue*/, bool newValue)
{
if (Model->IsStandard)
{
StandardOperators->IsErrorVisualState = newValue;
}
else if (Model->IsScientific)
{
ScientificOperators->IsErrorVisualState = newValue;
}
else if (Model->IsProgrammer)
{
ProgrammerRadixOperators->IsErrorVisualState = newValue;
}
}
void OperatorsPanel::EnsureScientificOps()
{
if (!ScientificOperators)
{
this->FindName(L"ScientificOperators");
}
}
void OperatorsPanel::EnsureProgrammerRadixOps()
{
if (!ProgrammerRadixOperators)
{
this->FindName(L"ProgrammerRadixOperators");
}
ProgrammerRadixOperators->checkDefaultBitShift();
}
void OperatorsPanel::EnsureProgrammerBitFlipPanel()
{
if (!BitFlipPanel)
{
this->FindName(L"BitFlipPanel");
}
}