- Timestamp:
- 08/21/09 17:24:31 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm/3.2/SingleDocumentMainForm.cs
r2305 r2306 45 45 if (InvokeRequired) Invoke((Action<IView>)ShowView, view); 46 46 else { 47 base.ShowView(view); 48 DocumentForm form = new DocumentForm(view); 49 form.ShowInTaskbar = true; 50 form.Activated += new EventHandler(DockFormActivated); 51 form.FormClosing += new FormClosingEventHandler(view.FormClosing); 52 form.FormClosed += new FormClosedEventHandler(DockFormClosed); 53 foreach (IToolStripItem item in ToolStripItems) 54 view.StateChanged += new EventHandler(item.ViewChanged); 55 form.Show(this); 47 if (views.Contains(view)) { 48 DocumentForm documentForm = FindForm(view); 49 if (documentForm != null) 50 documentForm.Focus(); 51 } else { 52 base.ShowView(view); 53 DocumentForm form = new DocumentForm(view); 54 form.ShowInTaskbar = true; 55 form.Activated += new EventHandler(DockFormActivated); 56 form.FormClosing += new FormClosingEventHandler(view.FormClosing); 57 form.FormClosed += new FormClosedEventHandler(DockFormClosed); 58 foreach (IToolStripItem item in ToolStripItems) 59 view.StateChanged += new EventHandler(item.ViewChanged); 60 form.Show(this); 61 } 56 62 } 57 63 } 58 64 59 65 public override void CloseView(IView view) { 60 DocumentForm documentForm = this.OwnedForms.Cast<DocumentForm>().Where(df => df.View == view).Single(); 61 documentForm.Close(); 66 DocumentForm documentForm = FindForm(view); 67 if (documentForm != null) 68 documentForm.Close(); 62 69 } 63 70 … … 79 86 base.ActiveView = ((DocumentForm)sender).View; 80 87 } 88 89 protected DocumentForm FindForm(IView view) { 90 IEnumerable<DocumentForm> forms = this.OwnedForms.Cast<DocumentForm>().Where(df => df.View == view); 91 if (forms.Count() == 1) 92 return forms.Single(); 93 return null; 94 } 81 95 } 82 96 }
Note: See TracChangeset
for help on using the changeset viewer.