mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
rename UnitConverter::Reset
This commit is contained in:
parent
ec534e43e9
commit
3b91e33ca1
2 changed files with 8 additions and 10 deletions
|
@ -64,7 +64,7 @@ UnitConverter::UnitConverter(_In_ const shared_ptr<IConverterDataLoader>& dataLo
|
||||||
unquoteConversions[L"{lb}"] = LEFTESCAPECHAR;
|
unquoteConversions[L"{lb}"] = LEFTESCAPECHAR;
|
||||||
unquoteConversions[L"{rb}"] = RIGHTESCAPECHAR;
|
unquoteConversions[L"{rb}"] = RIGHTESCAPECHAR;
|
||||||
ClearValues();
|
ClearValues();
|
||||||
Reset();
|
ResetCategoriesAndRatios();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnitConverter::Initialize()
|
void UnitConverter::Initialize()
|
||||||
|
@ -76,7 +76,7 @@ bool UnitConverter::CheckLoad()
|
||||||
{
|
{
|
||||||
if (m_categories.empty())
|
if (m_categories.empty())
|
||||||
{
|
{
|
||||||
Reset();
|
ResetCategoriesAndRatios();
|
||||||
}
|
}
|
||||||
return !m_categories.empty();
|
return !m_categories.empty();
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ wstring UnitConverter::Serialize()
|
||||||
/// <param name="serializedData">wstring holding the serialized data. If it does not have expected number of parameters, we will ignore it</param>
|
/// <param name="serializedData">wstring holding the serialized data. If it does not have expected number of parameters, we will ignore it</param>
|
||||||
void UnitConverter::DeSerialize(const wstring& serializedData)
|
void UnitConverter::DeSerialize(const wstring& serializedData)
|
||||||
{
|
{
|
||||||
Reset();
|
ResetCategoriesAndRatios();
|
||||||
|
|
||||||
if (serializedData.empty())
|
if (serializedData.empty())
|
||||||
{
|
{
|
||||||
|
@ -616,7 +616,7 @@ void UnitConverter::SendCommand(Command command)
|
||||||
clearFront = false;
|
clearFront = false;
|
||||||
clearBack = false;
|
clearBack = false;
|
||||||
ClearValues();
|
ClearValues();
|
||||||
Reset();
|
ResetCategoriesAndRatios();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -825,15 +825,13 @@ vector<tuple<wstring, Unit>> UnitConverter::CalculateSuggested()
|
||||||
returnVector.push_back(whimsicalReturnVector.at(0));
|
returnVector.push_back(whimsicalReturnVector.at(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
return returnVector;
|
return returnVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resets the converter to its initial state
|
/// Resets categories and ratios
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void UnitConverter::Reset()
|
void UnitConverter::ResetCategoriesAndRatios()
|
||||||
{
|
{
|
||||||
m_categories = m_dataLoader->LoadOrderedCategories();
|
m_categories = m_dataLoader->LoadOrderedCategories();
|
||||||
|
|
||||||
|
@ -1088,7 +1086,7 @@ void UnitConverter::UpdateViewModel()
|
||||||
|
|
||||||
void UnitConverter::ResetCategoriesAndRatio()
|
void UnitConverter::ResetCategoriesAndRatio()
|
||||||
{
|
{
|
||||||
Reset();
|
ResetCategoriesAndRatios();
|
||||||
Calculate();
|
Calculate();
|
||||||
UpdateViewModel();
|
UpdateViewModel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,7 @@ namespace UnitConversionManager
|
||||||
bool CheckLoad();
|
bool CheckLoad();
|
||||||
double Convert(double value, ConversionData conversionData);
|
double Convert(double value, ConversionData conversionData);
|
||||||
std::vector<std::tuple<std::wstring, Unit>> CalculateSuggested();
|
std::vector<std::tuple<std::wstring, Unit>> CalculateSuggested();
|
||||||
void Reset();
|
void ResetCategoriesAndRatios();
|
||||||
void ClearValues();
|
void ClearValues();
|
||||||
void Calculate();
|
void Calculate();
|
||||||
void TrimString(std::wstring& input);
|
void TrimString(std::wstring& input);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue