MousePointerCrosshairsSettings.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 MousePointerCrosshairsSettings : BasePTModuleSettings, ISettingsConfig, IHotkeyConfig 14 { 15 public const string ModuleName = "MousePointerCrosshairs"; 16 17 [JsonPropertyName("properties")] 18 public MousePointerCrosshairsProperties Properties { get; set; } 19 20 public MousePointerCrosshairsSettings() 21 { 22 Name = ModuleName; 23 Properties = new MousePointerCrosshairsProperties(); 24 Version = "1.0"; 25 } 26 27 public string GetModuleName() 28 { 29 return Name; 30 } 31 32 public ModuleType GetModuleType() => ModuleType.MousePointerCrosshairs; 33 34 public HotkeyAccessor[] GetAllHotkeyAccessors() 35 { 36 var hotkeyAccessors = new List<HotkeyAccessor> 37 { 38 new HotkeyAccessor( 39 () => Properties.ActivationShortcut, 40 value => Properties.ActivationShortcut = value ?? Properties.DefaultActivationShortcut, 41 "MouseUtils_MousePointerCrosshairs_ActivationShortcut"), 42 new HotkeyAccessor( 43 () => Properties.GlidingCursorActivationShortcut, 44 value => Properties.GlidingCursorActivationShortcut = value ?? Properties.DefaultGlidingCursorActivationShortcut, 45 "MouseUtils_GlidingCursor"), 46 }; 47 48 return hotkeyAccessors.ToArray(); 49 } 50 51 // This can be utilized in the future if the settings.json file is to be modified/deleted. 52 public bool UpgradeSettingsConfiguration() 53 { 54 return false; 55 } 56 } 57 }