canton7 / Stylet

A very lightweight but powerful ViewModel-First MVVM framework for WPF for .NET Framework and .NET Core, inspired by Caliburn.Micro.
MIT License
981 stars 143 forks source link

Created a layer between Bootstrapper<T> and BootstrapperBase #208

Closed mwdpb closed 3 years ago

mwdpb commented 3 years ago

The new added abstract class is called BootstrapperNoRootView, as its name indicated, it'll initialize Stylet without specifying RootViewModel. It is useful when using Stylet in class library development where you don't have root view controls.

canton7 commented 3 years ago

In future, please open a discussion to get agreement before submitting a PR!

I've considered doing this, since C.M moved away from the Bootstrapper<TRootViewModel> pattern, but never actually had enough of a need: if you don't need TRootViewModel, just pass any old thing and override either Launch or DisplayRootView.

What's the problem you're trying to solve here, which can't be solved by overriding Launch?

canton7 commented 3 years ago

After pondering, I guess its worth doing this, but I'm not sure about the name (can't come up with a good alternative but I'll keep thinking) and I think Launch needs to be abstract

mwdpb commented 3 years ago

In future, please open a discussion to get agreement before submitting a PR!

I've considered doing this, since C.M moved away from the Bootstrapper<TRootViewModel> pattern, but never actually had enough of a need: if you don't need TRootViewModel, just pass any old thing and override either Launch or DisplayRootView.

What's the problem you're trying to solve here, which can't be solved by overriding Launch?

Will do. BTW, what's the preferred way to discuss PR agreement? Email or discussion board?

canton7 commented 3 years ago

Cheers. Discussions for potential features, issues for bugs.

mwdpb commented 3 years ago

Cheers. Discussions for potential features, issues for bugs.

Got it. I think the NoRootView feature is warranted, I myself had two cases recently that are using Stylet to develop WPF libraries (non standalone WPF application). And GF-Huang's thread also showed similar need. It's true you could pass a dummy class to it to get away with existing code, but not ideal.

canton7 commented 3 years ago

All the libraries I've written which had a bootstrapper also had a root vm, it something which was treated as the main window. Often the consuming application would define the bootstrapper itself.

The concept of a main window is very much baked into WPF, don't forget

Not that I'm too opposed to this, just arguing the case before deciding whether to add extra complexity to something which already confuses people

canton7 commented 3 years ago

I had to rebase this onto develop, which loses the link with GitHub unfortunately. Merged (after tweaking) as d228af4ccc1aebdf72fad1bbfa8d9c2e88b7ecdf. Thanks!