diff --git a/src/CalcViewModel/ApplicationViewModel.cpp b/src/CalcViewModel/ApplicationViewModel.cpp index ee5f2fbb1..261f960ec 100644 --- a/src/CalcViewModel/ApplicationViewModel.cpp +++ b/src/CalcViewModel/ApplicationViewModel.cpp @@ -44,6 +44,7 @@ ApplicationViewModel::ApplicationViewModel() : m_CalculatorViewModel(nullptr) , m_DateCalcViewModel(nullptr) , m_GraphingCalcViewModel(nullptr) + , m_FinanceCalcViewModel(nullptr) , m_ConverterViewModel(nullptr) , m_PreviousMode(ViewMode::None) , m_mode(ViewMode::None) @@ -147,6 +148,13 @@ void ApplicationViewModel::OnModeChanged() m_DateCalcViewModel = ref new DateCalculatorViewModel(); } } + else if (NavCategory::IsFinanceCalculatorViewMode(m_mode)) + { + if (!m_FinanceCalcViewModel) + { + m_FinanceCalcViewModel = ref new FinanceCalculatorViewModel(); + } + } else if (NavCategory::IsConverterViewMode(m_mode)) { if (!m_ConverterViewModel) diff --git a/src/CalcViewModel/ApplicationViewModel.h b/src/CalcViewModel/ApplicationViewModel.h index 7e4238d8a..37b75c4c9 100644 --- a/src/CalcViewModel/ApplicationViewModel.h +++ b/src/CalcViewModel/ApplicationViewModel.h @@ -7,6 +7,7 @@ #include "DateCalculatorViewModel.h" #include "GraphingCalculator/GraphingCalculatorViewModel.h" #include "UnitConverterViewModel.h" +#include "FinanceCalculatorViewModel.h" namespace CalculatorApp { @@ -23,6 +24,7 @@ namespace CalculatorApp OBSERVABLE_PROPERTY_RW(StandardCalculatorViewModel ^, CalculatorViewModel); OBSERVABLE_PROPERTY_RW(DateCalculatorViewModel ^, DateCalcViewModel); OBSERVABLE_PROPERTY_RW(GraphingCalculatorViewModel ^, GraphingCalcViewModel); + OBSERVABLE_PROPERTY_RW(FinanceCalculatorViewModel ^, FinanceCalcViewModel); OBSERVABLE_PROPERTY_RW(UnitConverterViewModel ^, ConverterViewModel); OBSERVABLE_PROPERTY_RW(CalculatorApp::Common::ViewMode, PreviousMode); OBSERVABLE_PROPERTY_R(bool, IsAlwaysOnTop); diff --git a/src/CalcViewModel/CalcViewModel.vcxproj b/src/CalcViewModel/CalcViewModel.vcxproj index c2a69b5c0..aeaca88ec 100644 --- a/src/CalcViewModel/CalcViewModel.vcxproj +++ b/src/CalcViewModel/CalcViewModel.vcxproj @@ -322,6 +322,7 @@ + @@ -356,6 +357,7 @@ + @@ -405,6 +407,7 @@ + diff --git a/src/CalcViewModel/CalcViewModel.vcxproj.filters b/src/CalcViewModel/CalcViewModel.vcxproj.filters index b219806e5..da78cd0e6 100644 --- a/src/CalcViewModel/CalcViewModel.vcxproj.filters +++ b/src/CalcViewModel/CalcViewModel.vcxproj.filters @@ -86,6 +86,7 @@ GraphingCalculator + @@ -199,6 +200,7 @@ Common + diff --git a/src/CalcViewModel/Common/NavCategory.cpp b/src/CalcViewModel/Common/NavCategory.cpp index d5769aef8..bfa1c4b25 100644 --- a/src/CalcViewModel/Common/NavCategory.cpp +++ b/src/CalcViewModel/Common/NavCategory.cpp @@ -42,6 +42,7 @@ static constexpr int PRESSURE_ID = 14; static constexpr int ANGLE_ID = 15; static constexpr int CURRENCY_ID = 16; static constexpr int GRAPHING_ID = 17; +static constexpr int FINANCE_ID = 18; // ^^^ THESE CONSTANTS SHOULD NEVER CHANGE ^^^ wchar_t* towchar_t(int number) @@ -169,6 +170,16 @@ static const list s_categoryManifest = [] { towchar_t(currentIndex++), SUPPORTS_ALL, true }, + NavCategoryInitializer{ ViewMode::Finance, + FINANCE_ID, + L"Finance", + L"FinanceCalculationMode", + L"\uEB0D", + CategoryGroupType::Calculator, + supportGraphingCalculator ? MyVirtualKey::Number6 : MyVirtualKey::Number5, + towchar_t(currentIndex++), + SUPPORTS_ALL, + true }, NavCategoryInitializer{ ViewMode::Currency, CURRENCY_ID, L"Currency", @@ -366,6 +377,11 @@ bool NavCategory::IsDateCalculatorViewMode(ViewMode mode) return mode == ViewMode::Date; } +bool NavCategory::IsFinanceCalculatorViewMode(ViewMode mode) +{ + return mode == ViewMode::Finance; +} + bool NavCategory::IsConverterViewMode(ViewMode mode) { return IsModeInCategoryGroup(mode, CategoryGroupType::Converter); diff --git a/src/CalcViewModel/Common/NavCategory.h b/src/CalcViewModel/Common/NavCategory.h index a2edc9954..100b12459 100644 --- a/src/CalcViewModel/Common/NavCategory.h +++ b/src/CalcViewModel/Common/NavCategory.h @@ -45,7 +45,8 @@ namespace CalculatorApp Pressure = 14, Angle = 15, Currency = 16, - Graphing = 17 + Graphing = 17, + Finance = 18 }; public @@ -137,6 +138,7 @@ namespace CalculatorApp static bool IsCalculatorViewMode(ViewMode mode); static bool IsGraphingCalculatorViewMode(ViewMode mode); static bool IsDateCalculatorViewMode(ViewMode mode); + static bool IsFinanceCalculatorViewMode(ViewMode mode); static bool IsConverterViewMode(ViewMode mode); static Platform::String ^ GetFriendlyName(ViewMode mode); diff --git a/src/CalcViewModel/FinanceCalculatorViewModel.cpp b/src/CalcViewModel/FinanceCalculatorViewModel.cpp new file mode 100644 index 000000000..d0a0b4103 --- /dev/null +++ b/src/CalcViewModel/FinanceCalculatorViewModel.cpp @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#include "pch.h" +#include "FinanceCalculatorViewModel.h" + +using namespace CalculatorApp; +using namespace CalculatorApp::ViewModel; + +FinanceCalculatorViewModel::FinanceCalculatorViewModel() + : m_isCompoundMode(true) + , m_isSplitBill(false) +{ +} diff --git a/src/CalcViewModel/FinanceCalculatorViewModel.h b/src/CalcViewModel/FinanceCalculatorViewModel.h new file mode 100644 index 000000000..3bb59f01b --- /dev/null +++ b/src/CalcViewModel/FinanceCalculatorViewModel.h @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#pragma once + +#include "Common/Utils.h" + +namespace CalculatorApp +{ + namespace ViewModel + { + [Windows::UI::Xaml::Data::Bindable] public ref class FinanceCalculatorViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged + { + public: + + FinanceCalculatorViewModel(); + + OBSERVABLE_OBJECT(); + OBSERVABLE_PROPERTY_RW(bool, isCompoundMode); + OBSERVABLE_PROPERTY_RW(bool, isSplitBill); + }; + } +} diff --git a/src/Calculator/Calculator.vcxproj b/src/Calculator/Calculator.vcxproj index 4ac84f071..05084e54e 100644 --- a/src/Calculator/Calculator.vcxproj +++ b/src/Calculator/Calculator.vcxproj @@ -293,6 +293,9 @@ Views\CalculatorStandardOperators.xaml + + Views\FinanceCalculator.xaml + Views\GraphingCalculator\EquationInputArea.xaml @@ -367,6 +370,9 @@ + + Designer + @@ -461,6 +467,9 @@ Views\CalculatorStandardOperators.xaml + + Views\FinanceCalculator.xaml + Views\GraphingCalculator\EquationInputArea.xaml diff --git a/src/Calculator/Calculator.vcxproj.filters b/src/Calculator/Calculator.vcxproj.filters index 40a9a5cfe..9129b8bf7 100644 --- a/src/Calculator/Calculator.vcxproj.filters +++ b/src/Calculator/Calculator.vcxproj.filters @@ -524,6 +524,9 @@ Views\StateTriggers + + Views + diff --git a/src/Calculator/Resources/en-US/Resources.resw b/src/Calculator/Resources/en-US/Resources.resw index 308b59d0f..be2f55bdc 100644 --- a/src/Calculator/Resources/en-US/Resources.resw +++ b/src/Calculator/Resources/en-US/Resources.resw @@ -2732,7 +2732,7 @@ Preview Label displayed next to upcoming features - + Microsoft Privacy Statement Displayed on a link to the Microsoft Privacy Statement on the About panel @@ -2905,8 +2905,8 @@ Date Calculation - Calculation mode - Automation label for the Date Calculation Mode combobox. Users will hear "Calculation mode combobox". + Date Calculation mode + Automation label for the Date Calculation Mode combobox. Users will hear "Date Calculation mode combobox". Add @@ -3887,11 +3887,11 @@ Automatic Best Fit Announcement used in Graphing Calculator when graph view button is clicked and automatic best fit is set - + Manual Adjustment Announcement used in Graphing Calculator when graph view button is clicked and manual adjustment is set - + Graph view has been reset Announcement used in Graphing Calculator when graph view button is clicked and automatic best fit is set, resetting the graph @@ -4162,11 +4162,11 @@ The equation contains logical conditions that are mutually exclusive Error that occurs during graphing when mutually exclusive conditions are used. - + Equation is out of domain Error that occurs during graphing when the equation is out of domain. - + Graphing this equation is not supported Error that occurs during graphing when the equation is not supported. @@ -4209,19 +4209,19 @@ Invalid expression Error that occurs during graphing when an invalid syntax is used. - - + + The expression is empty Error that occurs during graphing when the expression is empty - + Equal was used without an equation Error that occurs during graphing when equal is used without an equation. Ex: sin(x=y) Parenthesis missing after function name Error that occurs during graphing when parenthesis are missing after a function. - + A mathematical operation has the incorrect number of parameters Error that occurs during graphing when a function has the wrong number of parameters @@ -4278,7 +4278,7 @@ Cannot use complex numbers in inequalities Error that occurs during graphing when complex numbers are used in inequalities. - + Back to function list This is the tooltip for the back button in the equation analysis page in the graphing calculator @@ -4338,7 +4338,7 @@ Hide equation This is the tooltip/automation name shown when visibility is set to visible in the graphing calculator. - + Show equation %1 {Locked="%1"}, This is the tooltip/automation name shown when visibility is set to hidden in the graphing calculator. %1 is the equation number. @@ -4346,7 +4346,6 @@ Hide equation %1 {Locked="%1"}, This is the tooltip/automation name shown when visibility is set to visible in the graphing calculator. %1 is the equation number. - Stop tracing This is the tooltip/automation name for the graphing calculator stop tracing button @@ -4358,7 +4357,7 @@ Graph viewing window, x-axis bounded by %1 and %2, y-axis bounded by %3 and %4, displaying %5 equations {Locked="%1","%2", "%3", "%4", "%5"}. - + Configure slider This is the tooltip text for the slider options button in Graphing Calculator @@ -4475,7 +4474,7 @@ Enter an expression this is the placeholder text used by the textbox to enter an equation - + Copy Copy menu item for the graph context menu @@ -4498,7 +4497,7 @@ Select All Select all menu item from the Equation TextBox - + Function Input List Item The automation name for the Equation Input ListView item that is shown when Calculator is in graphing mode. @@ -4615,19 +4614,19 @@ White Name of color in the color picker - + Color 1 Name of color in the color picker - + Color 2 Name of color in the color picker - + Color 3 Name of color in the color picker - + Color 4 Name of color in the color picker @@ -4691,7 +4690,7 @@ X Screen reader prompt for the X button on the graphing calculator operator keypad - + Y Screen reader prompt for the Y button on the graphing calculator operator keypad @@ -4715,4 +4714,58 @@ Memory list Automation name for the group of controls for memory list. - + + Financial + Name of the Financial Calculator mode. Displayed in the navigation menu. + + + Financial Calculation Mode + Screen reader prompt for the financial option combobox. + + + Compound Interest Calculation + "Compound Interest Calculator" option for combobox. + + + Tips Calculator + "Tips Calculator" option for combobox. + + + Base Rate ($) + + + Calculate + + + Calulate compound interest + + + Interest Rate (%) + + + Term (Years) + + + Future Value + + + Bill Amout ($) + + + Tips (%) + + + Compounded (per year) + + + $ + Currency symbol + + + Over + Over. Context used: in financial calculator, "Over {years}" + + + Total interest earned: + + \ No newline at end of file diff --git a/src/Calculator/Views/FinanceCalculator.xaml b/src/Calculator/Views/FinanceCalculator.xaml new file mode 100644 index 000000000..dbe843e6e --- /dev/null +++ b/src/Calculator/Views/FinanceCalculator.xaml @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +