private void menu_project_new_Click(object sender, EventArgs e) { if (IsProjectSaved()) { if (ofd_openimage.ShowDialog() == DialogResult.OK) { GAVectorProject newcp = new GAVectorProject(); newcp.Properties = new GAProjectProperties(); Bitmap b = new Bitmap(ofd_openimage.FileName); newcp.SourceImage = new FastBitmap(b); newcp.BestComparison = double.MaxValue; fm_projectproperties frm = new fm_projectproperties(); frm.LoadProperties(newcp.Properties); if (frm.ShowDialog() == DialogResult.OK) { newcp.BestYet = new GARepresentation(newcp.SourceImage.GetBitmap(), 10); newcp.Properties = frm.GetProperties(); newcp.Changed = true; CurrentProject = newcp; displaysourcebitmap = (Bitmap)CurrentProject.SourceImage.GetBitmap().Clone(); changed = true; } else { // Cancelled, clean it all up newcp = null; } } } UpdateControlEnabled(); }
private void LoadProject(string filename) { try { GAVectorProject openproj = new GAVectorProject(filename); openproj.Filename = filename; CurrentProject = openproj; CurrentProject.Changed = false; displaysourcebitmap = (Bitmap)CurrentProject.SourceImage.GetBitmap().Clone(); DisplayRepresentation(CurrentProject.BestYet); UpdateBestComparison(); changed = true; } catch (Exception ex) { MessageBox.Show("A Problem occured loading the project:\n\n" + ex.Message, "Error while loading project", MessageBoxButtons.OK); } }