DiagnosticsSettings DiagnosticsSettings DiagnosticsSettings DiagnosticsSettings Class

Definition

Provides properties and methods to access the user's diagnostics settings.

public : sealed class DiagnosticsSettings : IDiagnosticsSettingspublic sealed class DiagnosticsSettings : IDiagnosticsSettingsPublic NotInheritable Class DiagnosticsSettings Implements IDiagnosticsSettings// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Remarks

Diagnostics settings are per user and per device.

Call GetForUser if your app supports multiple users. Call GetDefault if your app supports a single user.

Properties

CanUseDiagnosticsToTailorExperiences CanUseDiagnosticsToTailorExperiences CanUseDiagnosticsToTailorExperiences CanUseDiagnosticsToTailorExperiences

Gets a value that indicates whether the user has turned on access to diagnostic data for tailored experiences in the Windows Feedback & diagnostics settings.

public : PlatForm::Boolean CanUseDiagnosticsToTailorExperiences { get; }public bool CanUseDiagnosticsToTailorExperiences { get; }Public ReadOnly Property CanUseDiagnosticsToTailorExperiences As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

true if access to diagnostic data is turned on; otherwise, false.

User User User User

Gets the User associated with this instance of diagnostics settings.

public : User User { get; }public User User { get; }Public ReadOnly Property User As User// You can use this property in JavaScript.
Value
User User User User

The user associated with this instance of diagnostics settings.

Methods

GetDefault() GetDefault() GetDefault() GetDefault()

Retrieves the default diagnostics settings.

public : static DiagnosticsSettings GetDefault()public static DiagnosticsSettings GetDefault()Public Static Function GetDefault() As DiagnosticsSettings// You can use this method in JavaScript.
Returns

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

Examples

// From within a single user environment.
Windows.System.UserProfile.DiagnosticsSettings defaultUser =

    Windows.System.UserProfile.DiagnosticsSettings.GetDefault();



System.Diagnostics.Debug.WriteLine("Current user tailored experiences enabled: " +

    defaultUser.CanUseDiagnosticsToTailorExperiences.ToString());

GetForUser(User) GetForUser(User) GetForUser(User) GetForUser(User)

Retrieves the diagnostics settings for the specified user.

public : static DiagnosticsSettings GetForUser(User user)public static DiagnosticsSettings GetForUser(User user)Public Static Function GetForUser(user As User) As DiagnosticsSettings// You can use this method in JavaScript.
Parameters
user
User User 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());

}