IsolatedWindowsEnvironmentUserInfo.TryWaitForSignInWithProgressAsync 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
已弃用。 一个异步函数,它允许调用方等待环境登录过程完成,然后再继续。 此函数在等待登录时提供进度更新; TryWaitForSignInAsync 没有。
public:
virtual IAsyncOperationWithProgress<bool, IsolatedWindowsEnvironmentSignInProgress> ^ TryWaitForSignInWithProgressAsync() = TryWaitForSignInWithProgressAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperationWithProgress<bool, IsolatedWindowsEnvironmentSignInProgress> TryWaitForSignInWithProgressAsync();
/// [Windows.Foundation.Metadata.RemoteAsync]
/// [Windows.Foundation.Metadata.Deprecated("IsolatedWindowsEnvironmentUserInfo is deprecated and might not work on all platforms. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 327680, "Windows.Security.Isolation.IsolatedWindowsEnvironmentContract")]
IAsyncOperationWithProgress<bool, IsolatedWindowsEnvironmentSignInProgress> TryWaitForSignInWithProgressAsync();
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperationWithProgress<bool,IsolatedWindowsEnvironmentSignInProgress> TryWaitForSignInWithProgressAsync();
[Windows.Foundation.Metadata.RemoteAsync]
[Windows.Foundation.Metadata.Deprecated("IsolatedWindowsEnvironmentUserInfo is deprecated and might not work on all platforms. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 327680, "Windows.Security.Isolation.IsolatedWindowsEnvironmentContract")]
public IAsyncOperationWithProgress<bool,IsolatedWindowsEnvironmentSignInProgress> TryWaitForSignInWithProgressAsync();
function tryWaitForSignInWithProgressAsync()
Public Function TryWaitForSignInWithProgressAsync () As IAsyncOperationWithProgress(Of Boolean, IsolatedWindowsEnvironmentSignInProgress)
返回
IAsyncOperationWithProgress<Boolean,IsolatedWindowsEnvironmentSignInProgress>
IAsyncOperationWithProgress<bool,IsolatedWindowsEnvironmentSignInProgress>
异步操作,返回一个布尔值,指示登录是否成功,以及一个进度值,指示登录操作的当前进度。
- 属性
Windows 要求
| 设备系列 |
Windows 11 Insider Preview (在 10.0.23504.0 中引入)
|
| API contract |
Windows.Security.Isolation.IsolatedWindowsEnvironmentContract (在 v4.0 中引入)
|
示例
以下示例按 ID 获取独立环境,并尝试使用 TryWaitForSignInWithProgressAsync 登录,同时检查登录操作的进度。
void GetEnvironmentSignInInfo()
{
auto environment = IsolatedWindowsEnvironment::GetById(environmentId);
if (!environment)
{
LogMessage(L"Environment does not exist.");
return;
}
auto result = environment.GetUserInfo();
if (!result)
{
LogMessage(L"Failed to initialize GetUserInfo – verify that the environment exists.");
return;
}
auto operation = result.TryWaitForSignInWithProgressAsync();
operation.Progress([&](auto const&, IsolatedWindowsEnvironmentSignInProgress progress)
{
switch (progress)
{
case IsolatedWindowsEnvironmentSignInProgress::Connecting:
UpdateProgressDialogUI(L"Connecting to isolated environment.");
break;
case IsolatedWindowsEnvironmentSignInProgress::Connected:
UpdateProgressDialogUI(L"Established connection to isolated environment.");
break;
case IsolatedWindowsEnvironmentSignInProgress::Authenticating:
UpdateProgressDialogUI(L"Signing in to isolated environment.");
break;
case IsolatedWindowsEnvironmentSignInProgress::SettingUpAccount:
UpdateProgressDialogUI(L"Setting up user session.");
break;
case IsolatedWindowsEnvironmentSignInProgress::Finalizing:
UpdateProgressDialogUI(L"Configuring user session settings.");
break;
case IsolatedWindowsEnvironmentSignInProgress::Completed:
UpdateProgressDialogUI(L"Sign-in is complete.");
break;
default:
LogMessage(L"Encountered an unknown progress state, this is unexpected. Do not update UI dialog.\n");
}
});
}
注解
警告
这是一个已弃用的 API。