Changeset 1921 for trunk/sources/HeuristicLab.AdvancedOptimizationFrontend
- Timestamp:
- 05/27/09 18:12:38 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.AdvancedOptimizationFrontend/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.AdvancedOptimizationFrontend/3.3/MainForm.Designer.cs
r1529 r1921 103 103 this.exitToolStripMenuItem}); 104 104 this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; 105 this.fileToolStripMenuItem.Size = new System.Drawing.Size(3 5, 20);105 this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); 106 106 this.fileToolStripMenuItem.Text = "&File"; 107 107 // … … 109 109 // 110 110 this.newToolStripMenuItem.Name = "newToolStripMenuItem"; 111 this.newToolStripMenuItem.Size = new System.Drawing.Size(1 91, 22);111 this.newToolStripMenuItem.Size = new System.Drawing.Size(187, 22); 112 112 this.newToolStripMenuItem.Text = "&New"; 113 113 // … … 116 116 this.openToolStripMenuItem.Name = "openToolStripMenuItem"; 117 117 this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); 118 this.openToolStripMenuItem.Size = new System.Drawing.Size(1 91, 22);118 this.openToolStripMenuItem.Size = new System.Drawing.Size(187, 22); 119 119 this.openToolStripMenuItem.Text = "&Open..."; 120 120 this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); … … 125 125 this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; 126 126 this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); 127 this.saveToolStripMenuItem.Size = new System.Drawing.Size(1 91, 22);127 this.saveToolStripMenuItem.Size = new System.Drawing.Size(187, 22); 128 128 this.saveToolStripMenuItem.Text = "&Save"; 129 129 this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); … … 133 133 this.saveAsToolStripMenuItem.Enabled = false; 134 134 this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; 135 this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(1 91, 22);135 this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(187, 22); 136 136 this.saveAsToolStripMenuItem.Text = "Save &As..."; 137 137 this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click); … … 143 143 this.saveAllToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) 144 144 | System.Windows.Forms.Keys.S))); 145 this.saveAllToolStripMenuItem.Size = new System.Drawing.Size(1 91, 22);145 this.saveAllToolStripMenuItem.Size = new System.Drawing.Size(187, 22); 146 146 this.saveAllToolStripMenuItem.Text = "Save Al&l"; 147 147 this.saveAllToolStripMenuItem.Click += new System.EventHandler(this.saveAllToolStripMenuItem_Click); … … 151 151 this.closeToolStripMenuItem.Enabled = false; 152 152 this.closeToolStripMenuItem.Name = "closeToolStripMenuItem"; 153 this.closeToolStripMenuItem.Size = new System.Drawing.Size(1 91, 22);153 this.closeToolStripMenuItem.Size = new System.Drawing.Size(187, 22); 154 154 this.closeToolStripMenuItem.Text = "&Close"; 155 155 this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click); … … 159 159 this.closeAllToolStripMenuItem.Enabled = false; 160 160 this.closeAllToolStripMenuItem.Name = "closeAllToolStripMenuItem"; 161 this.closeAllToolStripMenuItem.Size = new System.Drawing.Size(1 91, 22);161 this.closeAllToolStripMenuItem.Size = new System.Drawing.Size(187, 22); 162 162 this.closeAllToolStripMenuItem.Text = "Clos&e All"; 163 163 this.closeAllToolStripMenuItem.Click += new System.EventHandler(this.closeAllToolStripMenuItem_Click); … … 166 166 // 167 167 this.toolStripMenuItem1.Name = "toolStripMenuItem1"; 168 this.toolStripMenuItem1.Size = new System.Drawing.Size(18 8, 6);168 this.toolStripMenuItem1.Size = new System.Drawing.Size(184, 6); 169 169 // 170 170 // exitToolStripMenuItem 171 171 // 172 172 this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; 173 this.exitToolStripMenuItem.Size = new System.Drawing.Size(1 91, 22);173 this.exitToolStripMenuItem.Size = new System.Drawing.Size(187, 22); 174 174 this.exitToolStripMenuItem.Text = "E&xit"; 175 175 this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); … … 180 180 this.availableOperatorsToolStripMenuItem}); 181 181 this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; 182 this.viewToolStripMenuItem.Size = new System.Drawing.Size(4 1, 20);182 this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20); 183 183 this.viewToolStripMenuItem.Text = "&View"; 184 184 // … … 186 186 // 187 187 this.availableOperatorsToolStripMenuItem.Name = "availableOperatorsToolStripMenuItem"; 188 this.availableOperatorsToolStripMenuItem.Size = new System.Drawing.Size(1 92, 22);188 this.availableOperatorsToolStripMenuItem.Size = new System.Drawing.Size(186, 22); 189 189 this.availableOperatorsToolStripMenuItem.Text = "Available &Operators..."; 190 190 this.availableOperatorsToolStripMenuItem.Click += new System.EventHandler(this.availableOperatorsToolStripMenuItem_Click); … … 195 195 this.collectGarbageToolStripMenuItem}); 196 196 this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; 197 this.toolsToolStripMenuItem.Size = new System.Drawing.Size(4 4, 20);197 this.toolsToolStripMenuItem.Size = new System.Drawing.Size(48, 20); 198 198 this.toolsToolStripMenuItem.Text = "&Tools"; 199 199 // … … 201 201 // 202 202 this.collectGarbageToolStripMenuItem.Name = "collectGarbageToolStripMenuItem"; 203 this.collectGarbageToolStripMenuItem.Size = new System.Drawing.Size(1 61, 22);203 this.collectGarbageToolStripMenuItem.Size = new System.Drawing.Size(158, 22); 204 204 this.collectGarbageToolStripMenuItem.Text = "Collect &Garbage"; 205 205 this.collectGarbageToolStripMenuItem.Click += new System.EventHandler(this.collectGarbageToolStripMenuItem_Click); … … 210 210 this.aboutToolStripMenuItem}); 211 211 this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; 212 this.helpToolStripMenuItem.Size = new System.Drawing.Size(4 0, 20);212 this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); 213 213 this.helpToolStripMenuItem.Text = "&Help"; 214 214 // … … 216 216 // 217 217 this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; 218 this.aboutToolStripMenuItem.Size = new System.Drawing.Size(1 14, 22);218 this.aboutToolStripMenuItem.Size = new System.Drawing.Size(107, 22); 219 219 this.aboutToolStripMenuItem.Text = "&About"; 220 220 this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); … … 238 238 this.saveFileDialog.DefaultExt = "hl"; 239 239 this.saveFileDialog.FileName = "item"; 240 this.saveFileDialog.Filter = "HeuristicLab files|*.hl|All files|*.*";240 this.saveFileDialog.Filter = "HeuristicLab archives|*.hl|Compressed HeuristicLab archives|*.hl|All files|*.*"; 241 241 this.saveFileDialog.Title = "Save file as ..."; 242 242 // -
trunk/sources/HeuristicLab.AdvancedOptimizationFrontend/3.3/MainForm.cs
r1853 r1921 184 184 else { 185 185 editor.Filename = task.filename; 186 editor.SaveFinished += new EventHandler(SaveFinished); 186 187 PluginManager.ControlManager.ShowControl(editor); 187 188 } … … 193 194 } 194 195 } 196 195 197 private void Save(EditorForm form) { 196 198 if (form.Editor.Filename == null) 197 199 SaveAs(form); 198 200 else { 201 Cursor = Cursors.AppStarting; 199 202 lock (locker) runningTasks++; 200 Cursor = Cursors.AppStarting;201 ((Control)form.Editor).Enabled = false;202 203 EnableDisableItems(); 203 Task task = new Task(form.Editor.Filename, form.Editor.Item, form.Editor); 204 ThreadPool.QueueUserWorkItem(new WaitCallback(AsynchronousSave), task); 204 form.Editor.Save(); 205 205 } 206 206 } 207 207 private void SaveAs(EditorForm form) { 208 if (form.Editor.Compressed) 209 saveFileDialog.FilterIndex = 2; 210 else 211 saveFileDialog.FilterIndex = 1; 212 208 213 if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { 209 214 form.Editor.Filename = saveFileDialog.FileName; 215 form.Editor.Compressed = saveFileDialog.FilterIndex == 2; 210 216 Save(form); 211 217 } 212 213 } 214 private void AsynchronousSave(object state) { 215 Task task = (Task)state; 216 try { 217 PersistenceManager.Save(task.storable, task.filename); 218 } catch (Exception e) { 219 MessageBox.Show(String.Format( 220 "Sorry couldn't save file \"{0}\".\n The following exception occurred: {1}", 221 task.filename, e.ToString()), 222 "Reader Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 223 } 224 SaveFinished(task); 225 } 226 private void SaveFinished(Task task) { 218 } 219 private void SaveFinished(object sender, EventArgs e) { 227 220 if (InvokeRequired) 228 Invoke(new TaskFinishedDelegate(SaveFinished), task);221 Invoke(new EventHandler(SaveFinished), sender, e); 229 222 else { 230 ((Control)task.editor).Enabled = true;231 223 EnableDisableItems(); 232 224 lock (locker) { … … 255 247 MessageBox.Show("The selected item doesn't provide an editor.", "Editor Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 256 248 } else { 249 editor.SaveFinished += new EventHandler(SaveFinished); 257 250 PluginManager.ControlManager.ShowControl(editor); 258 251 EnableDisableItems();
Note: See TracChangeset
for help on using the changeset viewer.