File: EventHookup\EventHookupCommandHandler_SessionCancellingCommands.cs
Web Access
Project: ..\..\..\src\EditorFeatures\CSharp\Microsoft.CodeAnalysis.CSharp.EditorFeatures.csproj (Microsoft.CodeAnalysis.CSharp.EditorFeatures)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
 
#nullable disable
 
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.VisualStudio.Commanding;
using Microsoft.VisualStudio.Text.Editor.Commanding.Commands;
using Roslyn.Utilities;
 
namespace Microsoft.CodeAnalysis.Editor.CSharp.EventHookup
{
    internal partial class EventHookupCommandHandler :
        ICommandHandler<EscapeKeyCommandArgs>
    {
        public string DisplayName => CSharpEditorResources.Generate_Event_Subscription;
 
        public bool ExecuteCommand(EscapeKeyCommandArgs args, CommandExecutionContext context)
        {
            _threadingContext.ThrowIfNotOnUIThread();
            EventHookupSessionManager.CancelAndDismissExistingSessions();
            return false;
        }
 
        public CommandState GetCommandState(EscapeKeyCommandArgs args)
        {
            _threadingContext.ThrowIfNotOnUIThread();
            return CommandState.Unspecified;
        }
    }
}