added OfflineLicensesChanged event

This commit is contained in:
Dale Stammen 2019-01-07 16:15:34 -08:00
Родитель ebc80dde85
Коммит d7124bbc31
2 изменённых файлов: 9 добавлений и 13 удалений

Просмотреть файл

@ -25,7 +25,7 @@ WindowsStoreImpl::~WindowsStoreImpl()
{ {
if (m_storeContext != nullptr) if (m_storeContext != nullptr)
{ {
//m_storeContext->OfflineLicensesChanged -= m_eventRegistrationToken; m_storeContext.OfflineLicensesChanged(m_eventRegistrationToken);
} }
} }
@ -36,7 +36,13 @@ WindowsStoreErrorType WindowsStoreImpl::Initialize(HWND hwnd, WindowsStoreCallba
m_hwnd = hwnd; m_hwnd = hwnd;
m_userData = userData; m_userData = userData;
m_storeContext = StoreContext::GetDefault(); m_storeContext = StoreContext::GetDefault();
//m_eventRegistrationToken = m_storeContext->OfflineLicensesChanged += ref new TypedEventHandler<StoreContext^, Platform::Object^>(std::bind(&WindowsStoreImpl::OfflineLicensesChanged, this, _1, _2)); m_eventRegistrationToken = m_storeContext.OfflineLicensesChanged([&](StoreContext sender, IInspectable args)
{
if (m_licenseChangedCallback != nullptr)
{
GetLicenseState(m_licenseChangedCallback, m_userData);
}
});
return result; return result;
} }
@ -154,15 +160,6 @@ IAsyncAction WindowsStoreImpl::GetPrice(WindowsStoreCallback callback, void* use
co_return; co_return;
} }
#if 0
void WindowsStoreImpl::OfflineLicensesChanged(StoreContext^ sender, Platform::Object^ args)
{
if (m_licenseChangedCallback != nullptr)
{
GetLicenseState(m_licenseChangedCallback, m_userData);
}
}
#endif

Просмотреть файл

@ -22,9 +22,8 @@ namespace WinRT
winrt::Windows::Foundation::IAsyncAction GetPrice(WindowsStoreCallback callback, void* userData); winrt::Windows::Foundation::IAsyncAction GetPrice(WindowsStoreCallback callback, void* userData);
private: private:
void OfflineLicensesChanged(winrt::Windows::Services::Store::StoreContext sender, winrt::Windows::Foundation::IInspectable args);
winrt::Windows::Services::Store::StoreContext m_storeContext; winrt::Windows::Services::Store::StoreContext m_storeContext;
//Windows::Foundation::EventRegistrationToken m_eventRegistrationToken; winrt::event_token m_eventRegistrationToken;
WindowsStoreCallback m_licenseChangedCallback; WindowsStoreCallback m_licenseChangedCallback;
void* m_userData; void* m_userData;
HWND m_hwnd; HWND m_hwnd;