public EncapsulateFieldModel Show() { if (_model.TargetDeclaration == null) { return(null); } _view.ViewModel.TargetDeclaration = _model.TargetDeclaration; var isVariant = _model.TargetDeclaration.AsTypeName.Equals(Tokens.Variant); var isValueType = !isVariant && (SymbolList.ValueTypes.Contains(_model.TargetDeclaration.AsTypeName) || _model.TargetDeclaration.DeclarationType == DeclarationType.Enumeration); AssignSetterAndLetterAvailability(isVariant, isValueType); _view.ShowDialog(); if (_view.DialogResult != DialogResult.OK) { return(null); } _model.PropertyName = _view.ViewModel.PropertyName; _model.ImplementLetSetterType = _view.ViewModel.IsLetSelected; _model.ImplementSetSetterType = _view.ViewModel.IsSetSelected; _model.CanImplementLet = _view.ViewModel.CanHaveLet; _model.ParameterName = _view.ViewModel.ParameterName; return(_model); }
public ExtractInterfaceModel Show() { if (_model.TargetDeclaration == null) { return(null); } _view.ViewModel.ComponentNames = _model.State.DeclarationFinder .UserDeclarations(DeclarationType.Module) .Where(moduleDeclaration => moduleDeclaration.ProjectId == _model.TargetDeclaration.ProjectId) .Select(module => module.ComponentName) .ToList(); _view.ViewModel.InterfaceName = _model.InterfaceName; _view.ViewModel.Members = _model.Members.ToList(); _view.ShowDialog(); if (_view.DialogResult != DialogResult.OK) { return(null); } _model.InterfaceName = _view.ViewModel.InterfaceName; _model.Members = _view.ViewModel.Members; return(_model); }
public RemoveParametersModel Show() { if (_model.TargetDeclaration == null) { return(null); } if (_model.Parameters.Count == 0) { var message = string.Format(RubberduckUI.RemovePresenter_NoParametersError, _model.TargetDeclaration.IdentifierName); _messageBox.NotifyWarn(message, RubberduckUI.RemoveParamsDialog_TitleText); return(null); } if (_model.Parameters.Count == 1) { return(_model); } _view.ViewModel.Parameters = _model.Parameters.Select(p => p.ToViewModel()).ToList(); _view.ShowDialog(); if (_view.DialogResult != DialogResult.OK) { return(null); } _model.RemoveParameters = _view.ViewModel.Parameters.Where(m => m.IsRemoved).Select(vm => vm.ToModel()).ToList(); return(_model); }
public ReorderParametersModel Show() { if (_model.TargetDeclaration == null) { return(null); } if (_model.Parameters.Count < 2) { var message = string.Format(RubberduckUI.ReorderPresenter_LessThanTwoParametersError, _model.TargetDeclaration.IdentifierName); _messageBox.Show(message, RubberduckUI.ReorderParamsDialog_TitleText, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(null); } _view.ViewModel.Parameters = new ObservableCollection <Parameter>(_model.Parameters); _view.ShowDialog(); if (_view.DialogResult != DialogResult.OK) { return(null); } _model.Parameters = _view.ViewModel.Parameters.ToList(); return(_model); }
public RemoveParametersModel Show() { if (_model.TargetDeclaration == null) { return(null); } if (_model.Parameters.Count == 0) { var message = string.Format(RubberduckUI.RemovePresenter_NoParametersError, _model.TargetDeclaration.IdentifierName); _messageBox.Show(message, RubberduckUI.RemoveParamsDialog_TitleText, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(null); } if (_model.Parameters.Count == 1) { _model.Parameters[0].IsRemoved = true; return(_model); } _view.ViewModel.Parameters = _model.Parameters; _view.ShowDialog(); if (_view.DialogResult != DialogResult.OK) { return(null); } _model.Parameters = _view.ViewModel.Parameters; return(_model); }
public IAddRemoveReferencesModel Show(ProjectDeclaration project) { if (project is null) { return(null); } Model.Project = project; _view.ViewModel.Model = Model; _view.ShowDialog(); if (_view.DialogResult != DialogResult.OK) { return(null); } Model.NewReferences = _view.ViewModel.ProjectReferences.SourceCollection.OfType <ReferenceModel>().ToList(); return(Model); }
public RenameModel Show(Declaration target) { if (null == target) { return(null); } _model.Target = target; _view.ViewModel.Target = target; _view.ShowDialog(); if (_view.DialogResult != DialogResult.OK) { return(null); } _model.NewName = _view.ViewModel.NewName; return(_model); }
public ExtractInterfaceModel Show() { if (_model.TargetDeclaration == null) { return(null); } _view.ViewModel.ComponentNames = _model.TargetDeclaration.Project.VBComponents.Select(c => c.Name).ToList(); _view.ViewModel.InterfaceName = _model.InterfaceName; _view.ViewModel.Members = _model.Members.ToList(); _view.ShowDialog(); if (_view.DialogResult != DialogResult.OK) { return(null); } _model.InterfaceName = _view.ViewModel.InterfaceName; _model.Members = _view.ViewModel.Members; return(_model); }