/ src / modules / cmdpal / ext / Microsoft.CmdPal.Ext.PowerToys / Modules / CropAndLockModuleCommandProvider.cs
CropAndLockModuleCommandProvider.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 Microsoft.CommandPalette.Extensions.Toolkit;
 7  using PowerToysExtension.Commands;
 8  using PowerToysExtension.Helpers;
 9  using PowerToysExtension.Properties;
10  using static Common.UI.SettingsDeepLink;
11  
12  namespace PowerToysExtension.Modules;
13  
14  internal sealed class CropAndLockModuleCommandProvider : ModuleCommandProvider
15  {
16      public override IEnumerable<ListItem> BuildCommands()
17      {
18          var module = SettingsWindow.CropAndLock;
19          var title = module.ModuleDisplayName();
20          var icon = module.ModuleIcon();
21  
22          if (ModuleEnablementService.IsModuleEnabled(module))
23          {
24              yield return new ListItem(new CropAndLockReparentCommand())
25              {
26                  Title = Resources.CropAndLock_Reparent_Title,
27                  Subtitle = Resources.CropAndLock_Reparent_Subtitle,
28                  Icon = icon,
29              };
30  
31              yield return new ListItem(new CropAndLockThumbnailCommand())
32              {
33                  Title = Resources.CropAndLock_Thumbnail_Title,
34                  Subtitle = Resources.CropAndLock_Thumbnail_Subtitle,
35                  Icon = icon,
36              };
37  
38              yield return new ListItem(new CropAndLockScreenshotCommand())
39              {
40                  Title = Resources.CropAndLock_Screenshot_Title,
41                  Subtitle = Resources.CropAndLock_Screenshot_Subtitle,
42                  Icon = icon,
43              };
44          }
45  
46          yield return new ListItem(new OpenInSettingsCommand(module, title))
47          {
48              Title = title,
49              Subtitle = Resources.CropAndLock_Settings_Subtitle,
50              Icon = icon,
51          };
52      }
53  }