Skip to content
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

Merged
merged 2 commits into from
Jun 27, 2023

Conversation

DanielvanDamme
Copy link
Contributor

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.

@ovda96
Copy link
Contributor

ovda96 commented Jun 26, 2023

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.");
Copy link
Contributor

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;
Copy link
Contributor

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);
Copy link
Contributor

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");
Copy link
Contributor

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)
Copy link
Contributor

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)) { }
Copy link
Contributor

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.
Copy link
Contributor

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.

@ovda96
Copy link
Contributor

ovda96 commented Jun 27, 2023

LGTM :)

@ovda96 ovda96 merged commit 8144db4 into develop Jun 27, 2023
5 checks passed
@ovda96 ovda96 deleted the SBS/dvd/create-new-project-of-name-pattern branch June 27, 2023 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants