private void dgv_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if ((e.RowIndex < 0) || (e.ColumnIndex < 0)) // no selector or header return; string filename = dgv.Rows[e.RowIndex].Cells["SrcPath"].Value.ToString(); // Check if form is already available foreach (SourceForm srcform in SrcForms) { if (srcform.Filename == filename) // Is form for this file open? { srcform.Focus(); return; } } // search for the source file data to create new form.. for (int i = prj.Files.Count; i > 0; i--) { CodePortingTrackerSourceFile src = prj.Files[i-1]; if (src.Filename == filename) { try { SourceForm form = new SourceForm(this, ref src); form.MdiParent = MdiParent; SrcForms.Add(form); form.Show(); } catch (Exception) { } return; } } throw new Exception("Cannot open source file because of an error while parsing project file!"); }
/// <summary> /// Called by source form when closed /// </summary> /// <param name="srcform">form that was closed</param> public void SrcFormClosed(SourceForm srcform) { // remove from internal list of open forms.. SrcForms.Remove(srcform); }