private void frmCowType_FormClosed(object sender, FormClosedEventArgs e) { MainFunction.AddOrRemaveChildName(pMdiParent: (mdiMain)this.MdiParent, pChildName: this.Name, pChildText: this.Text, pIsAdd: false); }
private void openChildren(PageNo pPageNo) { Type targetFormType = typeof(frmCowPart); if (pPageNo == PageNo.ManageStaff) { targetFormType = typeof(frmStaff); } else if (pPageNo == PageNo.ManageMember) { targetFormType = typeof(frmMember); } else if (pPageNo == PageNo.CowPart) { targetFormType = typeof(frmCowPart); } else if (pPageNo == PageNo.StaffTimeStamp) { targetFormType = typeof(frmStaffTimeStamp); } else if (pPageNo == PageNo.CowList) { targetFormType = typeof(frmCowList); } else if (pPageNo == PageNo.Department) { targetFormType = typeof(frmDepartment); } else if (pPageNo == PageNo.Faction) { targetFormType = typeof(frmFaction); } // tsmMainData else if (pPageNo == PageNo.CowBreed) { targetFormType = typeof(frmCowBreed); } else if (pPageNo == PageNo.CowHorn) { targetFormType = typeof(frmCowHorn); } else if (pPageNo == PageNo.CowPurpose) { targetFormType = typeof(frmCowPurpose); } else if (pPageNo == PageNo.CowStatus) { targetFormType = typeof(frmCowStatus); } else if (pPageNo == PageNo.CowGrowUpLevel) { targetFormType = typeof(frmCowGrowLevel); } else if (pPageNo == PageNo.CowColor) { targetFormType = typeof(frmCowColor); } else if (pPageNo == PageNo.CowStall) { targetFormType = typeof(frmCowStall); } else if (pPageNo == PageNo.CowLocation) { targetFormType = typeof(frmCowLocation); } bool isExist = false; foreach (Form f in this.MdiChildren) { if (f.GetType() == targetFormType) { f.Activate(); if (f.WindowState != FormWindowState.Maximized) { f.WindowState = FormWindowState.Maximized; } isExist = true; break; } } if (!isExist) { Form targetForm = null; if (pPageNo == PageNo.ManageStaff) { targetForm = new frmStaff(); } else if (pPageNo == PageNo.ManageMember) { targetForm = new frmMember(); } else if (pPageNo == PageNo.CowPart) { targetForm = new frmCowPart(); } else if (pPageNo == PageNo.StaffTimeStamp) { targetForm = new frmStaffTimeStamp();; } else if (pPageNo == PageNo.CowList) { targetForm = new frmCowList(); } else if (pPageNo == PageNo.Department) { targetForm = new frmDepartment(); } else if (pPageNo == PageNo.Faction) { targetForm = new frmFaction(); } // tsmMainData else if (pPageNo == PageNo.CowBreed) { targetForm = new frmCowBreed(); } else if (pPageNo == PageNo.CowHorn) { targetForm = new frmCowHorn(); } else if (pPageNo == PageNo.CowPurpose) { targetForm = new frmCowPurpose(); } else if (pPageNo == PageNo.CowStatus) { targetForm = new frmCowStatus(); } else if (pPageNo == PageNo.CowGrowUpLevel) { targetForm = new frmCowGrowLevel(); } else if (pPageNo == PageNo.CowColor) { targetForm = new frmCowColor(); } else if (pPageNo == PageNo.CowStall) { targetForm = new frmCowStall(); } else if (pPageNo == PageNo.CowLocation) { targetForm = new frmCowLocation(); } targetForm.MdiParent = this; targetForm.Show(); targetForm.WindowState = FormWindowState.Maximized; MainFunction.AddOrRemaveChildName(pMdiParent: this, pChildName: targetForm.Name, pChildText: targetForm.Text, pIsAdd: true); } }