xsharp.eu • MVVM: how to open a lookup window - Page 4
Page 4 of 4

MVVM: how to open a lookup window

Posted: Tue Dec 27, 2016 12:27 pm
by wriedmann
Hi Nick,

after reading all posts in this thread multiple times and combining it with my needs, I'm now planning the following architecture for my applications (I need modular applications where the modules are coupled together at runtime via configuration files or a configuration database):

The program at startup should create the WorkspaceFactory, a singleton object. That should create then the ShellWindow (a window with only a top menu, a left menu pane and a tabcontrol for the remainder of the canvas).

Then, a module load class loads the needed assemblies, and calls an initialization method for every class in these assemblies that implements a specific interface (this code is already working). This initialization method registers the needed menu entries view/viewmodel couples and checks for the needed database structure, creating and/or modifiying the tables in the database.

I have already such an architecture that works, but without the WorkspaceFactory and withoud messenger. The corresponding view to a viewmodel is found through a datatemplate created at runtime, and the tabcontrol is bound to a collection of viewmodels.

I need such a structure because we do personalized applications and have to integrate the, also with standard modules. In the VO world, every application is a distinct exe file but we need to change that for the next generation of our applications.

Is this structure that can be valid in your opinion or have I to change something?

Thank you very much!

Wolfgang

MVVM: how to open a lookup window

Posted: Tue Dec 27, 2016 11:24 pm
by wriedmann
Hi Nick,

I would need another clarification to see if I'm right:
The MainViewModel knows it MainView to simplify things. Otherwise it would be complicated that the MainViewModel could add/remove usercontrols to the MainView.
Or is it the following: the WorkSpaceFactory creates a new View/ViewModel couple and adds the view with its ViewModel to the MainView?

Wolfgang

MVVM: how to open a lookup window

Posted: Wed Dec 28, 2016 5:37 pm
by NickFriend
Hi Wolfgang,

That all sounds sensible to me.... the main thing of course is that it works for you. And as you say, I let the MainViewModel know about the MainView to simplify assigning usercontrols.

Good luck!

Nick

MVVM: how to open a lookup window

Posted: Wed Dec 28, 2016 10:12 pm
by wriedmann
Hi Nick,

thank you very much for your answer! I'll try to put things together and let you know.

Wolfgang

P.S. currently I'm on holiday in Mexico, driving around Yucatan, so I have plenty time to think about.