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);
        }
Ejemplo 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();
        }
Ejemplo n.º 3
0
 public AddedParameterOrExistingIndex(AddedParameter addedParameterWithoutTypeSymbol, string addedParameterFullyQualifiedTypeName)
 {
     OldIndex   = null;
     IsExisting = false;
     _addedParameterWithoutTypeSymbol      = addedParameterWithoutTypeSymbol;
     _addedParameterFullyQualifiedTypeName = addedParameterFullyQualifiedTypeName;
 }
Ejemplo n.º 4
0
 public AddedParameterViewModel(
     ChangeSignatureDialogViewModel changeSignatureDialogViewModel,
     AddedParameter addedParameter
     ) : base(changeSignatureDialogViewModel)
 {
     _addedParameter = addedParameter;
 }
        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();
        }
        internal void AddParameter(AddedParameter addedParameter)
        {
            _parametersWithoutDefaultValues.Add(new AddedParameterViewModel(this, addedParameter));

            RemoveRestoreNotifyPropertyChanged();
        }