/ src / modules / cmdpal / ext / Microsoft.CmdPal.Ext.PowerToys / Modules / AdvancedPasteModuleCommandProvider.cs
AdvancedPasteModuleCommandProvider.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 Common.UI;
 7  using Microsoft.CommandPalette.Extensions.Toolkit;
 8  using PowerToysExtension.Commands;
 9  using PowerToysExtension.Helpers;
10  using PowerToysExtension.Properties;
11  
12  namespace PowerToysExtension.Modules;
13  
14  internal sealed class AdvancedPasteModuleCommandProvider : ModuleCommandProvider
15  {
16      public override IEnumerable<ListItem> BuildCommands()
17      {
18          var module = SettingsDeepLink.SettingsWindow.AdvancedPaste;
19          var title = module.ModuleDisplayName();
20          var icon = module.ModuleIcon();
21  
22          if (ModuleEnablementService.IsModuleEnabled(module))
23          {
24              yield return new ListItem(new OpenAdvancedPasteCommand())
25              {
26                  Title = Resources.AdvancedPaste_Open_Title,
27                  Subtitle = Resources.AdvancedPaste_Open_Subtitle,
28                  Icon = icon,
29              };
30          }
31  
32          yield return new ListItem(new OpenInSettingsCommand(module, title))
33          {
34              Title = title,
35              Subtitle = Resources.AdvancedPaste_Settings_Subtitle,
36              Icon = icon,
37          };
38      }
39  }