ShortcutsKeyDataModel.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; 7 using System.Text.Json.Serialization; 8 9 namespace Microsoft.PowerToys.Settings.UI.Library 10 { 11 public class ShortcutsKeyDataModel 12 { 13 // Suppressing these warnings because removing the setter breaks 14 // deserialization with System.Text.Json. This affects the UI display. 15 // See: https://github.com/dotnet/runtime/issues/30258 16 [JsonPropertyName("global")] 17 public List<KeysDataModel> GlobalRemapShortcuts { get; set; } 18 19 [JsonPropertyName("appSpecific")] 20 public List<AppSpecificKeysDataModel> AppSpecificRemapShortcuts { get; set; } 21 22 public ShortcutsKeyDataModel() 23 { 24 GlobalRemapShortcuts = new List<KeysDataModel>(); 25 AppSpecificRemapShortcuts = new List<AppSpecificKeysDataModel>(); 26 } 27 28 public string ToJsonString() 29 { 30 return JsonSerializer.Serialize(this); 31 } 32 } 33 }