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

Replace singletons with DI patterns... #3314

Merged

Conversation

tom-englert
Copy link
Contributor

... and decouple the direct dependencies of the services.

Again this is only architectural changes in the UI layer, no functional changes.

I tried to break it down into comprehensible steps per commit, however due to the many side effects the first ones are still big, sorry for that.

clean.cmd Outdated
@@ -0,0 +1,22 @@
@ECHO OFF
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the purpose of this script? Isn't git clean sufficient?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, that was not intended to be included, I'll remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But git clean does either too much or too less... this one removes exactly the bin and obj folders.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. It would also remove my Resharper configuration which I'm not allowed to commit.

Copy link
Member

@siegfriedpammer siegfriedpammer Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's why I use git clean -X, which removes only files that match .gitignore entries, but does NOT touch untracked files. I have lots of untracked extra files in my ILSpy folder (test cases, diff files, TODO lists, notes, etc.), which some might argue is a bad thing, but I don't care :)

see https://git-scm.com/docs/git-clean

image

Usually, I combine that with d to remove empty directories and q for "quiet mode" and f is mandatory anyway. So, I use git clean -Xdfq.

Just configure your .gitignore correctly and git clean behaves exactly as it is intended by its creators.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remember to always use upper-case X and you will be fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think our .gitignore file is missing something, feel free to extend it to match your needs.

new RequestNavigateEventArgs(new Uri("resource://aboutpage"), null),
inNewTabPage: true
);
assemblyTreeModel.NavigateTo(new(new("resource://aboutpage"), null), inNewTabPage: true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot say that I am very happy about the removed type names, but I guess that's the modern style...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to change the .editorconfig defaults to not suggest removing types with the next commit

@siegfriedpammer
Copy link
Member

Thank you for the good work... just a few notes:

  • some files are missing the file headers (we definitely need an analyzer for that...)
  • can you please fix the warnings reported in the last commit?
  • the "fix formatting" commit could probably be merged into other commits that modify the code (if clean.cmd would be removed)

- Decouple services to reduce circular dependencies
- Move update panel to a separate control
- Remove unrelated methods from MainWindow
@tom-englert tom-englert force-pushed the dev/DependencyInjection branch from e38ed25 to a24e0f9 Compare November 1, 2024 15:10
@tom-englert
Copy link
Contributor Author

Issues fixed...

@siegfriedpammer siegfriedpammer merged commit 1134313 into icsharpcode:master Nov 1, 2024
5 checks passed
@siegfriedpammer
Copy link
Member

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants