PowerDisplaySettings.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System.Collections.Generic; 6 using System.Text.Json.Serialization; 7 8 using ManagedCommon; 9 using Microsoft.PowerToys.Settings.UI.Library.Helpers; 10 using Microsoft.PowerToys.Settings.UI.Library.Interfaces; 11 12 namespace Microsoft.PowerToys.Settings.UI.Library 13 { 14 public class PowerDisplaySettings : BasePTModuleSettings, ISettingsConfig, IHotkeyConfig 15 { 16 public const string ModuleName = "PowerDisplay"; 17 18 [JsonPropertyName("properties")] 19 public PowerDisplayProperties Properties { get; set; } 20 21 public PowerDisplaySettings() 22 { 23 Properties = new PowerDisplayProperties(); 24 Version = "1"; 25 Name = ModuleName; 26 } 27 28 public string GetModuleName() 29 => Name; 30 31 // This can be utilized in the future if the settings.json file is to be modified/deleted. 32 public bool UpgradeSettingsConfiguration() 33 => false; 34 35 public ModuleType GetModuleType() => ModuleType.PowerDisplay; 36 37 public HotkeyAccessor[] GetAllHotkeyAccessors() 38 { 39 var hotkeyAccessors = new List<HotkeyAccessor> 40 { 41 new HotkeyAccessor( 42 () => Properties.ActivationShortcut, 43 value => Properties.ActivationShortcut = value ?? Properties.DefaultActivationShortcut, 44 "Activation_Shortcut"), 45 }; 46 47 return hotkeyAccessors.ToArray(); 48 } 49 } 50 }