OpenServicesCommand.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;
 6  using System.Collections.Generic;
 7  using System.Diagnostics;
 8  using System.Linq;
 9  using System.Resources;
10  using System.Text;
11  using System.Threading.Tasks;
12  using Microsoft.CmdPal.Ext.WindowsServices.Helpers;
13  using Microsoft.CmdPal.Ext.WindowsServices.Properties;
14  using Microsoft.CommandPalette.Extensions;
15  using Microsoft.CommandPalette.Extensions.Toolkit;
16  using Windows.UI;
17  
18  namespace Microsoft.CmdPal.Ext.WindowsServices.Commands;
19  
20  internal sealed partial class OpenServicesCommand : InvokableCommand
21  {
22      private readonly ServiceResult _serviceResult;
23  
24      internal OpenServicesCommand(ServiceResult serviceResult)
25      {
26          _serviceResult = serviceResult;
27          Name = Resources.wox_plugin_service_open_services;
28          Icon = Icons.OpenIcon;
29      }
30  
31      public override CommandResult Invoke()
32      {
33          Task.Run(() => ServiceHelper.OpenServices());
34  
35          return CommandResult.Dismiss();
36      }
37  }