/ src / settings-ui / Settings.UI.Library / AdvancedPasteAdditionalAction.cs
AdvancedPasteAdditionalAction.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  
 8  using Microsoft.PowerToys.Settings.UI.Library.Helpers;
 9  
10  namespace Microsoft.PowerToys.Settings.UI.Library;
11  
12  public sealed partial class AdvancedPasteAdditionalAction : Observable, IAdvancedPasteAction
13  {
14      private HotkeySettings _shortcut = new();
15      private bool _isShown;
16      private bool _hasConflict;
17      private string _tooltip;
18  
19      [JsonPropertyName("shortcut")]
20      public HotkeySettings Shortcut
21      {
22          get => _shortcut;
23          set
24          {
25              if (_shortcut != value)
26              {
27                  // We null-coalesce here rather than outside this branch as we want to raise PropertyChanged when the setter is called
28                  // with null; the ShortcutControl depends on this.
29                  _shortcut = value ?? new();
30  
31                  OnPropertyChanged();
32              }
33          }
34      }
35  
36      [JsonPropertyName("isShown")]
37      public bool IsShown
38      {
39          get => _isShown;
40          set => Set(ref _isShown, value);
41      }
42  
43      [JsonIgnore]
44      public bool HasConflict
45      {
46          get => _hasConflict;
47          set => Set(ref _hasConflict, value);
48      }
49  
50      [JsonIgnore]
51      public string Tooltip
52      {
53          get => _tooltip;
54          set => Set(ref _tooltip, value);
55      }
56  
57      [JsonIgnore]
58      public IEnumerable<IAdvancedPasteAction> SubActions => [];
59  }