Quote:
Home_Page h = new Home_Page();
You can't call that, because the
Home_Page
class doesn't have a parameterless constructor. You need to pass in an instance of the
IGetAllItemClass
interface.
The simplest solution is to import the
Home_Page
instance as a parameter to the constructor of your
Login_Window
class:
private readonly Home_Page _homePage;
public Login_Window(..., Home_Page homePage)
{
...
_homePage = homePage;
}
public void ShowHomePage()
{
_homePage.ShowDialog();
}
That way, you're using the instance created by the Unity container, rather than trying to create a new instance manually.