Reputation: 36205
I am currently developing a C# WPF project. The solution has two projects, one called GUI which contains all the Windows and GUI controls of the program and a second project called coding which contains all the classes and logic to ensure that if I change the logic, it doesn't affect the working of the GUI.
In the GUI project I have added a reference to the coding project and said using Coding, and this allows me to access the logic classes from the GUI screens.
However, if in the Coding logic class project I want to load a new window from the GUI project how do I go about doing this. If I try and add a reference to the GUI project from the coding project it says that this can't be done as it creates a circular dependency.
How can I reference both the projects together so that GUI can access logic classes from the coding project and reference the gui project from the coding project so the coding logic class can open a new window from the gui project.
Thanks for any help you can provide.
Upvotes: 0
Views: 686
Reputation: 805
When we talk about WPF and SOC "Seperation of Concerns" , this lead us directly to MVVM , here a simple explanation
Upvotes: 0
Reputation: 62504
You can decouple it by introducing the third project Common
and move out Window and other shared classes into it. Then Gui
and Coding
projects can easily reference Common
.
BTW, try to rethink your design because I'm worried that Coding
project is aware of UI
entities.
EDIT:
In WPF you can decouple UI stuff from a logic by using Commands
, see whether yu can achieve this.
Upvotes: 1