/// <summary> /// Opens the projects form and/or click the add new button /// </summary> private void OpenProjectsToAdd() { //close chold of mdi if there is one active if (ActiveMdiChild != null) { if (ActiveMdiChild is ProjectsForm) { //click on the add button ProjectsForm form = (ProjectsForm)ActiveMdiChild; Button button = form.Controls.Find("projectsAddButton", true).FirstOrDefault() as Button; if (button != null) { button.PerformClick(); } } else { //Close child ActiveMdiChild.Close(); //Create new instance of form MasterListForm projectsForm = new TNG_Database.ProjectsForm(this, true); //show Master list form and maximize it instantly projectsForm.Show(); projectsForm.WindowState = FormWindowState.Maximized; } } ResetProgressBar(); }
/// <summary> /// Opens the projects page. /// </summary> private void OpenProjectsPage() { //Create new instance of form MasterListForm projectsForm = new TNG_Database.ProjectsForm(this); //close chold of mdi if there is one active if (ActiveMdiChild != null) { if(ActiveMdiChild is ProjectsForm) { //Do Nothing }else { //Close child ActiveMdiChild.Close(); } } //show Master list form and maximize it instantly projectsForm.Show(); projectsForm.WindowState = FormWindowState.Maximized; ResetProgressBar(); }