public override void ExecuteCommandImpl(object sender, EventArgs args) { Document activeDocument = projectManager.ActiveDocument; SyntaxNode activeSyntaxNode = projectManager.ActiveSyntaxNode; string activeDocumentMethodName = projectManager.ActiveDocumentMethodName; string activeDocumentMethodFullPath = projectManager.ActiveDocumentMethodFullPath; string activeDocumentMethodFolderPath = projectManager.ActiveDocumentMethodFolderPath; string serverMethodFolderPath = projectManager.ServerMethodFolderPath; MethodInfo methodInformation = projectConfigurationManager.CurrentProjectConfiguraiton.MethodInfos.FirstOrDefault(m => m.MethodName == activeDocumentMethodName); if (string.Equals(activeDocument.FilePath, activeDocumentMethodFullPath, StringComparison.InvariantCultureIgnoreCase)) { // main to external var moveToViewAdapter = this.dialogFactory.GetMoveToView(activeDocumentMethodFolderPath, activeSyntaxNode); var moveToViewResult = moveToViewAdapter.ShowDialog(); if (moveToViewResult.DialogOperationResult == false) { return; } ICodeProvider codeProvider = codeProviderFactory.GetCodeProvider(activeDocument.Project.Language); CodeInfo activeDocumentCodeInfo = codeProvider.RemoveActiveNodeFromActiveDocument(activeDocument, activeSyntaxNode, serverMethodFolderPath); CodeInfo itemCodeInfo = null; if (moveToViewResult.SelectedCodeType == CodeType.Partial) { itemCodeInfo = codeProvider.InsertActiveNodeToPartial(moveToViewResult.SelectedFullPath, serverMethodFolderPath, activeDocumentMethodName, activeSyntaxNode, projectManager.ActiveDocumentMethodFullPath); } else { itemCodeInfo = codeProvider.InsertActiveNodeToExternal(moveToViewResult.SelectedFullPath, serverMethodFolderPath, activeDocumentMethodName, activeSyntaxNode, projectManager.ActiveDocumentMethodFullPath); } projectManager.AddItemTemplateToProjectNew(activeDocumentCodeInfo, methodInformation.Package.MethodFolderPath, false); projectManager.AddItemTemplateToProjectNew(itemCodeInfo, methodInformation.Package.MethodFolderPath, false); projectConfigurationManager.Save(projectManager.ProjectConfigPath); } else { // external to main var messageBoxWindow = dialogFactory.GetMessageBoxWindow(); var messageBoxWindowResult = messageBoxWindow.ShowDialog( this.messageManager.GetMessage("SelectedCodeWillBeMovedToMainMethodFileClickOKToContinue"), this.messageManager.GetMessage("MoveToMainMethod"), MessageButtons.OKCancel, MessageIcon.Question); if (messageBoxWindowResult == MessageDialogResult.OK) { ICodeProvider codeProvider = codeProviderFactory.GetCodeProvider(activeDocument.Project.Language); CodeInfo activeDocumentCodeInfo = codeProvider.RemoveActiveNodeFromActiveDocument(activeDocument, activeSyntaxNode, serverMethodFolderPath); CodeInfo methodDocumentCodeInfo = codeProvider.InsertActiveNodeToMainMethod(activeDocumentMethodFullPath, serverMethodFolderPath, activeSyntaxNode, activeDocument.FilePath); projectManager.AddItemTemplateToProjectNew(activeDocumentCodeInfo, methodInformation.Package.MethodFolderPath, false); projectManager.AddItemTemplateToProjectNew(methodDocumentCodeInfo, methodInformation.Package.MethodFolderPath, false); } } }