Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/30/08 13:41:27 (16 years ago)
Author:
gkronber
Message:

merged changesets r219:r228, r240, r241:258, r263:265, r267,r268, r269 from trunk into the HL3 stable branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/sources/HeuristicLab/MainForm.cs

    r278 r279  
    9494          PluginManager.Manager.Action += new PluginManagerActionEventHandler(splashScreen.Manager_Action);
    9595          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);
    97107          });
    98108          t.SetApartmentState(ApartmentState.STA); // needed for the AdvancedOptimizationFrontent
     
    122132    }
    123133
     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    }
    124150  }
    125151}
Note: See TracChangeset for help on using the changeset viewer.