CropAndLockSettings.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 CropAndLockSettings : BasePTModuleSettings, ISettingsConfig, IHotkeyConfig 14 { 15 public const string ModuleName = "CropAndLock"; 16 public const string ModuleVersion = "0.0.1"; 17 18 public CropAndLockSettings() 19 { 20 Name = ModuleName; 21 Version = ModuleVersion; 22 Properties = new CropAndLockProperties(); 23 } 24 25 [JsonPropertyName("properties")] 26 public CropAndLockProperties Properties { get; set; } 27 28 public string GetModuleName() 29 { 30 return Name; 31 } 32 33 public ModuleType GetModuleType() => ModuleType.CropAndLock; 34 35 public HotkeyAccessor[] GetAllHotkeyAccessors() 36 { 37 var hotkeyAccessors = new List<HotkeyAccessor> 38 { 39 new HotkeyAccessor( 40 () => Properties.ReparentHotkey.Value, 41 value => Properties.ReparentHotkey.Value = value ?? CropAndLockProperties.DefaultReparentHotkeyValue, 42 "CropAndLock_ReparentActivation_Shortcut"), 43 new HotkeyAccessor( 44 () => Properties.ThumbnailHotkey.Value, 45 value => Properties.ThumbnailHotkey.Value = value ?? CropAndLockProperties.DefaultThumbnailHotkeyValue, 46 "CropAndLock_ThumbnailActivation_Shortcut"), 47 new HotkeyAccessor( 48 () => Properties.ScreenshotHotkey.Value, 49 value => Properties.ScreenshotHotkey.Value = value ?? CropAndLockProperties.DefaultScreenshotHotkeyValue, 50 "CropAndLock_ScreenshotActivation_Shortcut"), 51 }; 52 53 return hotkeyAccessors.ToArray(); 54 } 55 56 public bool UpgradeSettingsConfiguration() 57 { 58 return false; 59 } 60 } 61 }