hi
i am using vs2010 c# wpf application.
i have one code for windows application i.e when i pass windows form name , it check if already open then it will reactivate , if not open then it create new object and open it. the code as given below.
but i am deveoping wpf application i want use this code but this code not working...
any body know how to convert this code to wpf?
public void NodeClick(string formName)
{
switch (formName)
{
case "frmPartMaster":
if ((partMaster = (frmPartMaster)IsFormAlreadyOpen(typeof(frmPartMaster))) == null)
{
partMaster = new frmPartMaster();
partMaster.Show(this);
}
else
{
partMaster.Activate();
partMaster.WindowState = FormWindowState.Normal;
partMaster.BringToFront();
}
break;
}
}
public static Form IsFormAlreadyOpen(Type FormType)
{
foreach (Form OpenForm in System.Windows.Forms.Application.OpenForms)
{
if (OpenForm.GetType() == FormType)
return OpenForm;
}
return null;
}
Best Regard Naweez