public static void ShowOrActiveForm<T>(ref bool status, string FormName ,Dictionary<string,string> dic) where T : Form
{
Form fm;
if (!status)
{
fm = Application.OpenForms[FormName];
fm.Activate();
}
else
{
T t;
if (dic!=null&&dic.Count>0)
{
t = (T)Activator.CreateInstance(typeof(T),dic["userName"].ToString(), dic["path"].ToString());
t.Show();
status = false;
return;
}
t=(T)Activator.CreateInstance(typeof(T));
t.Show();
status = false;
}
}
{
Form fm;
if (!status)
{
fm = Application.OpenForms[FormName];
fm.Activate();
}
else
{
T t;
if (dic!=null&&dic.Count>0)
{
t = (T)Activator.CreateInstance(typeof(T),dic["userName"].ToString(), dic["path"].ToString());
t.Show();
status = false;
return;
}
t=(T)Activator.CreateInstance(typeof(T));
t.Show();
status = false;
}
}