Revert "Replace wstring used in public methods by Platform::String in CalcViewModel (#758)" (#767)

This reverts commit 93f1f784bb.
This commit is contained in:
Rudy Huyn 2019-11-04 17:54:12 -08:00 committed by Matt Cooley
commit 049d3f4c6c
35 changed files with 533 additions and 509 deletions

View file

@ -40,6 +40,8 @@ using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
using namespace Windows::UI::ViewManagement;
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
// Calculate number of 100-nanosecond intervals in 500 milliseconds.
// There are 10,000 intervals in 1 ms.
static const long long DURATION_500_MS = 10000 * 500;
@ -64,14 +66,14 @@ UnitConverter::UnitConverter()
m_isAnimationEnabled = userSettings->AnimationsEnabled;
auto resLoader = AppResourceProvider::GetInstance();
m_chargesMayApplyText = resLoader->GetResourceString(L"DataChargesMayApply");
m_failedToRefreshText = resLoader->GetResourceString(L"FailedToRefresh");
m_chargesMayApplyText = resLoader.GetResourceString(L"DataChargesMayApply");
m_failedToRefreshText = resLoader.GetResourceString(L"FailedToRefresh");
InitializeOfflineStatusTextBlock();
m_resultsFlyout = static_cast<MenuFlyout ^>(Resources->Lookup(L"CalculationResultContextMenu"));
CopyMenuItem->Text = resLoader->GetResourceString(L"copyMenuItem");
PasteMenuItem->Text = resLoader->GetResourceString(L"pasteMenuItem");
CopyMenuItem->Text = resLoader.GetResourceString(L"copyMenuItem");
PasteMenuItem->Text = resLoader.GetResourceString(L"pasteMenuItem");
}
void UnitConverter::OnPropertyChanged(_In_ Object ^ sender, _In_ PropertyChangedEventArgs ^ e)
@ -163,7 +165,7 @@ void UnitConverter::SetFailedToRefreshStatus()
void UnitConverter::InitializeOfflineStatusTextBlock()
{
auto resProvider = AppResourceProvider::GetInstance();
std::wstring offlineStatusHyperlinkText = resProvider->GetResourceString(L"OfflineStatusHyperlinkText")->Data();
std::wstring offlineStatusHyperlinkText = static_cast<String ^>(resProvider.GetResourceString(L"OfflineStatusHyperlinkText"))->Data();
// The resource string has the 'NetworkSettings' hyperlink wrapped with '%HL%'.
// Break the string and assign pieces appropriately.
@ -243,9 +245,9 @@ void UnitConverter::OnCopyMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEvent
void UnitConverter::OnPasteMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
{
auto that(this);
create_task(CopyPasteManager::GetStringToPaste(Model->Mode, CategoryGroupType::Converter, -1, BitLength::BitLengthUnknown))
.then([that](String ^ pastedString) { that->Model->OnPaste(pastedString); });
CopyPasteManager::GetStringToPaste(Model->Mode, CategoryGroupType::Converter).then([this](String ^ pastedString) {
Model->OnPaste(pastedString);
});
}
void UnitConverter::AnimateConverter()