Changeset 279 for branches/3.0/sources/HeuristicLab
- Timestamp:
- 05/30/08 13:41:27 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/sources/HeuristicLab/MainForm.cs
r278 r279 94 94 PluginManager.Manager.Action += new PluginManagerActionEventHandler(splashScreen.Manager_Action); 95 95 Thread t = new Thread(delegate() { 96 PluginManager.Manager.Run(app); 96 bool stopped = false; 97 do { 98 try { 99 PluginManager.Manager.Run(app); 100 stopped = true; 101 } catch(Exception ex) { 102 stopped = false; 103 ThreadPool.QueueUserWorkItem(delegate(object exception) { ShowErrorMessageBox((Exception)exception); }, ex); 104 Thread.Sleep(5000); // sleep 5 seconds before autorestart 105 } 106 } while(!stopped && app.AutoRestart); 97 107 }); 98 108 t.SetApartmentState(ApartmentState.STA); // needed for the AdvancedOptimizationFrontent … … 122 132 } 123 133 134 public void ShowErrorMessageBox(Exception ex) { 135 MessageBox.Show(BuildErrorMessage(ex), 136 "Error - " + ex.GetType().Name, 137 MessageBoxButtons.OK, 138 MessageBoxIcon.Error); 139 } 140 private string BuildErrorMessage(Exception ex) { 141 StringBuilder sb = new StringBuilder(); 142 sb.Append("Sorry, but something went wrong!\n\n" + ex.Message + "\n\n" + ex.StackTrace); 143 144 while(ex.InnerException != null) { 145 ex = ex.InnerException; 146 sb.Append("\n\n-----\n\n" + ex.Message + "\n\n" + ex.StackTrace); 147 } 148 return sb.ToString(); 149 } 124 150 } 125 151 }
Note: See TracChangeset
for help on using the changeset viewer.