microsoft/TypeAgent

Public

mirrored fromhttps://github.com/microsoft/TypeAgentAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/collate-todos-into-todo-md

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

dotnet/autoShell/Handlers/SystemCommandHandler.cs

45lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4using System.Collections.Generic;
5using autoShell.Services;
6using Newtonsoft.Json.Linq;
7
8namespace autoShell.Handlers;
9
10/// <summary>
11/// Handles system/utility commands: Debug and ToggleNotifications.
12/// </summary>
13internal class SystemCommandHandler : ICommandHandler
14{
15 private readonly IProcessService _process;
16 private readonly IDebuggerService _debugger;
17
18 public SystemCommandHandler(IProcessService process, IDebuggerService debugger)
19 {
20 _process = process;
21 _debugger = debugger;
22 }
23
24 /// <inheritdoc/>
25 public IEnumerable<string> SupportedCommands { get; } =
26 [
27 "Debug",
28 "ToggleNotifications",
29 ];
30
31 /// <inheritdoc/>
32 public void Handle(string key, string value, JToken rawValue)
33 {
34 switch (key)
35 {
36 case "Debug":
37 _debugger.Launch();
38 break;
39
40 case "ToggleNotifications":
41 _process.StartShellExecute("ms-actioncenter:");
42 break;
43 }
44 }
45}
46