public bool Show(IExtractMethodModel methodModel, IExtractMethodProc extractMethodProc) { PrepareView(methodModel, extractMethodProc); if (_view.ShowDialog() != DialogResult.OK) { return(false); } return(true); }
public ExtractMethodModel Show() { PrepareView(); if (_view.ShowDialog() != DialogResult.OK) { return(null); } return(_model); }
public void Show() { _view.MethodName = "Method1"; _view.Inputs = _input.ToList(); _view.Outputs = _output.Select(output => new ExtractedParameter(output.Name, output.TypeName, ExtractedParameter.PassedBy.ByRef)).ToList(); _view.Locals = _locals.Select(variable => new ExtractedParameter(variable.GetText(), string.Empty, ExtractedParameter.PassedBy.ByVal)).ToList(); var returnValues = new[] { new ExtractedParameter("(none)", string.Empty, ExtractedParameter.PassedBy.ByVal) } .Union(_view.Outputs) .Union(_view.Inputs) .ToList(); _view.ReturnValues = returnValues; if (_output.Count() == 1) { _view.ReturnValue = _output.Single(); } else { _view.ReturnValue = returnValues.First(); } _view.RefreshPreview += _view_RefreshPreview; _view.OnRefreshPreview(); var result = _view.ShowDialog(); if (result != DialogResult.OK) { return; } _vbe.ActiveCodePane.CodeModule.DeleteLines(_selection.Selection.StartLine, _selection.Selection.LineCount - 1); _vbe.ActiveCodePane.CodeModule.ReplaceLine(_selection.Selection.StartLine, GetMethodCall()); var insertionLine = ((ParserRuleContext)_parentMethodTree).GetSelection().EndLine - _selection.Selection.LineCount + 2; _vbe.ActiveCodePane.CodeModule.InsertLines(insertionLine, GetExtractedMethod()); }