/ src / settings-ui / Settings.UI.Library / ShortcutGuideSettings.cs
ShortcutGuideSettings.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  using ManagedCommon;
 8  using Microsoft.PowerToys.Settings.UI.Library.Helpers;
 9  using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
10  
11  namespace Microsoft.PowerToys.Settings.UI.Library
12  {
13      public class ShortcutGuideSettings : BasePTModuleSettings, ISettingsConfig, IHotkeyConfig
14      {
15          public const string ModuleName = "Shortcut Guide";
16  
17          [JsonPropertyName("properties")]
18          public ShortcutGuideProperties Properties { get; set; }
19  
20          public ShortcutGuideSettings()
21          {
22              Name = ModuleName;
23              Properties = new ShortcutGuideProperties();
24              Version = "1.0";
25          }
26  
27          public string GetModuleName()
28          {
29              return Name;
30          }
31  
32          public ModuleType GetModuleType() => ModuleType.ShortcutGuide;
33  
34          public HotkeyAccessor[] GetAllHotkeyAccessors()
35          {
36              var hotkeyAccessors = new List<HotkeyAccessor>
37              {
38                  new HotkeyAccessor(
39                      () => Properties.OpenShortcutGuide,
40                      value => Properties.OpenShortcutGuide = value ?? Properties.DefaultOpenShortcutGuide,
41                      "Activation_Shortcut"),
42              };
43  
44              return hotkeyAccessors.ToArray();
45          }
46  
47          // This can be utilized in the future if the settings.json file is to be modified/deleted.
48          public bool UpgradeSettingsConfiguration()
49          {
50              return false;
51          }
52      }
53  }