/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/VisualStudio/Core/Def/ExtractInterface/ExtractInterfaceDialogViewModel.cs
81 строка
3 KB
Cyrus Najmabadi
Remove unused usings
18 июн 2025, 22:17
18 июн 2025, 22:17
481c36c
Код
Авторство
О чём код?
// 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. using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.LanguageService; using Microsoft.CodeAnalysis.Notification; using Microsoft.VisualStudio.LanguageServices.Implementation.CommonControls; using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; using Microsoft.VisualStudio.LanguageServices.Utilities; using Microsoft.VisualStudio.Utilities; using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation.ExtractInterface; internal sealed class ExtractInterfaceDialogViewModel : AbstractNotifyPropertyChanged { private readonly INotificationService _notificationService; internal ExtractInterfaceDialogViewModel( ISyntaxFactsService syntaxFactsService, IUIThreadOperationExecutor uiThreadOperationExecutor, INotificationService notificationService, string defaultInterfaceName, ImmutableArray<string> conflictingTypeNames, ImmutableArray<LanguageServices.Utilities.MemberSymbolViewModel> memberViewModels, string defaultNamespace, string generatedNameTypeParameterSuffix, string languageName, bool canAddDocument) { _notificationService = notificationService; MemberSelectionViewModel = new MemberSelectionViewModel( uiThreadOperationExecutor, memberViewModels, dependentsMap: null, destinationTypeKind: TypeKind.Interface, showDependentsButton: false, showPublicButton: false); DestinationViewModel = new NewTypeDestinationSelectionViewModel( defaultInterfaceName, languageName, defaultNamespace, generatedNameTypeParameterSuffix, conflictingTypeNames, syntaxFactsService, canAddDocument); } internal bool TrySubmit() { if (!DestinationViewModel.TrySubmit(out var message)) { SendFailureNotification(message); return false; } if (!MemberContainers.Any(c => c.IsChecked)) { SendFailureNotification(ServicesVSResources.You_must_select_at_least_one_member); return false; } // TODO: Deal with filename already existing return true; } private void SendFailureNotification(string message) => _notificationService.SendNotification(message, severity: NotificationSeverity.Information); public ImmutableArray<MemberSymbolViewModel> MemberContainers => MemberSelectionViewModel.Members; public NewTypeDestinationSelectionViewModel DestinationViewModel { get; internal set; } public MemberSelectionViewModel MemberSelectionViewModel { get; } }