- Timestamp:
- 04/22/10 23:33:13 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.