-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SBS: New project is always added to solution when making new design pattern. #357
Conversation
The dialog box upon creating a new pattern still asks you whether you would like to add a new file to the solution; I think that should be called project. |
project.ProjectItems.AddFromFile(filePath); | ||
if (projectnames.Name.Equals(projectName)) | ||
{ | ||
MessageBox.Show("A previous design pattern implementation already exists in this solution."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also include the name of the currently selected pattern, i.e. "A previous design pattern implementation for adapter already exists in this solution."
@@ -151,46 +151,44 @@ public class StepByStepListViewModel : ViewModel | |||
{ | |||
string filePath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why you should declare filePath
before assignment; maybe a left-over from the old branching?
templatePath, | ||
projectPath, | ||
projectName, | ||
false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false
is redundant; dte.Solution.AddFromTemplate(...)
has a default value for Exclusive
.
filePath = | ||
Path.Combine( | ||
projectPath, | ||
SelectedInstructionSet.ToString()+".cs"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ToString()
is redundant
// add a file. | ||
string projectName = SelectedInstructionSet.ToString(); | ||
|
||
foreach (Project projectnames in dte.Solution.Projects) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
projectNames
should be the casing here, but I think it is better to call the variable project
since you are now calling projectnames.Name
in the next line.
Path.Combine( | ||
projectPath, | ||
SelectedInstructionSet.ToString()+".cs"); | ||
using (FileStream fs = File.Create(filePath)) { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are immediately closing the FileStream
, I feel File.Create(filePath).Close();
is more readable.
SelectedInstructionSet.ToString()+".cs"); | ||
using (FileStream fs = File.Create(filePath)) { } | ||
project.ProjectItems.AddFromFile(filePath); | ||
// The solution is empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand this comment.
LGTM :) |
Now when the user wants to implement a new pattern a new project is always added to the solution with the name of the design pattern itself. When there is already a design pattern made in the solution of the same name the user is notified.