/// <summary> /// Edit the given project. /// </summary> /// <param name="project">The project to edit.</param> private void EditProject( DBObjects.Project project ) { // Avoid duplicates, try to locate any already open project // edit form for the given project. bool isOpen = false; foreach ( Form form in Application.OpenForms ) { if ( form is ProjectEditForm ) { ProjectEditForm projectForm = form as ProjectEditForm; if ( projectForm.Item.ID == project.ID ) { isOpen = true; projectForm.BringToFront(); projectForm.Select(); break; } } } if ( !isOpen ) { ProjectEditForm form = new ProjectEditForm( project ); form.Show( this ); } }
private void newProjectToolStripMenuItem_Click( object sender, EventArgs e ) { DBObjects.Project project = new DBObjects.Project(); ProjectEditForm form = new ProjectEditForm( project ); form.Show( this ); }