次の方法で共有


XUserResolveIssueWithUiResult

XUserResolveIssueWithUiAsync の呼び出しの結果を取得します。

構文

HRESULT XUserResolveIssueWithUiResult(  
         XAsyncBlock* async  
)  

パラメーター

async _Inout_
型: XAsyncBlock*

XUserResolveIssueWithUiAsync に渡した XAsyncBlock。

戻り値

型: HRESULT

正常に実行された場合は S_OK が返され、それ以外の場合はエラー コードが返されます。 エラー コードの一覧については、「エラー コード」を参照してください。

リターン コード 説明
S_OK 操作に成功しました
E_ABORT ユーザーが処理をキャンセルしました。

解説

XUsers API が E_GAMEUSER_RESOLVE_USER_ISSUE_REQUIRED エラーを返した場合、ユーザーはシステム ユーザー インターフェイス (UI) を操作して問題を解決する必要があります。 XUserResolveIssueWithUiAsync を呼び出して適切なシステム UI を表示します。

Unicode URL によってトークンの問題を解決するシステム ユーザー インターフェイスを表示するには、XUserResolveIssueWithUiUtf16Async を呼び出します。

XUserResolveIssueWithUiUtf16Async の呼び出しの結果を取得するには、XUserResolveIssueWithUiUtf16Result を呼び出します。

次の例は、システム UI を表示して、URL のトークンの問題を解決する方法を示しています。

HRESULT ResolveUserIssueComplete(XAsyncBlock* ab)
{
    if (SUCCEEDED_LOG(XUserResolveIssueWithUiResult(ab)))
    {
        appLog.AddLog("Successfully Resolved User Issue\n");
    }

    return S_OK;
}

HRESULT ResolveUserIssueUtf16Complete(XAsyncBlock* ab)
{
    if (SUCCEEDED_LOG(XUserResolveIssueWithUiUtf16Result(ab)))
    {
        appLog.AddLog("Successfully Resolved User Issue\n");
    }

    return S_OK;
}

HRESULT ResolveUserIssueWithUiAsync(
    XTaskQueueHandle queue,
    const char* narrowUrl = nullptr,
    const wchar_t* wideUrl = nullptr,
    bool useUtf16 = false)
{
    auto resolveAsyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(resolveAsyncBlock.get(), sizeof(*resolveAsyncBlock));
    resolveAsyncBlock->queue = queue;
    resolveAsyncBlock->context = this;

    if (useUtf16)
    {
        resolveAsyncBlock->callback = [](XAsyncBlock* ab)
        {
            auto asyncBlock = std::unique_ptr<XAsyncBlock>(ab);
            LOG_IF_FAILED(static_cast<User*>(ab->context)->ResolveUserIssueUtf16Complete(ab));
        };

        if (SUCCEEDED_LOG(XUserResolveIssueWithUiUtf16Async(
            _handle.get(),
            wideUrl,
            resolveAsyncBlock.get())))
        {
            // The call succeeded, so release the std::unique_ptr ownership of XAsyncBlock* since the callback will take over ownership.
            // If the call fails, the std::unique_ptr will keep ownership and delete the XAsyncBlock*
            resolveAsyncBlock.release();
        }
    }
    else
    {
        resolveAsyncBlock->callback = [](XAsyncBlock* ab)
        {
            auto asyncBlock = std::unique_ptr<XAsyncBlock>(ab);
            LOG_IF_FAILED(static_cast<User*>(ab->context)->ResolveUserIssueComplete(ab));
        };

        if (SUCCEEDED_LOG(XUserResolveIssueWithUiAsync(
            _handle.get(),
            narrowUrl,
            resolveAsyncBlock.get())))
        {
            // The call succeeded, so release the std::unique_ptr ownership of XAsyncBlock* since the callback will take over ownership.
            // If the call fails, the std::unique_ptr will keep ownership and delete the XAsyncBlock*
            resolveAsyncBlock.release();
        }
    }

    return S_OK;
}

要件

ヘッダー: XUser.h

ライブラリ: xgameruntime.lib

サポートされているプラットフォーム: Windows、Xbox One ファミリー本体、Xbox Series 本体

関連項目

XUser

XUserResolveIssueWithUiAsync

XUserResolveIssueWithUiUtf16Async

XUserResolveIssueWithUiUtf16Result