public async Task <ExtractInterfaceOptionsResult> GetExtractInterfaceOptionsAsync(
            ISyntaxFactsService syntaxFactsService,
            INotificationService notificationService,
            List <ISymbol> extractableMembers,
            string defaultInterfaceName,
            List <string> allTypeNames,
            string defaultNamespace,
            string generatedNameTypeParameterSuffix,
            string languageName,
            CleanCodeGenerationOptionsProvider fallbackOptions,
            CancellationToken cancellationToken)
        {
            using var cancellationTokenSource = new CancellationTokenSource();

            var memberViewModels = extractableMembers
                                   .SelectAsArray(member =>
                                                  new MemberSymbolViewModel(member, _glyphService)
            {
                IsChecked               = true,
                MakeAbstract            = false,
                IsMakeAbstractCheckable = false,
                IsCheckable             = true
            });

            await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            var viewModel = new ExtractInterfaceDialogViewModel(
                syntaxFactsService,
                _uiThreadOperationExecutor,
                notificationService,
                defaultInterfaceName,
                allTypeNames,
                memberViewModels,
                defaultNamespace,
                generatedNameTypeParameterSuffix,
                languageName);

            var dialog = new ExtractInterfaceDialog(viewModel);
            var result = dialog.ShowModal();

            if (result.HasValue && result.Value)
            {
                var includedMembers = viewModel.MemberContainers.Where(c => c.IsChecked).Select(c => c.Symbol);

                return(new ExtractInterfaceOptionsResult(
                           isCancelled: false,
                           includedMembers: includedMembers.AsImmutable(),
                           interfaceName: viewModel.DestinationViewModel.TypeName.Trim(),
                           fileName: viewModel.DestinationViewModel.FileName.Trim(),
                           location: GetLocation(viewModel.DestinationViewModel.Destination),
                           fallbackOptions));
            }
            else
            {
                return(ExtractInterfaceOptionsResult.Cancelled);
            }
        }
        internal ExtractInterfaceDialog(ExtractInterfaceDialogViewModel viewModel)
            : base(helpTopic: "vs.csharp.refactoring.extractinterface")
        {
            ViewModel = viewModel;
            SetCommandBindings();

            Loaded += (s, e) => MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));

            InitializeComponent();
            DataContext = viewModel;
        }
        // Use C# Extract Interface helpTopic for C# and VB.
        internal ExtractInterfaceDialog(ExtractInterfaceDialogViewModel viewModel)
            : base(helpTopic: "vs.csharp.refactoring.extractinterface")
        {
            _viewModel = viewModel;
            SetCommandBindings();

            InitializeComponent();
            DataContext = viewModel;

            Loaded += ExtractInterfaceDialog_Loaded;
        }
        // Use C# Extract Interface helpTopic for C# and VB.
        internal ExtractInterfaceDialog(ExtractInterfaceDialogViewModel viewModel)
            : base(helpTopic: "vs.csharp.refactoring.extractinterface")
        {
            _viewModel = viewModel;
            SetCommandBindings();

            InitializeComponent();
            DataContext = viewModel;

            Loaded += ExtractInterfaceDialog_Loaded;
        }
        // Use C# Extract Interface helpTopic for C# and VB.
        internal ExtractInterfaceDialog(ExtractInterfaceDialogViewModel viewModel)
            : base(helpTopic: "vs.csharp.refactoring.extractinterface")
        {
            _viewModel = viewModel;
            SetCommandBindings();

            DestinationControl = new NewTypeDestinationSelection(_viewModel.DestinationViewModel);
            Loaded            += ExtractInterfaceDialog_Loaded;

            InitializeComponent();
            DataContext = viewModel;
        }
        public async Task <ExtractInterfaceOptionsResult> GetExtractInterfaceOptionsAsync(
            ISyntaxFactsService syntaxFactsService,
            INotificationService notificationService,
            List <ISymbol> extractableMembers,
            string defaultInterfaceName,
            List <string> allTypeNames,
            string defaultNamespace,
            string generatedNameTypeParameterSuffix,
            string languageName
            )
        {
            await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync();

            var viewModel = new ExtractInterfaceDialogViewModel(
                syntaxFactsService,
                _glyphService,
                notificationService,
                defaultInterfaceName,
                extractableMembers,
                allTypeNames,
                defaultNamespace,
                generatedNameTypeParameterSuffix,
                languageName
                );

            var dialog = new ExtractInterfaceDialog(viewModel);
            var result = dialog.ShowModal();

            if (result.HasValue && result.Value)
            {
                var includedMembers = viewModel.MemberContainers
                                      .Where(c => c.IsChecked)
                                      .Select(c => c.Symbol);

                return(new ExtractInterfaceOptionsResult(
                           isCancelled: false,
                           includedMembers: includedMembers.AsImmutable(),
                           interfaceName: viewModel.DestinationViewModel.TypeName.Trim(),
                           fileName: viewModel.DestinationViewModel.FileName.Trim(),
                           location: GetLocation(viewModel.DestinationViewModel.Destination)
                           ));
            }
            else
            {
                return(ExtractInterfaceOptionsResult.Cancelled);
            }
        }
        public ExtractInterfaceOptionsResult GetExtractInterfaceOptions(
            ISyntaxFactsService syntaxFactsService,
            INotificationService notificationService,
            List <ISymbol> extractableMembers,
            string defaultInterfaceName,
            List <string> allTypeNames,
            string defaultNamespace,
            string generatedNameTypeParameterSuffix,
            string languageName)
        {
            var viewModel = new ExtractInterfaceDialogViewModel(
                syntaxFactsService,
                _glyphService,
                notificationService,
                defaultInterfaceName,
                extractableMembers,
                allTypeNames,
                defaultNamespace,
                generatedNameTypeParameterSuffix,
                languageName,
                languageName == LanguageNames.CSharp ? ".cs" : ".vb");

            var dialog = new ExtractInterfaceDialog(viewModel);
            var result = dialog.ShowModal();

            if (result.HasValue && result.Value)
            {
                return(new ExtractInterfaceOptionsResult(
                           isCancelled: false,
                           includedMembers: viewModel.MemberContainers.Where(c => c.IsChecked).Select(c => c.MemberSymbol),
                           interfaceName: viewModel.InterfaceName.Trim(),
                           fileName: viewModel.FileName.Trim()));
            }
            else
            {
                return(ExtractInterfaceOptionsResult.Cancelled);
            }
        }
        public ExtractInterfaceOptionsResult GetExtractInterfaceOptions(
            ISyntaxFactsService syntaxFactsService,
            INotificationService notificationService,
            List<ISymbol> extractableMembers,
            string defaultInterfaceName,
            List<string> allTypeNames,
            string defaultNamespace,
            string generatedNameTypeParameterSuffix,
            string languageName)
        {
            var viewModel = new ExtractInterfaceDialogViewModel(
                syntaxFactsService,
                _glyphService,
                notificationService,
                defaultInterfaceName,
                extractableMembers,
                allTypeNames,
                defaultNamespace,
                generatedNameTypeParameterSuffix,
                languageName,
                languageName == LanguageNames.CSharp ? ".cs" : ".vb");

            var dialog = new ExtractInterfaceDialog(viewModel);
            var result = dialog.ShowModal();

            if (result.HasValue && result.Value)
            {
                return new ExtractInterfaceOptionsResult(
                    isCancelled: false,
                    includedMembers: viewModel.MemberContainers.Where(c => c.IsChecked).Select(c => c.MemberSymbol),
                    interfaceName: viewModel.InterfaceName.Trim(),
                    fileName: viewModel.FileName.Trim());
            }
            else
            {
                return ExtractInterfaceOptionsResult.Cancelled;
            }
        }