mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 14:13:30 -07:00
Update UnitConverter implementations to use 'future' instead of 'task' when interfacing with the CalcManager
This commit is contained in:
parent
12032259fd
commit
fcb3ecbfcb
4 changed files with 9 additions and 9 deletions
|
@ -188,7 +188,7 @@ void CurrencyDataLoader::LoadData()
|
|||
{
|
||||
create_task([this]() -> task<bool>
|
||||
{
|
||||
vector<function<task<bool>()>> loadFunctions = {
|
||||
vector<function<future<bool>()>> loadFunctions = {
|
||||
[this]() { return TryLoadDataFromCacheAsync(); },
|
||||
[this]() { return TryLoadDataFromWebAsync(); },
|
||||
};
|
||||
|
@ -310,7 +310,7 @@ pair<wstring, wstring> CurrencyDataLoader::GetCurrencyRatioEquality(_In_ const U
|
|||
}
|
||||
|
||||
#pragma optimize("", off) // Turn off optimizations to work around DevDiv 393321
|
||||
task<bool> CurrencyDataLoader::TryLoadDataFromCacheAsync()
|
||||
future<bool> CurrencyDataLoader::TryLoadDataFromCacheAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -395,7 +395,7 @@ task<bool> CurrencyDataLoader::TryFinishLoadFromCacheAsync()
|
|||
co_return true;
|
||||
}
|
||||
|
||||
task<bool> CurrencyDataLoader::TryLoadDataFromWebAsync()
|
||||
future<bool> CurrencyDataLoader::TryLoadDataFromWebAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -480,7 +480,7 @@ task<bool> CurrencyDataLoader::TryLoadDataFromWebAsync()
|
|||
}
|
||||
}
|
||||
|
||||
task<bool> CurrencyDataLoader::TryLoadDataFromWebOverrideAsync()
|
||||
future<bool> CurrencyDataLoader::TryLoadDataFromWebOverrideAsync()
|
||||
{
|
||||
m_meteredOverrideSet = true;
|
||||
bool didLoad = co_await TryLoadDataFromWebAsync();
|
||||
|
|
|
@ -72,9 +72,9 @@ namespace CalculatorApp
|
|||
std::pair<std::wstring, std::wstring> GetCurrencyRatioEquality(_In_ const UnitConversionManager::Unit& unit1, _In_ const UnitConversionManager::Unit& unit2) override;
|
||||
std::wstring GetCurrencyTimestamp() override;
|
||||
|
||||
concurrency::task<bool> TryLoadDataFromCacheAsync() override;
|
||||
concurrency::task<bool> TryLoadDataFromWebAsync() override;
|
||||
concurrency::task<bool> TryLoadDataFromWebOverrideAsync() override;
|
||||
std::future<bool> TryLoadDataFromCacheAsync() override;
|
||||
std::future<bool> TryLoadDataFromWebAsync() override;
|
||||
std::future<bool> TryLoadDataFromWebOverrideAsync() override;
|
||||
// ICurrencyConverterDataLoader
|
||||
|
||||
void OnNetworkBehaviorChanged(CalculatorApp::NetworkAccessBehavior newBehavior);
|
||||
|
|
|
@ -727,7 +727,7 @@ void UnitConverterViewModel::RefreshCurrencyRatios()
|
|||
String^ announcement = AppResourceProvider::GetInstance().GetResourceString(UnitConverterResourceKeys::UpdatingCurrencyRates);
|
||||
Announcement = CalculatorAnnouncement::GetUpdateCurrencyRatesAnnouncement(announcement);
|
||||
|
||||
auto refreshTask = create_task(m_model->RefreshCurrencyRatios());
|
||||
auto refreshTask = create_task([this] { return m_model->RefreshCurrencyRatios().get(); });
|
||||
refreshTask.then([this](const pair<bool, wstring>& refreshResult)
|
||||
{
|
||||
bool didLoad = refreshResult.first;
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace CalculatorUnitTests
|
|||
void SendCommand(UCM::Command command) override;
|
||||
void SetViewModelCallback(const std::shared_ptr<UCM::IUnitConverterVMCallback>& newCallback) override;
|
||||
void SetViewModelCurrencyCallback(_In_ const std::shared_ptr<UCM::IViewModelCurrencyCallback>& /*newCallback*/) override {}
|
||||
concurrency::task<std::pair<bool, std::wstring>> RefreshCurrencyRatios() override
|
||||
std::future<std::pair<bool, std::wstring>> RefreshCurrencyRatios() override
|
||||
{
|
||||
co_return std::make_pair(L"", L"");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue