private void Add_Click(object sender, RoutedEventArgs e)
        {
            var addParameterViewModel = _viewModel.CreateAddParameterDialogViewModel();
            var dialog = new AddParameterDialog(addParameterViewModel);
            var result = dialog.ShowModal();

            ChangeSignatureLogger.LogAddParameterDialogLaunched();

            if (result.HasValue && result.Value)
            {
                ChangeSignatureLogger.LogAddParameterDialogCommitted();

                var addedParameter = new AddedParameter(
                    addParameterViewModel.TypeSymbol,
                    addParameterViewModel.TypeName,
                    addParameterViewModel.ParameterName,
                    GetCallSiteKind(addParameterViewModel),
                    addParameterViewModel.IsCallsiteRegularValue ? addParameterViewModel.CallSiteValue : string.Empty,
                    addParameterViewModel.IsRequired,
                    addParameterViewModel.IsRequired ? string.Empty : addParameterViewModel.DefaultValue,
                    addParameterViewModel.TypeBinds);

                _viewModel.AddParameter(addedParameter);
            }

            SetFocusToSelectedRow(false);
        }
Exemplo n.º 2
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            var addParameterViewModel = _viewModel.CreateAddParameterDialogViewModel();
            var dialog = new AddParameterDialog(addParameterViewModel);
            var result = dialog.ShowModal();

            ChangeSignatureLogger.LogAddParameterDialogLaunched();

            if (result.HasValue && result.Value)
            {
                ChangeSignatureLogger.LogAddParameterDialogCommitted();

                var addedParameter = new AddedParameter(
                    addParameterViewModel.TypeSymbol,
                    addParameterViewModel.TypeName,
                    addParameterViewModel.ParameterName,
                    (addParameterViewModel.IsCallsiteOmitted || addParameterViewModel.IsCallsiteTodo) ? "" : addParameterViewModel.CallSiteValue,
                    addParameterViewModel.IsRequired,
                    addParameterViewModel.IsRequired ? "" : addParameterViewModel.DefaultValue,
                    addParameterViewModel.UseNamedArguments,
                    addParameterViewModel.IsCallsiteOmitted,
                    addParameterViewModel.IsCallsiteTodo,
                    addParameterViewModel.TypeBinds);

                _viewModel.AddParameter(addedParameter);
            }

            SetFocusToSelectedRow();
        }
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            var addParameterViewModel = _viewModel.CreateAddParameterDialogViewModel();
            var dialog = new AddParameterDialog(addParameterViewModel);
            var result = dialog.ShowModal();

            if (result.HasValue && result.Value)
            {
                var addedParameter = new AddedParameter(
                    addParameterViewModel.TypeSymbol,
                    addParameterViewModel.TypeName,
                    addParameterViewModel.ParameterName,
                    string.IsNullOrWhiteSpace(addParameterViewModel.CallSiteValue)
                    ? ServicesVSResources.ChangeSignature_NewParameterIntroduceTODOVariable
                    : addParameterViewModel.CallSiteValue);

                _viewModel.AddParameter(addedParameter);
            }

            SetFocusToSelectedRow();
        }