Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/23/15 16:14:30 (9 years ago)
Author:
gkronber
Message:

#2522:

  • moved UI components out of HeuristicLab.PluginInfrastructure -> HeuristicLab.PluginInfrastructure.UI
  • moved ErrorDialog to HeuristicLab.MainForm.WindowsForms
  • moved ErrorHandling (for building an error message string) to HeuristicLab.Common
  • Changed exception handlers in Views to use MainForm.ShowError()
  • Changed usages for ErrorDialog in non-UI components to throw exceptions instead.
Location:
branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI
Files:
4 added
25 moved

Legend:

Unmodified
Added
Removed
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/AboutDialog.Designer.cs

    r13337 r13338  
    2020#endregion
    2121
    22 namespace HeuristicLab.PluginInfrastructure.Starter {
     22namespace HeuristicLab.PluginInfrastructure.UI {
    2323  partial class AboutDialog {
    2424    /// <summary>
     
    292292      this.Controls.Add(this.label);
    293293      this.Controls.Add(this.pictureBox);
    294       this.Icon = global::HeuristicLab.PluginInfrastructure.Resources.HeuristicLab;
     294      this.Icon = Resources.HeuristicLab;
    295295      this.MaximizeBox = false;
    296296      this.MinimizeBox = false;
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/AboutDialog.cs

    r13337 r13338  
    2525using System.Reflection;
    2626using System.Windows.Forms;
    27 using HeuristicLab.PluginInfrastructure.Advanced;
    2827
    29 namespace HeuristicLab.PluginInfrastructure.Starter {
     28namespace HeuristicLab.PluginInfrastructure.UI {
    3029  /// <summary>
    3130  /// Shows product, version and copyright information for HeuristicLab and all plugins.
     
    4140      versionTextBox.Text = GetVersion();
    4241      copyrightTextBox.Text = GetCopyright(curAssembly);
    43       imageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.Plugin);
    44       pictureBox.Image = HeuristicLab.PluginInfrastructure.Resources.HeuristicLabLogo;
    45       licenseTextBox.Text = HeuristicLab.PluginInfrastructure.Resources.LicenseText;
     42      imageList.Images.Add(Resources.Plugin);
     43      pictureBox.Image = Resources.HeuristicLabLogo;
     44      licenseTextBox.Text = Resources.LicenseText;
    4645      UpdatePluginList(ApplicationManager.Manager.Plugins);
    4746      ActiveControl = okButton;
     
    7978
    8079    private string GetVersion() {
    81       return AssemblyHelpers.GetFileVersion(GetType().Assembly);
     80      return AssemblyExtensions.GetFileVersion(GetType().Assembly);
    8281    }
    8382
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/FrameworkVersionErrorDialog.Designer.cs

    r13337 r13338  
    2020#endregion
    2121
    22 namespace HeuristicLab.PluginInfrastructure {
     22namespace HeuristicLab.PluginInfrastructure.UI {
    2323  partial class FrameworkVersionErrorDialog {
    2424    /// <summary>
     
    5656      this.iconLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    5757            | System.Windows.Forms.AnchorStyles.Left)));
    58       this.iconLabel.Image = global::HeuristicLab.PluginInfrastructure.Resources.Error;
     58      this.iconLabel.Image = Resources.Error;
    5959      this.iconLabel.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
    6060      this.iconLabel.Location = new System.Drawing.Point(12, 9);
     
    124124      this.Controls.Add(this.iconLabel);
    125125      this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
    126       this.Icon = global::HeuristicLab.PluginInfrastructure.Resources.HeuristicLab;
     126      this.Icon = Resources.HeuristicLab;
    127127      this.MaximizeBox = false;
    128128      this.MinimizeBox = false;
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/FrameworkVersionErrorDialog.cs

    r13337 r13338  
    2424using System.Windows.Forms;
    2525
    26 namespace HeuristicLab.PluginInfrastructure {
     26namespace HeuristicLab.PluginInfrastructure.UI {
    2727  public partial class FrameworkVersionErrorDialog : Form {
    2828    private const string NETVersionPath = @"Software\Microsoft\NET Framework Setup\NDP\v4\Full";
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/InstallationManagerControl.Designer.cs

    r13337 r13338  
    1919 */
    2020#endregion
    21 namespace HeuristicLab.PluginInfrastructure.Advanced {
     21namespace HeuristicLab.PluginInfrastructure.UI {
    2222  partial class InstallationManagerControl {
    2323    /// <summary>
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/InstallationManagerControl.cs

    r13337 r13338  
    2121using System.Windows.Forms;
    2222
    23 namespace HeuristicLab.PluginInfrastructure.Advanced {
     23namespace HeuristicLab.PluginInfrastructure.UI {
    2424  internal partial class InstallationManagerControl : UserControl {
    2525
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/InstallationManagerForm.Designer.cs

    r13337 r13338  
    1919 */
    2020#endregion
    21 namespace HeuristicLab.PluginInfrastructure.Advanced {
     21namespace HeuristicLab.PluginInfrastructure.UI {
    2222  partial class InstallationManagerForm {
    2323    /// <summary>
     
    5050      this.tabControl = new System.Windows.Forms.TabControl();
    5151      this.localPluginsTabPage = new System.Windows.Forms.TabPage();
    52       this.localPluginsView = new HeuristicLab.PluginInfrastructure.Advanced.InstalledPluginsView();
     52      this.localPluginsView = new InstalledPluginsView();
    5353      this.logTabPage = new System.Windows.Forms.TabPage();
    5454      this.logTextBox = new System.Windows.Forms.TextBox();
     
    152152      this.Controls.Add(this.tabControl);
    153153      this.Controls.Add(this.statusStrip);
    154       this.Icon = global::HeuristicLab.PluginInfrastructure.Resources.HeuristicLab;
     154      this.Icon = Resources.HeuristicLab;
    155155      this.Name = "InstallationManagerForm";
    156156      this.Text = "Plugin Manager";
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/InstallationManagerForm.cs

    r13337 r13338  
    2323using HeuristicLab.PluginInfrastructure.Manager;
    2424
    25 namespace HeuristicLab.PluginInfrastructure.Advanced {
     25namespace HeuristicLab.PluginInfrastructure.UI {
    2626  internal partial class InstallationManagerForm : Form {
    2727    private string pluginDir;
     
    3030      : base() {
    3131      InitializeComponent();
    32       Text = "HeuristicLab Plugin Manager " + AssemblyHelpers.GetFileVersion(GetType().Assembly);
     32      Text = "HeuristicLab Plugin Manager " + AssemblyExtensions.GetFileVersion(GetType().Assembly);
    3333
    3434      pluginDir = Application.StartupPath;
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/InstalledPluginsView.Designer.cs

    r13337 r13338  
    2020#endregion
    2121
    22 namespace HeuristicLab.PluginInfrastructure.Advanced {
     22namespace HeuristicLab.PluginInfrastructure.UI {
    2323  partial class InstalledPluginsView {
    2424    /// <summary>
     
    4848      System.Windows.Forms.ListViewGroup listViewGroup3 = new System.Windows.Forms.ListViewGroup("Active Plugins", System.Windows.Forms.HorizontalAlignment.Left);
    4949      System.Windows.Forms.ListViewGroup listViewGroup4 = new System.Windows.Forms.ListViewGroup("Disabled Plugins", System.Windows.Forms.HorizontalAlignment.Left);
    50       this.localPluginsListView = new HeuristicLab.PluginInfrastructure.Advanced.MultiSelectListView();
     50      this.localPluginsListView = new MultiSelectListView();
    5151      this.nameHeader = new System.Windows.Forms.ColumnHeader();
    5252      this.versionHeader = new System.Windows.Forms.ColumnHeader();
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/InstalledPluginsView.cs

    r13337 r13338  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.ComponentModel;
    2524using System.Linq;
    2625using System.Windows.Forms;
    2726using HeuristicLab.PluginInfrastructure.Manager;
    2827
    29 namespace HeuristicLab.PluginInfrastructure.Advanced {
     28namespace HeuristicLab.PluginInfrastructure.UI {
    3029  internal partial class InstalledPluginsView : InstallationManagerControl {
    31     private const string CheckingPluginsMessage = "Checking for updated plugins...";
    32     private const string NoUpdatesAvailableMessage = "No updates available.";
    3330
    3431    private ListViewGroup enabledPluginsGroup;
     
    5552      enabledPluginsGroup = localPluginsListView.Groups["activePluginsGroup"];
    5653      disabledPluginsGroup = localPluginsListView.Groups["disabledPluginsGroup"];
    57       pluginImageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.Plugin);
     54      pluginImageList.Images.Add(Resources.Plugin);
    5855      UpdateControl();
    5956    }
    6057
    61 
    62     #region event handlers for update plugins backgroundworker
    63     // compares for two plugins with same major and minor version if plugin1 is newer than plugin2
    64     private static bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) {
    65       // newer: build version is higher, or if build version is the same revision is higher
    66       return plugin1.Version.Build > plugin2.Version.Build ||
    67         (plugin1.Version.Build == plugin2.Version.Build && plugin1.Version.Revision > plugin2.Version.Revision);
    68     }
    69     #endregion
    7058
    7159    private void UpdateControl() {
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/LicenseView.Designer.cs

    r13337 r13338  
    1919 */
    2020#endregion
    21 namespace HeuristicLab.PluginInfrastructure.Advanced {
     21namespace HeuristicLab.PluginInfrastructure.UI {
    2222  partial class LicenseView {
    2323    /// <summary>
     
    6565      this.ClientSize = new System.Drawing.Size(410, 445);
    6666      this.Controls.Add(this.richTextBox);
    67       this.Icon = HeuristicLab.PluginInfrastructure.Resources.HeuristicLab;
     67      this.Icon = Resources.HeuristicLab;
    6868      this.Name = "LicenseView";
    6969      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/LicenseView.cs

    r13337 r13338  
    2121using System.Windows.Forms;
    2222
    23 namespace HeuristicLab.PluginInfrastructure.Advanced {
     23namespace HeuristicLab.PluginInfrastructure.UI {
    2424  internal partial class LicenseView : Form {
    2525
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/Main.cs

    r13337 r13338  
    2020#endregion
    2121
    22 using System;
    23 using System.Windows.Forms;
    24 using HeuristicLab.PluginInfrastructure.Starter;
    25 
    26 namespace HeuristicLab.PluginInfrastructure {
     22namespace HeuristicLab.PluginInfrastructure.UI {
    2723  /// <summary>
    2824  /// Static class that contains the main entry point of the plugin infrastructure.
    2925  /// </summary>
    3026  public static class Main {
    31     /// <summary>
    32     /// Main entry point of the plugin infrastructure. Loads the starter form.
    33     /// </summary>
    34     /// <param name="args">Command line arguments</param>
    35     public static void Run(string[] args) {
    36       if ((!FrameworkVersionErrorDialog.NET4_5Installed && !FrameworkVersionErrorDialog.MonoInstalled)
    37         || (FrameworkVersionErrorDialog.MonoInstalled && !FrameworkVersionErrorDialog.MonoCorrectVersionInstalled)) {
    38         Application.EnableVisualStyles();
    39         Application.SetCompatibleTextRenderingDefault(false);
    40         Application.Run(new FrameworkVersionErrorDialog());
    41       } else {
    42         try {
    43           Application.EnableVisualStyles();
    44           Application.SetCompatibleTextRenderingDefault(false);
    45           Application.Run(new StarterForm(args));
    46         }
    47         catch (Exception ex) {
    48           ErrorHandling.ShowErrorDialog(ex);
    49         }
    50       }
    51     }
    5227  }
    5328}
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/MultiSelectListView.Designer.cs

    r13337 r13338  
    1919 */
    2020#endregion
    21 namespace HeuristicLab.PluginInfrastructure.Advanced {
     21namespace HeuristicLab.PluginInfrastructure.UI {
    2222  partial class MultiSelectListView {
    2323    /// <summary>
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/MultiSelectListView.cs

    r13337 r13338  
    2424using System.Windows.Forms;
    2525
    26 namespace HeuristicLab.PluginInfrastructure.Advanced {
     26namespace HeuristicLab.PluginInfrastructure.UI {
    2727  internal partial class MultiSelectListView : ListView {
    2828    public MultiSelectListView() {
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/PluginView.Designer.cs

    r13337 r13338  
    1919 */
    2020#endregion
    21 namespace HeuristicLab.PluginInfrastructure.Advanced {
     21namespace HeuristicLab.PluginInfrastructure.UI {
    2222  partial class PluginView {
    2323    /// <summary>
     
    315315      this.Controls.Add(this.nameTextBox);
    316316      this.Controls.Add(this.nameLabel);
    317       this.Icon = global::HeuristicLab.PluginInfrastructure.Resources.HeuristicLab;
     317      this.Icon = Resources.HeuristicLab;
    318318      this.Name = "PluginView";
    319319      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/PluginView.cs

    r13337 r13338  
    2525using HeuristicLab.PluginInfrastructure.Manager;
    2626
    27 namespace HeuristicLab.PluginInfrastructure.Advanced {
     27namespace HeuristicLab.PluginInfrastructure.UI {
    2828  internal partial class PluginView : Form {
    2929    private const string IMAGE_KEY_PLUGIN = "Plugin";
     
    5151
    5252    private void PopulateImageList() {
    53       pluginsImageList.Images.Add(IMAGE_KEY_PLUGIN, HeuristicLab.PluginInfrastructure.Resources.Plugin);
    54       filesImageList.Images.Add(IMAGE_KEY_ASSEMBLY, HeuristicLab.PluginInfrastructure.Resources.Assembly);
    55       filesImageList.Images.Add(IMAGE_KEY_FILE, HeuristicLab.PluginInfrastructure.Resources.File);
    56       filesImageList.Images.Add(IMAGE_KEY_DOCUMENT, HeuristicLab.PluginInfrastructure.Resources.Document);
     53      pluginsImageList.Images.Add(IMAGE_KEY_PLUGIN, Resources.Plugin);
     54      filesImageList.Images.Add(IMAGE_KEY_ASSEMBLY, Resources.Assembly);
     55      filesImageList.Images.Add(IMAGE_KEY_FILE, Resources.File);
     56      filesImageList.Images.Add(IMAGE_KEY_DOCUMENT, Resources.Document);
    5757    }
    5858
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/Resources.Designer.cs

    r13334 r13338  
    99//------------------------------------------------------------------------------
    1010
    11 namespace HeuristicLab.PluginInfrastructure {
     11namespace HeuristicLab.PluginInfrastructure.UI {
    1212    using System;
    1313   
     
    4040            get {
    4141                if (object.ReferenceEquals(resourceMan, null)) {
    42                     global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeuristicLab.PluginInfrastructure.Resources", typeof(Resources).Assembly);
     42                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeuristicLab.PluginInfrastructure.UI.Resources", typeof(Resources).Assembly);
    4343                    resourceMan = temp;
    4444                }
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/SplashScreen.Designer.cs

    r13337 r13338  
    2020#endregion
    2121
    22 namespace HeuristicLab.PluginInfrastructure.Starter {
     22namespace HeuristicLab.PluginInfrastructure.UI {
    2323  partial class SplashScreen {
    2424    /// <summary>
     
    9393      this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    9494                  | System.Windows.Forms.AnchorStyles.Right)));
    95       this.pictureBox.Image = global::HeuristicLab.PluginInfrastructure.Resources.HeuristicLabBanner;
     95      this.pictureBox.Image = Resources.HeuristicLabBanner;
    9696      this.pictureBox.Location = new System.Drawing.Point(0, 0);
    9797      this.pictureBox.Name = "pictureBox";
     
    113113      this.Controls.Add(this.infoLabel);
    114114      this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
    115       this.Icon = HeuristicLab.PluginInfrastructure.Resources.HeuristicLab;
     115      this.Icon = Resources.HeuristicLab;
    116116      this.MaximizeBox = false;
    117117      this.MinimizeBox = false;
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/SplashScreen.cs

    r13337 r13338  
    2626using HeuristicLab.PluginInfrastructure.Manager;
    2727
    28 namespace HeuristicLab.PluginInfrastructure.Starter {
     28namespace HeuristicLab.PluginInfrastructure.UI {
    2929  internal partial class SplashScreen : Form {
    3030    private const int FADE_INTERVAL = 50;
     
    4444      RegisterPluginManagerEventHandlers();
    4545
    46       versionLabel.Text = "Version " + AssemblyHelpers.GetFileVersion(GetType().Assembly);
     46      versionLabel.Text = "Version " + AssemblyExtensions.GetFileVersion(GetType().Assembly);
    4747      infoLabel.Text = "";
    4848
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/StarterForm.Designer.cs

    r13337 r13338  
    2020#endregion
    2121
    22 namespace HeuristicLab.PluginInfrastructure.Starter {
     22namespace HeuristicLab.PluginInfrastructure.UI {
    2323  partial class StarterForm {
    2424    /// <summary>
     
    134134      this.showLargeIconsButton.Appearance = System.Windows.Forms.Appearance.Button;
    135135      this.showLargeIconsButton.Checked = true;
    136       this.showLargeIconsButton.Image = global::HeuristicLab.PluginInfrastructure.Resources.ShowIcons;
     136      this.showLargeIconsButton.Image = Resources.ShowIcons;
    137137      this.showLargeIconsButton.Location = new System.Drawing.Point(12, 511);
    138138      this.showLargeIconsButton.Name = "showLargeIconsButton";
     
    148148      this.showDetailsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    149149      this.showDetailsButton.Appearance = System.Windows.Forms.Appearance.Button;
    150       this.showDetailsButton.Image = global::HeuristicLab.PluginInfrastructure.Resources.ShowDetails;
     150      this.showDetailsButton.Image = Resources.ShowDetails;
    151151      this.showDetailsButton.Location = new System.Drawing.Point(41, 511);
    152152      this.showDetailsButton.Name = "showDetailsButton";
     
    178178      this.Controls.Add(this.applicationsListView);
    179179      this.Controls.Add(this.startButton);
    180       this.Icon = HeuristicLab.PluginInfrastructure.Resources.HeuristicLab;
     180      this.Icon = Resources.HeuristicLab;
    181181      this.Name = "StarterForm";
    182182      this.Text = "HeuristicLab Starter";
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/StarterForm.cs

    r13337 r13338  
    2727using System.Threading.Tasks;
    2828using System.Windows.Forms;
    29 using HeuristicLab.PluginInfrastructure.Advanced;
    3029using HeuristicLab.PluginInfrastructure.Manager;
    3130
    32 namespace HeuristicLab.PluginInfrastructure.Starter {
     31namespace HeuristicLab.PluginInfrastructure.UI {
    3332  /// <summary>
    3433  /// The starter form is responsible for initializing the plugin infrastructure
     
    4342
    4443    private ListViewItem pluginManagerListViewItem;
    45     private bool abortRequested; // TODO: necessary
     44    private bool abortRequested; // TODO: necessary?
    4645    private PluginManager pluginManager;
    4746    private SplashScreen splashScreen;
     
    5453      : base() {
    5554      InitializeComponent();
    56       largeImageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.HeuristicLab.ToBitmap());
    57       smallImageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.HeuristicLab.ToBitmap());
    58       Text = "HeuristicLab " + AssemblyHelpers.GetFileVersion(GetType().Assembly);
     55      largeImageList.Images.Add(Resources.HeuristicLab.ToBitmap());
     56      smallImageList.Images.Add(Resources.HeuristicLab.ToBitmap());
     57      Text = "HeuristicLab " + AssemblyExtensions.GetFileVersion(GetType().Assembly);
    5958
    6059      string pluginPath = Path.GetFullPath(Application.StartupPath);
     
    112111              }
    113112              UpdateApplicationsList();
    114             }
    115             finally {
     113            } finally {
    116114              Cursor = Cursors.Arrow;
    117115            }
     
    179177      pluginManagerListViewItem = new ListViewItem(pluginManagerItemName, 0);
    180178      pluginManagerListViewItem.Group = applicationsListView.Groups["Plugin Management"];
    181       pluginManagerListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(pluginManagerListViewItem, AssemblyHelpers.GetFileVersion(GetType().Assembly)));
     179      pluginManagerListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(pluginManagerListViewItem, AssemblyExtensions.GetFileVersion(GetType().Assembly)));
    182180      pluginManagerListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(pluginManagerListViewItem, "Install, upgrade or delete plugins"));
    183181      pluginManagerListViewItem.ToolTipText = "Install, upgrade or delete plugins";
     
    197195          }
    198196        }
    199       }
    200       catch (AggregateException ex) {
    201         ErrorHandling.ShowErrorDialog(this, "One or more errors occurred while initializing the application.", ex);
     197      } catch (AggregateException ex) {
     198        ShowErrorDialog(ex);
    202199      }
    203200    }
     
    219216    private void StartApplication(ApplicationDescription app, ICommandLineArgument[] args) {
    220217      splashScreen.Show("Loading " + app.Name);
    221       Thread t = new Thread(delegate() {
    222         bool stopped = false;
    223         do {
    224           try {
    225             if (!abortRequested) {
    226               pluginManager.Run(app, args);
    227             }
    228             stopped = true;
    229           }
    230           catch (Exception ex) {
    231             stopped = false;
    232             ThreadPool.QueueUserWorkItem(delegate(object exception) { ErrorHandling.ShowErrorDialog(this, (Exception)exception); }, ex);
    233             Thread.Sleep(5000); // sleep 5 seconds before autorestart
    234           }
    235         } while (!abortRequested && !stopped && app.AutoRestart);
    236       });
    237       t.SetApartmentState(ApartmentState.STA); // needed for the AdvancedOptimizationFrontent
     218      // STAThread is necessary for a UI component we are using in the application
     219      var t = new Thread(() => pluginManager.Run(app, args));
     220      t.SetApartmentState(ApartmentState.STA);
    238221      t.Start();
    239222    }
    240223    #endregion
     224
     225    private void ShowErrorDialog(Exception exception) {
     226      MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     227    }
    241228  }
    242229}
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/Util.cs

    r13337 r13338  
    2525using System.Windows.Forms;
    2626
    27 namespace HeuristicLab.PluginInfrastructure.Advanced {
     27namespace HeuristicLab.PluginInfrastructure.UI {
    2828  internal static class Util {
    2929    internal static void ResizeColumn(ColumnHeader columnHeader) {
Note: See TracChangeset for help on using the changeset viewer.