Changeset 2656 for trunk/sources/HeuristicLab.Optimizer
- Timestamp:
- 01/20/10 05:10:22 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimizer/3.3
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimizer/3.3/FileManager.cs
r2557 r2656 32 32 #endregion 33 33 34 private static Dictionary<I ItemView, FileInfo> files;34 private static Dictionary<IObjectView, FileInfo> files; 35 35 private static NewItemDialog newItemDialog; 36 36 private static OpenFileDialog openFileDialog; … … 40 40 41 41 static FileManager() { 42 files = new Dictionary<I ItemView, FileInfo>();42 files = new Dictionary<IObjectView, FileInfo>(); 43 43 newItemDialog = null; 44 44 openFileDialog = null; … … 53 53 if (newItemDialog.ShowDialog() == DialogResult.OK) { 54 54 IView view = MainFormManager.CreateDefaultView(newItemDialog.Item); 55 if (view is I ItemView) {55 if (view is IObjectView) { 56 56 view.Caption = "Item" + newDocumentsCounter.ToString() + ".hl"; 57 57 newDocumentsCounter++; … … 78 78 79 79 public static void Save() { 80 I ItemView activeView = MainFormManager.MainForm.ActiveView as IItemView;81 if ((activeView != null) && (CreatableAttribute.IsCreatable(activeView. Item.GetType()))) {80 IObjectView activeView = MainFormManager.MainForm.ActiveView as IObjectView; 81 if ((activeView != null) && (CreatableAttribute.IsCreatable(activeView.Object.GetType()))) { 82 82 Save(activeView); 83 83 } 84 84 } 85 private static void Save(I ItemView view) {85 private static void Save(IObjectView view) { 86 86 if ((!files.ContainsKey(view)) || (!File.Exists(files[view].Filename))) { 87 87 SaveAs(view); … … 95 95 96 96 public static void SaveAs() { 97 I ItemView activeView = MainFormManager.MainForm.ActiveView as IItemView;98 if ((activeView != null) && (CreatableAttribute.IsCreatable(activeView. Item.GetType()))) {97 IObjectView activeView = MainFormManager.MainForm.ActiveView as IObjectView; 98 if ((activeView != null) && (CreatableAttribute.IsCreatable(activeView.Object.GetType()))) { 99 99 SaveAs(activeView); 100 100 } 101 101 } 102 public static void SaveAs(I ItemView view) {102 public static void SaveAs(IObjectView view) { 103 103 if (saveFileDialog == null) { 104 104 saveFileDialog = new SaveFileDialog(); … … 131 131 public static void SaveAll() { 132 132 var views = from v in MainFormManager.MainForm.Views 133 where v is I ItemView134 where CreatableAttribute.IsCreatable(((I ItemView)v).Item.GetType())135 select v as I ItemView;136 137 foreach (I ItemView view in views) {133 where v is IObjectView 134 where CreatableAttribute.IsCreatable(((IObjectView)v).Object.GetType()) 135 select v as IObjectView; 136 137 foreach (IObjectView view in views) { 138 138 Save(view); 139 139 } … … 142 142 // NOTE: This event is fired by the main form. It is registered in HeuristicLabOptimizerApplication. 143 143 internal static void ViewClosed(object sender, ViewEventArgs e) { 144 I ItemView view = e.View as IItemView;145 files.Remove(view);144 IObjectView view = e.View as IObjectView; 145 if (view != null) files.Remove(view); 146 146 } 147 147 … … 155 155 } 156 156 157 private static void SaveItemAsync(I ItemView view, string filename, int compression) {157 private static void SaveItemAsync(IObjectView view, string filename, int compression) { 158 158 ThreadPool.QueueUserWorkItem( 159 159 new WaitCallback( … … 162 162 DisableView(view); 163 163 SetWaitingCursor(); 164 XmlGenerator.Serialize(view. Item, filename, compression);164 XmlGenerator.Serialize(view.Object, filename, compression); 165 165 Invoke(delegate() { 166 166 view.Caption = Path.GetFileName(filename); … … 187 187 IItem item = (IItem)XmlParser.Deserialize(filename); 188 188 Invoke(delegate() { 189 I ItemView view = MainFormManager.CreateDefaultView(item) as IItemView;189 IObjectView view = MainFormManager.CreateDefaultView(item) as IObjectView; 190 190 if (view != null) { 191 191 view.Caption = Path.GetFileName(filename); -
trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj
r2547 r2656 54 54 <Compile Include="MenuItems\CloseMenuItem.cs" /> 55 55 <Compile Include="MenuItems\CloseAllMenuItem.cs" /> 56 <Compile Include="MenuItems\OperatorsMenuItem.cs" /> 56 57 <Compile Include="MenuItems\SaveAllMenuItem.cs" /> 57 58 <Compile Include="MenuItems\SaveAsMenuItem.cs" /> -
trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLabOptimizerApplication.cs
r2555 r2656 31 31 32 32 namespace HeuristicLab.Optimizer { 33 [ ClassInfo(Name = "Optimizer 3.3", Description="Next generation heuristic optimization environment.")]33 [Application("Optimizer 3.3", "Next generation heuristic optimization environment.")] 34 34 internal class HeuristicLabOptimizerApplication : ApplicationBase { 35 35 public override void Run() { -
trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLabOptimizerPlugin.cs
r2546 r2656 26 26 27 27 namespace HeuristicLab.Optimizer { 28 [ ClassInfo(Name ="HeuristicLab.Optimizer-3.3")]29 [PluginFile( Filename = "HeuristicLab.Optimizer-3.3.dll", Filetype =PluginFileType.Assembly)]30 [ Dependency(Dependency ="HeuristicLab.Persistence-3.3")]31 [ Dependency(Dependency ="HeuristicLab.Common.Resources-3.2")]32 [ Dependency(Dependency ="HeuristicLab.Core-3.3")]33 [ Dependency(Dependency ="HeuristicLab.Core.Views-3.3")]34 [ Dependency(Dependency ="HeuristicLab.MainForm-3.2")]35 [ Dependency(Dependency ="HeuristicLab.MainForm.WindowsForms-3.2")]28 [Plugin("HeuristicLab.Optimizer-3.3")] 29 [PluginFile("HeuristicLab.Optimizer-3.3.dll", PluginFileType.Assembly)] 30 [PluginDependency("HeuristicLab.Persistence-3.3")] 31 [PluginDependency("HeuristicLab.Common.Resources-3.2")] 32 [PluginDependency("HeuristicLab.Core-3.3")] 33 [PluginDependency("HeuristicLab.Core.Views-3.3")] 34 [PluginDependency("HeuristicLab.MainForm-3.2")] 35 [PluginDependency("HeuristicLab.MainForm.WindowsForms-3.2")] 36 36 public class HeuristicLabOptimizerPlugin : PluginBase { 37 37 } -
trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/SaveAllMenuItem.cs
r2555 r2656 34 34 public override void ActiveViewChanged(object sender, EventArgs e) { 35 35 var views = from v in MainFormManager.MainForm.Views 36 where v is I ItemView37 where CreatableAttribute.IsCreatable(((I ItemView)v).Item.GetType())36 where v is IObjectView 37 where CreatableAttribute.IsCreatable(((IObjectView)v).Object.GetType()) 38 38 select v; 39 39 ToolStripItem.Enabled = views.FirstOrDefault() != null; -
trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/SaveAsMenuItem.cs
r2546 r2656 33 33 } 34 34 public override void ActiveViewChanged(object sender, EventArgs e) { 35 I ItemView activeView = MainFormManager.MainForm.ActiveView as IItemView;36 ToolStripItem.Enabled = ((activeView != null) && (CreatableAttribute.IsCreatable(activeView. Item.GetType())));35 IObjectView activeView = MainFormManager.MainForm.ActiveView as IObjectView; 36 ToolStripItem.Enabled = ((activeView != null) && (CreatableAttribute.IsCreatable(activeView.Object.GetType()))); 37 37 } 38 38 -
trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/SaveMenuItem.cs
r2546 r2656 36 36 } 37 37 public override void ActiveViewChanged(object sender, EventArgs e) { 38 I ItemView activeView = MainFormManager.MainForm.ActiveView as IItemView;39 ToolStripItem.Enabled = ((activeView != null) && (CreatableAttribute.IsCreatable(activeView. Item.GetType())));38 IObjectView activeView = MainFormManager.MainForm.ActiveView as IObjectView; 39 ToolStripItem.Enabled = ((activeView != null) && (CreatableAttribute.IsCreatable(activeView.Object.GetType()))); 40 40 } 41 41 -
trunk/sources/HeuristicLab.Optimizer/3.3/NewItemDialog.cs
r2546 r2656 32 32 SetListViewDisplayStyleCheckBoxes(); 33 33 34 DiscoveryService ds = new DiscoveryService(); 35 var categories = from t in ds.GetTypes(typeof(IItem)) 34 var categories = from t in ApplicationManager.Manager.GetTypes(typeof(IItem)) 36 35 where CreatableAttribute.IsCreatable(t) 37 36 orderby CreatableAttribute.GetCategory(t), ItemAttribute.GetName(t) ascending … … 46 45 IItem i = (IItem)Activator.CreateInstance(creatable); 47 46 items.Add(i); 48 ListViewItem item = new ListViewItem(new string[] { i. Name, i.Description}, group);49 itemsListView.SmallImageList.Images.Add(i.I mage);47 ListViewItem item = new ListViewItem(new string[] { i.ItemName, i.ItemDescription}, group); 48 itemsListView.SmallImageList.Images.Add(i.ItemImage); 50 49 item.ImageIndex = itemsListView.SmallImageList.Images.Count - 1; 51 50 item.Tag = i; -
trunk/sources/HeuristicLab.Optimizer/3.3/OptimizerMainForm.Designer.cs
r2547 r2656 30 30 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 31 31 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 32 this.ClientSize = new System.Drawing.Size( 784, 564);32 this.ClientSize = new System.Drawing.Size(984, 714); 33 33 this.Name = "OptimizerMainForm"; 34 34 this.Text = "HeuristicLab Optimizer"; -
trunk/sources/HeuristicLab.Optimizer/3.3/ToolBarItems/SaveAllToolBarItem.cs
r2555 r2656 31 31 public override void ActiveViewChanged(object sender, EventArgs e) { 32 32 var views = from v in MainFormManager.MainForm.Views 33 where v is I ItemView34 where CreatableAttribute.IsCreatable(((I ItemView)v).Item.GetType())33 where v is IObjectView 34 where CreatableAttribute.IsCreatable(((IObjectView)v).Object.GetType()) 35 35 select v; 36 36 ToolStripItem.Enabled = views.FirstOrDefault() != null; -
trunk/sources/HeuristicLab.Optimizer/3.3/ToolBarItems/SaveToolBarItem.cs
r2546 r2656 30 30 } 31 31 public override void ActiveViewChanged(object sender, EventArgs e) { 32 I ItemView activeView = MainFormManager.MainForm.ActiveView as IItemView;33 ToolStripItem.Enabled = ((activeView != null) && (CreatableAttribute.IsCreatable(activeView. Item.GetType())));32 IObjectView activeView = MainFormManager.MainForm.ActiveView as IObjectView; 33 ToolStripItem.Enabled = ((activeView != null) && (CreatableAttribute.IsCreatable(activeView.Object.GetType()))); 34 34 } 35 35
Note: See TracChangeset
for help on using the changeset viewer.