Changeset 3500 for trunk/sources/HeuristicLab.Optimization.Views/3.3
- Timestamp:
- 04/22/10 23:33:13 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Views/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r3455 r3500 187 187 openFileDialog.Title = "Open Problem"; 188 188 if (openFileDialog.ShowDialog(this) == DialogResult.OK) { 189 this.Cursor = Cursors.AppStarting;190 189 newProblemButton.Enabled = openProblemButton.Enabled = false; 191 190 problemViewHost.Enabled = false; 192 191 193 var call = new Func<string, object>(XmlParser.Deserialize); 194 call.BeginInvoke(openFileDialog.FileName, delegate(IAsyncResult a) { 195 IProblem problem = null; 192 ContentManager.LoadAsync(openFileDialog.FileName, delegate(IStorableContent content, Exception error) { 196 193 try { 197 problem = call.EndInvoke(a) as IProblem; 198 } catch (Exception ex) { 199 Auxiliary.ShowErrorMessageBox(ex); 200 } 201 Invoke(new Action(delegate() { 194 if (error != null) throw error; 195 IProblem problem = content as IProblem; 202 196 if (problem == null) 203 197 MessageBox.Show(this, "The selected file does not contain a problem.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error); … … 206 200 else 207 201 Content.Problem = problem; 208 problemViewHost.Enabled = true; 209 newProblemButton.Enabled = openProblemButton.Enabled = true; 210 this.Cursor = Cursors.Default; 211 })); 212 }, null); 202 } 203 catch (Exception ex) { 204 Auxiliary.ShowErrorMessageBox(ex); 205 } 206 finally { 207 Invoke(new Action(delegate() { 208 problemViewHost.Enabled = true; 209 newProblemButton.Enabled = openProblemButton.Enabled = true; 210 })); 211 } 212 }); 213 213 } 214 214 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs
r3455 r3500 174 174 openFileDialog.Title = "Open Algorithm"; 175 175 if (openFileDialog.ShowDialog(this) == DialogResult.OK) { 176 this.Cursor = Cursors.AppStarting;177 176 newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = false; 178 177 algorithmViewHost.Enabled = false; 179 178 180 var call = new Func<string, object>(XmlParser.Deserialize); 181 call.BeginInvoke(openFileDialog.FileName, delegate(IAsyncResult a) { 182 IAlgorithm algorithm = null; 179 ContentManager.LoadAsync(openFileDialog.FileName, delegate(IStorableContent content, Exception error) { 183 180 try { 184 algorithm = call.EndInvoke(a) as IAlgorithm; 185 } catch (Exception ex) { 186 Auxiliary.ShowErrorMessageBox(ex); 187 } 188 Invoke(new Action(delegate() { 181 if (error != null) throw error; 182 IAlgorithm algorithm = content as IAlgorithm; 189 183 if (algorithm == null) 190 184 MessageBox.Show(this, "The selected file does not contain an algorithm.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error); 191 185 else 192 186 Content.Algorithm = algorithm; 193 algorithmViewHost.Enabled = true; 194 newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = true; 195 this.Cursor = Cursors.Default; 196 })); 197 }, null); 187 } 188 catch (Exception ex) { 189 Auxiliary.ShowErrorMessageBox(ex); 190 } 191 finally { 192 Invoke(new Action(delegate() { 193 algorithmViewHost.Enabled = true; 194 newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = true; 195 })); 196 } 197 }); 198 198 } 199 199 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.cs
r3455 r3500 80 80 openFileDialog.Title = "Open Operator Graph"; 81 81 if (openFileDialog.ShowDialog(this) == DialogResult.OK) { 82 this.Cursor = Cursors.AppStarting;83 82 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = false; 84 83 operatorGraphViewHost.Enabled = false; 85 84 86 var call = new Func<string, object>(XmlParser.Deserialize); 87 call.BeginInvoke(openFileDialog.FileName, delegate(IAsyncResult a) { 88 OperatorGraph operatorGraph = null; 85 ContentManager.LoadAsync(openFileDialog.FileName, delegate(IStorableContent content, Exception error) { 89 86 try { 90 operatorGraph = call.EndInvoke(a) as OperatorGraph; 87 if (error != null) throw error; 88 OperatorGraph operatorGraph = content as OperatorGraph; 89 if (operatorGraph == null) 90 MessageBox.Show(this, "The selected file does not contain an operator graph.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error); 91 else 92 Content.OperatorGraph = operatorGraph; 91 93 } 92 94 catch (Exception ex) { 93 95 Auxiliary.ShowErrorMessageBox(ex); 94 96 } 95 Invoke(new Action(delegate() { 96 if (operatorGraph == null) 97 MessageBox.Show(this, "The selected file does not contain an operator graph.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error); 98 else 99 Content.OperatorGraph = operatorGraph; 100 operatorGraphViewHost.Enabled = true; 101 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = true; 102 this.Cursor = Cursors.Default; 103 })); 104 }, null); 97 finally { 98 Invoke(new Action(delegate() { 99 operatorGraphViewHost.Enabled = true; 100 newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = true; 101 })); 102 } 103 }); 105 104 } 106 105 }
Note: See TracChangeset
for help on using the changeset viewer.