Udostępnij za pośrednictwem


DiagnosticsSettings.GetForUser(User) Method

Definition

Retrieves the diagnostics settings for the specified user.

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

Parameters

user
User

The user to get settings for.

Returns

A settings object that contains the user's current diagnostics settings.

Examples

// 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());
}

Applies to