2020-08-18 01:00:56 +08:00
|
|
|
// Copyright (c) Microsoft Corporation
|
|
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
using System.Text.Json;
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
using Microsoft.PowerToys.Settings.Telemetry;
|
|
|
|
using Microsoft.PowerToys.Telemetry;
|
|
|
|
|
2020-10-23 00:45:48 +08:00
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Library
|
2020-08-18 01:00:56 +08:00
|
|
|
{
|
|
|
|
public class EnabledModules
|
|
|
|
{
|
|
|
|
public EnabledModules()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-05-06 02:44:54 +08:00
|
|
|
private bool fancyZones = true;
|
|
|
|
|
|
|
|
[JsonPropertyName("FancyZones")]
|
|
|
|
public bool FancyZones
|
2020-04-17 02:45:27 +08:00
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
get => fancyZones;
|
2020-05-06 02:44:54 +08:00
|
|
|
set
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
if (fancyZones != value)
|
2020-05-06 02:44:54 +08:00
|
|
|
{
|
|
|
|
LogTelemetryEvent(value);
|
2020-08-20 06:59:10 +08:00
|
|
|
fancyZones = value;
|
2020-05-06 02:44:54 +08:00
|
|
|
}
|
|
|
|
}
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
|
2020-05-06 02:44:54 +08:00
|
|
|
private bool imageResizer = true;
|
2020-04-17 02:45:27 +08:00
|
|
|
|
2020-04-27 08:34:03 +08:00
|
|
|
[JsonPropertyName("Image Resizer")]
|
2020-05-06 02:44:54 +08:00
|
|
|
public bool ImageResizer
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
get => imageResizer;
|
2020-05-06 02:44:54 +08:00
|
|
|
set
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
if (imageResizer != value)
|
2020-05-06 02:44:54 +08:00
|
|
|
{
|
|
|
|
LogTelemetryEvent(value);
|
2020-08-20 06:59:10 +08:00
|
|
|
imageResizer = value;
|
2020-05-06 02:44:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private bool fileExplorerPreview = true;
|
2020-04-17 02:45:27 +08:00
|
|
|
|
|
|
|
[JsonPropertyName("File Explorer Preview")]
|
2020-05-06 02:44:54 +08:00
|
|
|
public bool FileExplorerPreview
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
get => fileExplorerPreview;
|
2020-05-06 02:44:54 +08:00
|
|
|
set
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
if (fileExplorerPreview != value)
|
2020-05-06 02:44:54 +08:00
|
|
|
{
|
|
|
|
LogTelemetryEvent(value);
|
2020-08-20 06:59:10 +08:00
|
|
|
fileExplorerPreview = value;
|
2020-05-06 02:44:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private bool shortcutGuide = true;
|
2020-04-17 02:45:27 +08:00
|
|
|
|
|
|
|
[JsonPropertyName("Shortcut Guide")]
|
2020-05-06 02:44:54 +08:00
|
|
|
public bool ShortcutGuide
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
get => shortcutGuide;
|
2020-05-06 02:44:54 +08:00
|
|
|
set
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
if (shortcutGuide != value)
|
2020-05-06 02:44:54 +08:00
|
|
|
{
|
|
|
|
LogTelemetryEvent(value);
|
2020-08-20 06:59:10 +08:00
|
|
|
shortcutGuide = value;
|
2020-05-06 02:44:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-17 02:45:27 +08:00
|
|
|
|
2020-05-06 02:44:54 +08:00
|
|
|
private bool powerRename = true;
|
2020-04-20 21:03:26 +08:00
|
|
|
|
2020-05-06 02:44:54 +08:00
|
|
|
public bool PowerRename
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
get => powerRename;
|
2020-05-06 02:44:54 +08:00
|
|
|
set
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
if (powerRename != value)
|
2020-05-06 02:44:54 +08:00
|
|
|
{
|
|
|
|
LogTelemetryEvent(value);
|
2020-08-20 06:59:10 +08:00
|
|
|
powerRename = value;
|
2020-05-06 02:44:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-23 05:55:45 +08:00
|
|
|
|
2020-05-06 02:44:54 +08:00
|
|
|
private bool keyboardManager = true;
|
2020-08-18 01:00:56 +08:00
|
|
|
|
2020-05-06 02:44:54 +08:00
|
|
|
[JsonPropertyName("Keyboard Manager")]
|
|
|
|
public bool KeyboardManager
|
2020-04-20 21:03:26 +08:00
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
get => keyboardManager;
|
2020-05-06 02:44:54 +08:00
|
|
|
set
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
if (keyboardManager != value)
|
2020-05-06 02:44:54 +08:00
|
|
|
{
|
|
|
|
LogTelemetryEvent(value);
|
2020-08-20 06:59:10 +08:00
|
|
|
keyboardManager = value;
|
2020-05-06 02:44:54 +08:00
|
|
|
}
|
|
|
|
}
|
2020-04-20 21:03:26 +08:00
|
|
|
}
|
2020-05-06 02:44:54 +08:00
|
|
|
|
|
|
|
private bool powerLauncher = true;
|
|
|
|
|
2020-07-19 03:27:36 +08:00
|
|
|
[JsonPropertyName("PowerToys Run")]
|
2020-05-06 02:44:54 +08:00
|
|
|
public bool PowerLauncher
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
get => powerLauncher;
|
2020-05-06 02:44:54 +08:00
|
|
|
set
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
if (powerLauncher != value)
|
2020-05-06 02:44:54 +08:00
|
|
|
{
|
|
|
|
LogTelemetryEvent(value);
|
2020-08-20 06:59:10 +08:00
|
|
|
powerLauncher = value;
|
2020-05-06 02:44:54 +08:00
|
|
|
}
|
2020-08-18 01:00:56 +08:00
|
|
|
}
|
2020-07-19 03:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private bool colorPicker = true;
|
|
|
|
|
|
|
|
[JsonPropertyName("ColorPicker")]
|
2020-08-18 01:00:56 +08:00
|
|
|
public bool ColorPicker
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
get => colorPicker;
|
2020-08-18 01:00:56 +08:00
|
|
|
set
|
|
|
|
{
|
2020-08-20 06:59:10 +08:00
|
|
|
if (colorPicker != value)
|
2020-08-18 01:00:56 +08:00
|
|
|
{
|
|
|
|
LogTelemetryEvent(value);
|
2020-08-20 06:59:10 +08:00
|
|
|
colorPicker = value;
|
2020-08-18 01:00:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public string ToJsonString()
|
|
|
|
{
|
|
|
|
return JsonSerializer.Serialize(this);
|
|
|
|
}
|
|
|
|
|
2020-10-10 08:58:52 +08:00
|
|
|
private static void LogTelemetryEvent(bool value, [CallerMemberName] string moduleName = null)
|
2020-08-18 01:00:56 +08:00
|
|
|
{
|
|
|
|
var dataEvent = new SettingsEnabledEvent()
|
|
|
|
{
|
|
|
|
Value = value,
|
|
|
|
Name = moduleName,
|
|
|
|
};
|
|
|
|
PowerToysTelemetry.Log.WriteEvent(dataEvent);
|
2020-07-19 03:27:36 +08:00
|
|
|
}
|
2020-08-18 01:00:56 +08:00
|
|
|
}
|
|
|
|
}
|