microsoft/TypeAgent

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/fix-shell-and-cli-windows-job

Branches

Tags

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

Clone

HTTPS

Download ZIP

dotnet/autoShell/Handlers/SystemActionHandler.cs

36lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4using autoShell.Handlers.Generated;
5using autoShell.Services;
6
7namespace autoShell.Handlers;
8
9/// <summary>
10/// Handles system/utility commands: Debug and ToggleNotifications.
11/// </summary>
12internal class SystemActionHandler : ActionHandlerBase
13{
14 private readonly IProcessService _process;
15 private readonly IDebuggerService _debugger;
16
17 public SystemActionHandler(IProcessService process, IDebuggerService debugger)
18 {
19 _process = process;
20 _debugger = debugger;
21 AddAction<DebugParams>("Debug", HandleDebug);
22 AddAction<ToggleNotificationsParams>("ToggleNotifications", HandleToggleNotifications);
23 }
24
25 private ActionResult HandleDebug(DebugParams p)
26 {
27 _debugger.Launch();
28 return ActionResult.Ok("Debugger launched");
29 }
30
31 private ActionResult HandleToggleNotifications(ToggleNotificationsParams p)
32 {
33 _process.StartShellExecute("ms-actioncenter:");
34 return ActionResult.Ok("Toggled Action Center");
35 }
36}
37