DiagnosticsSettings.GetForUser(User) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
检索指定用户的诊断设置。
public:
static DiagnosticsSettings ^ GetForUser(User ^ user);
static DiagnosticsSettings GetForUser(User const& user);
public static DiagnosticsSettings GetForUser(User user);
function getForUser(user)
Public Shared Function GetForUser (user As User) As DiagnosticsSettings
参数
- user
- User
要获取其设置的用户。
返回
包含用户当前诊断设置的设置对象。
示例
// From a multi-user environment.
// (This example queries for all users, but you presumably
// know the user you want to query in your app.)
Task<IReadOnlyList<Windows.System.User>> getUsersTask =
Windows.System.User.FindAllAsync().AsTask();
if (!getUsersTask.IsCompleted)
{
getUsersTask.Wait();
}
IEnumerable<Windows.System.User> users = getUsersTask.Result;
foreach(Windows.System.User user in users)
{
Windows.System.UserProfile.DiagnosticsSettings userSettings =
Windows.System.UserProfile.DiagnosticsSettings.GetForUser(user);
System.Diagnostics.Debug.WriteLine(user.NonRoamableId.ToString() +
" user tailored experiences enabled: " +
userSettings.CanUseDiagnosticsToTailorExperiences.ToString());
}