Changeset 2555
- Timestamp:
- 12/14/09 00:23:57 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/IItemView.cs
r2547 r2555 40 40 /// </summary> 41 41 event EventHandler ItemChanged; 42 43 event EventHandler Closed;44 42 } 45 43 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemViewBase.cs
r2547 r2555 112 112 } 113 113 114 public event EventHandler Closed;115 public override void OnClosed(object sender, EventArgs e) {116 base.OnClosed(sender, e);117 if (Closed != null)118 Closed(this, e);119 }120 121 114 /// <summary> 122 115 /// Asynchron call of GUI updating. -
trunk/sources/HeuristicLab.Optimizer/3.3/FileManager.cs
r2547 r2555 46 46 waitingCursors = 0; 47 47 newDocumentsCounter = 1; 48 // NOTE: Events fired by the main form are registered in HeuristicLabOptimizerApplication. 48 49 } 49 50 … … 51 52 if (newItemDialog == null) newItemDialog = new NewItemDialog(); 52 53 if (newItemDialog.ShowDialog() == DialogResult.OK) { 53 IItemView view = MainFormManager.CreateDefaultView(newItemDialog.Item) as IItemView; 54 if (view != null) { 55 view.Closed += new EventHandler(ViewClosed); 54 IView view = MainFormManager.CreateDefaultView(newItemDialog.Item); 55 if (view is IItemView) { 56 56 view.Caption = "Item" + newDocumentsCounter.ToString() + ".hl"; 57 57 newDocumentsCounter++; 58 MainFormManager.MainForm.ShowView(view);59 58 } 59 MainFormManager.MainForm.ShowView(view); 60 60 } 61 61 } … … 140 140 } 141 141 142 private static void ViewClosed(object sender, EventArgs e) {143 IItemView view = (IItemView)sender;144 view.Closed -= new EventHandler(ViewClosed);142 // NOTE: This event is fired by the main form. It is registered in HeuristicLabOptimizerApplication. 143 internal static void ViewClosed(object sender, ViewEventArgs e) { 144 IItemView view = e.View as IItemView; 145 145 files.Remove(view); 146 146 } … … 187 187 IItemView view = MainFormManager.CreateDefaultView(item) as IItemView; 188 188 if (view != null) { 189 view.Closed += new EventHandler(ViewClosed);190 189 view.Caption = Path.GetFileName(filename); 191 190 files.Add(view, new FileInfo(filename)); -
trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLabOptimizerApplication.cs
r2547 r2555 27 27 using HeuristicLab.PluginInfrastructure; 28 28 using HeuristicLab.Common.Resources; 29 using HeuristicLab.MainForm; 29 30 using HeuristicLab.MainForm.WindowsForms; 30 31 … … 34 35 public override void Run() { 35 36 OptimizerMainForm mainForm = new OptimizerMainForm(typeof(IOptimizerUserInterfaceItemProvider)); 37 mainForm.ViewClosed += new EventHandler<ViewEventArgs>(FileManager.ViewClosed); 36 38 Application.Run(mainForm); 37 39 } -
trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/SaveAllMenuItem.cs
r2546 r2555 8 8 using HeuristicLab.MainForm.WindowsForms; 9 9 using HeuristicLab.Common.Resources; 10 using HeuristicLab.Core; 11 using HeuristicLab.Core.Views; 10 12 11 13 namespace HeuristicLab.Optimizer.MenuItems { … … 31 33 } 32 34 public override void ActiveViewChanged(object sender, EventArgs e) { 33 ToolStripItem.Enabled = MainFormManager.MainForm.Views.FirstOrDefault() != null; 35 var views = from v in MainFormManager.MainForm.Views 36 where v is IItemView 37 where CreatableAttribute.IsCreatable(((IItemView)v).Item.GetType()) 38 select v; 39 ToolStripItem.Enabled = views.FirstOrDefault() != null; 34 40 } 35 41 -
trunk/sources/HeuristicLab.Optimizer/3.3/ToolBarItems/SaveAllToolBarItem.cs
r2546 r2555 8 8 using HeuristicLab.MainForm.WindowsForms; 9 9 using HeuristicLab.Common.Resources; 10 using HeuristicLab.Core; 11 using HeuristicLab.Core.Views; 10 12 11 13 namespace HeuristicLab.Optimizer { … … 28 30 } 29 31 public override void ActiveViewChanged(object sender, EventArgs e) { 30 ToolStripItem.Enabled = MainFormManager.MainForm.Views.FirstOrDefault() != null; 32 var views = from v in MainFormManager.MainForm.Views 33 where v is IItemView 34 where CreatableAttribute.IsCreatable(((IItemView)v).Item.GetType()) 35 select v; 36 ToolStripItem.Enabled = views.FirstOrDefault() != null; 31 37 } 32 38
Note: See TracChangeset
for help on using the changeset viewer.