/ src / modules / cmdpal / ext / Microsoft.CmdPal.Ext.Calc / CalculatorCommandProvider.cs
CalculatorCommandProvider.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 Microsoft.CmdPal.Ext.Calc.Helper;
 6  using Microsoft.CmdPal.Ext.Calc.Pages;
 7  using Microsoft.CmdPal.Ext.Calc.Properties;
 8  using Microsoft.CommandPalette.Extensions;
 9  using Microsoft.CommandPalette.Extensions.Toolkit;
10  
11  namespace Microsoft.CmdPal.Ext.Calc;
12  
13  public partial class CalculatorCommandProvider : CommandProvider
14  {
15      private static ISettingsInterface settings = new SettingsManager();
16      private readonly ListItem _listItem = new(new CalculatorListPage(settings))
17      {
18          MoreCommands = [new CommandContextItem(((SettingsManager)settings).Settings.SettingsPage)],
19      };
20  
21      private readonly FallbackCalculatorItem _fallback = new(settings);
22  
23      public CalculatorCommandProvider()
24      {
25          Id = "com.microsoft.cmdpal.builtin.calculator";
26          DisplayName = Resources.calculator_display_name;
27          Icon = Icons.CalculatorIcon;
28          Settings = ((SettingsManager)settings).Settings;
29      }
30  
31      public override ICommandItem[] TopLevelCommands() => [_listItem];
32  
33      public override IFallbackCommandItem[] FallbackCommands() => [_fallback];
34  }