Merge master into feature/GraphingCalculator branch (#585)
* Merge master into feature/GraphingCalculator branch
This commit is contained in:
@@ -13,30 +13,30 @@ namespace Numbers
|
||||
#ifdef _DEBUG
|
||||
// These class are to be consumed exclusively by Blend and the VS designer
|
||||
// with these classes Blend will be able to populate the controls
|
||||
// with the hardcoded strings so whoever is working on the UI can actually see how the app would look like
|
||||
// with the hardcoded strings so whoever is working on the UI can actually see how the app would look like
|
||||
// with semi-realistic data.
|
||||
// This data is to only be compiled in the debug build and it will not affect app functionality at all
|
||||
// This data is to only be compiled in the debug build and it will not affect app functionality at all
|
||||
// so it does not need to be tested. It will have to be kept in sync with UnitConverterViewModel though
|
||||
// to ensure that the design experience is correct.
|
||||
// This class's code is run in the designer process so the less code it has the better.
|
||||
// This class's code is run in the designer process so the less code it has the better.
|
||||
|
||||
|
||||
public ref class AppViewModel sealed: public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
public
|
||||
ref class AppViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
{
|
||||
public:
|
||||
AppViewModel() :
|
||||
m_IsStandardMode(true),
|
||||
m_IsScientificMode(false),
|
||||
m_IsConverterMode(false),
|
||||
m_CalculatorViewModel(ref new StandardCalculatorViewModel()),
|
||||
m_ConverterViewModel(ref new UnitConverterViewModel())
|
||||
{}
|
||||
|
||||
AppViewModel()
|
||||
: m_IsStandardMode(true)
|
||||
, m_IsScientificMode(false)
|
||||
, m_IsConverterMode(false)
|
||||
, m_CalculatorViewModel(ref new StandardCalculatorViewModel())
|
||||
, m_ConverterViewModel(ref new UnitConverterViewModel())
|
||||
{
|
||||
}
|
||||
|
||||
OBSERVABLE_OBJECT();
|
||||
|
||||
OBSERVABLE_PROPERTY_RW(StandardCalculatorViewModel^, CalculatorViewModel);
|
||||
OBSERVABLE_PROPERTY_RW(UnitConverterViewModel^, ConverterViewModel);
|
||||
OBSERVABLE_PROPERTY_RW(StandardCalculatorViewModel ^, CalculatorViewModel);
|
||||
OBSERVABLE_PROPERTY_RW(UnitConverterViewModel ^, ConverterViewModel);
|
||||
OBSERVABLE_PROPERTY_RW(bool, IsStandardMode);
|
||||
OBSERVABLE_PROPERTY_RW(bool, IsScientificMode);
|
||||
OBSERVABLE_PROPERTY_RW(bool, IsConverterMode);
|
||||
|
@@ -9,38 +9,40 @@ namespace Numbers
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
public ref class MemorySlot sealed: public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
public
|
||||
ref class MemorySlot sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
{
|
||||
public:
|
||||
MemorySlot(int slotPosition, Platform::String^ value) :
|
||||
m_SlotPosition(slotPosition),
|
||||
m_SlotValue(value)
|
||||
{}
|
||||
MemorySlot(int slotPosition, Platform::String ^ value)
|
||||
: m_SlotPosition(slotPosition)
|
||||
, m_SlotValue(value)
|
||||
{
|
||||
}
|
||||
|
||||
OBSERVABLE_OBJECT();
|
||||
OBSERVABLE_PROPERTY_RW(int, SlotPosition);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String^, SlotValue);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, SlotValue);
|
||||
};
|
||||
|
||||
// This class is to be consumed exclusively by Blend and the VS designer
|
||||
// with this class Blend will be able to populate the controls, the CalculationResults control for example,
|
||||
// with the hardcoded strings so whoever is working on the UI can actually see how the app would look like
|
||||
// with the hardcoded strings so whoever is working on the UI can actually see how the app would look like
|
||||
// with semi-realistic data.
|
||||
// This data is to only be compiled in the debug build and it will not affect app functionality at all
|
||||
// This data is to only be compiled in the debug build and it will not affect app functionality at all
|
||||
// so it does not need to be tested. It will have to be kept in sync with StandardCalculatorViewModel though
|
||||
// to ensure that the design experience is correct.
|
||||
// This class's code is run in the designer process so the less code it has the better.
|
||||
public ref class StandardCalculatorViewModel sealed: public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
// This class's code is run in the designer process so the less code it has the better.
|
||||
public
|
||||
ref class StandardCalculatorViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
{
|
||||
public:
|
||||
|
||||
StandardCalculatorViewModel():
|
||||
m_DisplayValue("1234569"),
|
||||
m_DisplayStringExpression("14560 x 1890"),
|
||||
m_DegreeButtonContent("Deg"),
|
||||
m_IsMemoryEmpty(false)
|
||||
StandardCalculatorViewModel()
|
||||
: m_DisplayValue("1234569")
|
||||
, m_DisplayStringExpression("14560 x 1890")
|
||||
, m_DegreeButtonContent("Deg")
|
||||
, m_IsMemoryEmpty(false)
|
||||
{
|
||||
m_MemorizedNumbers = ref new Platform::Collections::Vector<MemorySlot^>();
|
||||
m_MemorizedNumbers = ref new Platform::Collections::Vector<MemorySlot ^>();
|
||||
for (int i = 1000; i < 1100; i++)
|
||||
{
|
||||
wchar_t wzi[5];
|
||||
@@ -53,24 +55,22 @@ namespace Numbers
|
||||
|
||||
OBSERVABLE_OBJECT();
|
||||
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String^, DisplayValue);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String^, DisplayStringExpression);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String^, DegreeButtonContent);
|
||||
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IVector<MemorySlot^>^, MemorizedNumbers);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, DisplayValue);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, DisplayStringExpression);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, DegreeButtonContent);
|
||||
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IVector<MemorySlot ^> ^, MemorizedNumbers);
|
||||
OBSERVABLE_PROPERTY_RW(bool, IsMemoryEmpty);
|
||||
|
||||
OBSERVABLE_PROPERTY_RW(KeyboardButtonStates^, PressedButtons);
|
||||
OBSERVABLE_PROPERTY_RW(KeyboardButtonStates ^, PressedButtons);
|
||||
|
||||
COMMAND_FOR_METHOD(ButtonPressed, StandardCalculatorViewModel::OnButtonPressed);
|
||||
|
||||
private:
|
||||
|
||||
void OnButtonPressed(Platform::Object^ parameter)
|
||||
{ }
|
||||
|
||||
void OnButtonPressed(Platform::Object ^ parameter)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -10,86 +10,91 @@ namespace Numbers
|
||||
#ifdef _DEBUG
|
||||
// These class are to be consumed exclusively by Blend and the VS designer
|
||||
// with these classes Blend will be able to populate the controls
|
||||
// with the hardcoded strings so whoever is working on the UI can actually see how the app would look like
|
||||
// with the hardcoded strings so whoever is working on the UI can actually see how the app would look like
|
||||
// with semi-realistic data.
|
||||
// This data is to only be compiled in the debug build and it will not affect app functionality at all
|
||||
// This data is to only be compiled in the debug build and it will not affect app functionality at all
|
||||
// so it does not need to be tested. It will have to be kept in sync with UnitConverterViewModel though
|
||||
// to ensure that the design experience is correct.
|
||||
// This class's code is run in the designer process so the less code it has the better.
|
||||
// This class's code is run in the designer process so the less code it has the better.
|
||||
|
||||
|
||||
public ref class CategoryViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
public
|
||||
ref class CategoryViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
{
|
||||
public:
|
||||
CategoryViewModel(Platform::String^ name) :
|
||||
m_Name(name),
|
||||
m_NegateVisibility(Windows::UI::Xaml::Visibility::Collapsed)
|
||||
{}
|
||||
CategoryViewModel(Platform::String ^ name)
|
||||
: m_Name(name)
|
||||
, m_NegateVisibility(Windows::UI::Xaml::Visibility::Collapsed)
|
||||
{
|
||||
}
|
||||
|
||||
CategoryViewModel(Platform::String^ name, Windows::UI::Xaml::Visibility negateVisibility) :
|
||||
m_Name(name),
|
||||
m_NegateVisibility(negateVisibility)
|
||||
{}
|
||||
CategoryViewModel(Platform::String ^ name, Windows::UI::Xaml::Visibility negateVisibility)
|
||||
: m_Name(name)
|
||||
, m_NegateVisibility(negateVisibility)
|
||||
{
|
||||
}
|
||||
|
||||
OBSERVABLE_OBJECT();
|
||||
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String^, Name);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, Name);
|
||||
OBSERVABLE_PROPERTY_RW(Windows::UI::Xaml::Visibility, NegateVisibility);
|
||||
};
|
||||
|
||||
public ref class UnitViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
public
|
||||
ref class UnitViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
{
|
||||
public:
|
||||
UnitViewModel(Platform::String^ unit, Platform::String^ abbr) :
|
||||
m_Name(unit),
|
||||
m_Abbreviation(abbr)
|
||||
{}
|
||||
UnitViewModel(Platform::String ^ unit, Platform::String ^ abbr)
|
||||
: m_Name(unit)
|
||||
, m_Abbreviation(abbr)
|
||||
{
|
||||
}
|
||||
|
||||
OBSERVABLE_OBJECT();
|
||||
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String^, Name);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String^, Abbreviation);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, Name);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, Abbreviation);
|
||||
};
|
||||
|
||||
public ref class UnitConverterSupplementaryResultViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
public
|
||||
ref class UnitConverterSupplementaryResultViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
{
|
||||
public:
|
||||
UnitConverterSupplementaryResultViewModel(Platform::String^ value, Platform::String^ unit, Platform::String^ abbr) :
|
||||
m_Value(value)
|
||||
UnitConverterSupplementaryResultViewModel(Platform::String ^ value, Platform::String ^ unit, Platform::String ^ abbr)
|
||||
: m_Value(value)
|
||||
{
|
||||
m_Unit = ref new UnitViewModel(unit, abbr);
|
||||
}
|
||||
|
||||
OBSERVABLE_OBJECT();
|
||||
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String^, Value);
|
||||
OBSERVABLE_PROPERTY_RW(UnitViewModel^, Unit);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, Value);
|
||||
OBSERVABLE_PROPERTY_RW(UnitViewModel ^, Unit);
|
||||
};
|
||||
|
||||
public ref class UnitConverterViewModel sealed: public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
public
|
||||
ref class UnitConverterViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
{
|
||||
public:
|
||||
|
||||
UnitConverterViewModel():
|
||||
m_Value1("Åy24"),
|
||||
m_Value2("Åy183"),
|
||||
m_Value1Active(true),
|
||||
m_Value2Active(false)
|
||||
UnitConverterViewModel()
|
||||
: m_Value1("Åy24")
|
||||
, m_Value2("Åy183")
|
||||
, m_Value1Active(true)
|
||||
, m_Value2Active(false)
|
||||
{
|
||||
m_SupplementaryResults = ref new Platform::Collections::Vector<UnitConverterSupplementaryResultViewModel^>();
|
||||
m_SupplementaryResults = ref new Platform::Collections::Vector<UnitConverterSupplementaryResultViewModel ^>();
|
||||
m_SupplementaryResults->Append(ref new UnitConverterSupplementaryResultViewModel("128", "Kilograms", "Kgs"));
|
||||
m_SupplementaryResults->Append(ref new UnitConverterSupplementaryResultViewModel("42.55", "Liters", "ÅyL"));
|
||||
m_SupplementaryResults->Append(ref new UnitConverterSupplementaryResultViewModel("1.5e3", "Gallons", "G"));
|
||||
m_SupplementaryResults->Append(ref new UnitConverterSupplementaryResultViewModel("1929", "Gigabyte", "GB"));
|
||||
|
||||
m_Categories = ref new Platform::Collections::Vector<CategoryViewModel^>();
|
||||
m_Categories = ref new Platform::Collections::Vector<CategoryViewModel ^>();
|
||||
m_Categories->Append(ref new CategoryViewModel("Volume"));
|
||||
m_Categories->Append(ref new CategoryViewModel("Temperature", Windows::UI::Xaml::Visibility::Visible));
|
||||
m_CurrentCategory = ref new CategoryViewModel("ÅyTime");
|
||||
m_Categories->Append(m_CurrentCategory);
|
||||
m_Categories->Append(ref new CategoryViewModel("Speed"));
|
||||
|
||||
m_Units = ref new Platform::Collections::Vector<UnitViewModel^>();
|
||||
m_Units = ref new Platform::Collections::Vector<UnitViewModel ^>();
|
||||
m_Unit1 = ref new UnitViewModel("ÅySeconds", "S");
|
||||
m_Unit2 = ref new UnitViewModel("ÅyMinutes", "M");
|
||||
m_Units->Append(ref new UnitViewModel("Miliseconds", "MS"));
|
||||
@@ -100,19 +105,18 @@ namespace Numbers
|
||||
|
||||
OBSERVABLE_OBJECT();
|
||||
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String^, Value1);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String^, Value2);
|
||||
OBSERVABLE_PROPERTY_R(Windows::UI::Xaml::Interop::IBindableObservableVector^, Categories);
|
||||
OBSERVABLE_PROPERTY_RW(CategoryViewModel^, CurrentCategory);
|
||||
OBSERVABLE_PROPERTY_R(Windows::UI::Xaml::Interop::IBindableObservableVector^, Units);
|
||||
OBSERVABLE_PROPERTY_RW(UnitViewModel^, Unit1);
|
||||
OBSERVABLE_PROPERTY_RW(UnitViewModel^, Unit2);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, Value1);
|
||||
OBSERVABLE_PROPERTY_RW(Platform::String ^, Value2);
|
||||
OBSERVABLE_PROPERTY_R(Windows::UI::Xaml::Interop::IBindableObservableVector ^, Categories);
|
||||
OBSERVABLE_PROPERTY_RW(CategoryViewModel ^, CurrentCategory);
|
||||
OBSERVABLE_PROPERTY_R(Windows::UI::Xaml::Interop::IBindableObservableVector ^, Units);
|
||||
OBSERVABLE_PROPERTY_RW(UnitViewModel ^, Unit1);
|
||||
OBSERVABLE_PROPERTY_RW(UnitViewModel ^, Unit2);
|
||||
OBSERVABLE_PROPERTY_RW(bool, Value1Active);
|
||||
OBSERVABLE_PROPERTY_RW(bool, Value2Active);
|
||||
OBSERVABLE_PROPERTY_R(Windows::UI::Xaml::Interop::IBindableObservableVector^, SupplementaryResults);
|
||||
OBSERVABLE_PROPERTY_R(Windows::UI::Xaml::Interop::IBindableObservableVector ^, SupplementaryResults);
|
||||
};
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user