/// <summary> /// 调用命令 /// </summary> /// <param name="para"></param> /// <returns></returns> public override CommandResult Process(object para) { CommandResult result = new CommandResult(); result.ErrCode = CommandExecStatus.Succeed; if (vsWindowType.vsWindowTypeDocument == DteHelper.Dte2.ActiveWindow.Type) { List <CodeDomCodeElement <CodeElement> > listElement = DteHelper.FetchCodeElementByPoint(DteHelper.Dte2.ActiveDocument.ProjectItem.FileCodeModel, DteHelper.GetCurrentActivePoint()); this.CurrentCodeElement = DteHelper.FindPointElement(listElement, DteHelper.GetCurrentActivePoint()); } else if (vsWindowType.vsWindowTypeSolutionExplorer == DteHelper.Dte2.ActiveWindow.Type && CurrentCodeElement != null) { //取得所有选中文件 IList <ProjectItem> listItem = DteHelper.GetSelectedItem(Constant.CSharpFileExtension); foreach (var projectItem in listItem) { foreach (var codeClass in DteHelper.GetClassFromFile(projectItem.FileCodeModel)) {//克隆元素 DteHelper.CloneCodeElement(CurrentCodeElement.CodeElement, codeClass); } } } return(result); }