Window Store 彈窗評星API C++版

lee_鹿遊原發表於2018-03-16

1. 參考文章

官方文件

2.C++/CX程式碼片

我用的是c++,官方文件介紹的是c#的程式碼。

Windows::ApplicationModel::Core::CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler([this]
    {   
        auto authTask = Concurrency::create_task(StoreRequestHelper::SendRequestAsync(StoreContext::GetDefault(), 16, ""));

        authTask.then([=](task<StoreSendRequestResult^>t)
        {
            StoreSendRequestResult^ result = t.get();
            if (!result->ExtendedError.Value)
            {
                auto jsonObject = JsonObject::Parse(result->Response);
                if (jsonObject->GetNamedString("status")->Equals("success")) 
                {
                    // The customer rated or reviewed the app.
                    //ok
                }
            }

            // There was an error with the request, or the customer chose not to
            // rate or review the app.

        });
    }));

相關文章