AlwaysOnTopSettings.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 AlwaysOnTopSettings : BasePTModuleSettings, ISettingsConfig, IHotkeyConfig 14 { 15 public const string ModuleName = "AlwaysOnTop"; 16 public const string ModuleVersion = "0.0.1"; 17 18 public AlwaysOnTopSettings() 19 { 20 Name = ModuleName; 21 Version = ModuleVersion; 22 Properties = new AlwaysOnTopProperties(); 23 } 24 25 [JsonPropertyName("properties")] 26 public AlwaysOnTopProperties Properties { get; set; } 27 28 public string GetModuleName() 29 { 30 return Name; 31 } 32 33 public ModuleType GetModuleType() => ModuleType.AlwaysOnTop; 34 35 public HotkeyAccessor[] GetAllHotkeyAccessors() 36 { 37 var hotkeyAccessors = new List<HotkeyAccessor> 38 { 39 new HotkeyAccessor( 40 () => Properties.Hotkey.Value, 41 value => Properties.Hotkey.Value = value ?? AlwaysOnTopProperties.DefaultHotkeyValue, 42 "AlwaysOnTop_ActivationShortcut"), 43 }; 44 45 return hotkeyAccessors.ToArray(); 46 } 47 48 public bool UpgradeSettingsConfiguration() 49 { 50 return false; 51 } 52 } 53 }