コード例 #1
0
        public Task <ExtractInterfaceOptionsResult> GetExtractInterfaceOptionsAsync(
            ISyntaxFactsService syntaxFactsService,
            INotificationService notificationService,
            List <ISymbol> extractableMembers,
            string defaultInterfaceName,
            List <string> allTypeNames,
            string defaultNamespace,
            string generatedNameTypeParameterSuffix,
            string languageName)
        {
            var viewModel = new ExtractInterfaceDialogViewModel(
                syntaxFactsService,
                defaultInterfaceName,
                extractableMembers,
                allTypeNames,
                defaultNamespace,
                generatedNameTypeParameterSuffix,
                languageName,
                languageName == LanguageNames.CSharp ? ".cs" : ".vb");

            var dialog = _dialogFactory.CreateExport().Value;

            dialog.ViewModel = viewModel;
            var options = dialog.Show() == true
                ? new ExtractInterfaceOptionsResult(
                isCancelled: false,
                includedMembers: viewModel.MemberContainers.Where(c => c.IsChecked).Select(c => c.MemberSymbol).AsImmutable(),
                interfaceName: viewModel.InterfaceName.Trim(),
                fileName: viewModel.FileName.Trim(),
                location: GetLocation(viewModel.Destination))
                : ExtractInterfaceOptionsResult.Cancelled;

            return(Task.FromResult(options));
        }
コード例 #2
0
        internal ExtractInterfaceDialog(ExtractInterfaceDialogViewModel viewModel)
        {
            _viewModel = viewModel;
            SetCommandBindings();

            InitializeComponent();
            DataContext = viewModel;

            Loaded           += ExtractInterfaceDialog_Loaded;
            IsVisibleChanged += ExtractInterfaceDialog_IsVisibleChanged;
        }
コード例 #3
0
        internal ExtractInterfaceDialog(ExtractInterfaceDialogViewModel viewModel)
        {
            _viewModel = viewModel;
            SetCommandBindings();

            InitializeComponent();
            DataContext = viewModel;

            Loaded += ExtractInterfaceDialog_Loaded;
            IsVisibleChanged += ExtractInterfaceDialog_IsVisibleChanged;
        }
コード例 #4
0
 public ExtractInterfaceOptionsResult GetExtractInterfaceOptions(ISyntaxFactsService syntaxFactsService,
     INotificationService notificationService, List<ISymbol> extractableMembers, string defaultInterfaceName,
     List<string> conflictingTypeNames, string defaultNamespace, string generatedNameTypeParameterSuffix, string languageName)
 {
     var viewModel = new ExtractInterfaceDialogViewModel(syntaxFactsService, defaultInterfaceName, extractableMembers, conflictingTypeNames, defaultNamespace, generatedNameTypeParameterSuffix, languageName, languageName == LanguageNames.CSharp ? ".cs" : ".vb");
     var dialog = new ExtractInterfaceDialog(viewModel);
     dialog.SetOwnerToActive();
     var options = dialog.ShowDialog() == true
         ? new ExtractInterfaceOptionsResult(
             isCancelled: false,
             includedMembers: viewModel.MemberContainers.Where(c => c.IsChecked).Select(c => c.MemberSymbol),
             interfaceName: viewModel.InterfaceName.Trim(),
             fileName: viewModel.FileName.Trim())
         : ExtractInterfaceOptionsResult.Cancelled;
     return options;
 }
コード例 #5
0
        public ExtractInterfaceOptionsResult GetExtractInterfaceOptions(ISyntaxFactsService syntaxFactsService,
                                                                        INotificationService notificationService, List <ISymbol> extractableMembers, string defaultInterfaceName,
                                                                        List <string> conflictingTypeNames, string defaultNamespace, string generatedNameTypeParameterSuffix, string languageName)
        {
            var viewModel = new ExtractInterfaceDialogViewModel(syntaxFactsService, defaultInterfaceName, extractableMembers, conflictingTypeNames, defaultNamespace, generatedNameTypeParameterSuffix, languageName, languageName == LanguageNames.CSharp ? ".cs" : ".vb");
            var dialog    = new ExtractInterfaceDialog(viewModel);

            dialog.SetOwnerToActive();
            var options = dialog.ShowDialog() == true
                ? new ExtractInterfaceOptionsResult(
                isCancelled: false,
                includedMembers: viewModel.MemberContainers.Where(c => c.IsChecked).Select(c => c.MemberSymbol),
                interfaceName: viewModel.InterfaceName.Trim(),
                fileName: viewModel.FileName.Trim())
                : ExtractInterfaceOptionsResult.Cancelled;

            return(options);
        }