/ src / modules / cmdpal / ext / Microsoft.CmdPal.Ext.PowerToys / Modules / ScreenRulerModuleCommandProvider.cs
ScreenRulerModuleCommandProvider.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 ScreenRulerModuleCommandProvider : ModuleCommandProvider 15 { 16 public override IEnumerable<ListItem> BuildCommands() 17 { 18 var module = SettingsWindow.MeasureTool; 19 var title = module.ModuleDisplayName(); 20 var icon = module.ModuleIcon(); 21 22 if (ModuleEnablementService.IsModuleEnabled(module)) 23 { 24 yield return new ListItem(new ToggleScreenRulerCommand()) 25 { 26 Title = Resources.ScreenRuler_Toggle_Title, 27 Subtitle = Resources.ScreenRuler_Toggle_Subtitle, 28 Icon = icon, 29 }; 30 } 31 32 yield return new ListItem(new OpenInSettingsCommand(module, title)) 33 { 34 Title = title, 35 Subtitle = Resources.ScreenRuler_Settings_Subtitle, 36 Icon = icon, 37 }; 38 } 39 }