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.MainForm.WindowsForms/3.3
Files:
2 edited
2 moved

Legend:

Unmodified
Added
Removed
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.MainForm.WindowsForms/3.3/Dialogs/ErrorDialog.Designer.cs

    r13337 r13338  
    2020#endregion
    2121
    22 namespace HeuristicLab.PluginInfrastructure {
     22using System.Drawing;
     23
     24namespace HeuristicLab.MainForm.WindowsForms {
    2325  partial class ErrorDialog {
    2426    /// <summary>
     
    6870      // iconLabel
    6971      //
    70       this.iconLabel.Image = global::HeuristicLab.PluginInfrastructure.Resources.Error;
     72      this.iconLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Error;
    7173      this.iconLabel.Location = new System.Drawing.Point(12, 9);
    7274      this.iconLabel.Name = "iconLabel";
     
    155157      this.Controls.Add(this.iconLabel);
    156158      this.Controls.Add(this.okButton);
    157       this.Icon = global::HeuristicLab.PluginInfrastructure.Resources.ErrorIcon;
     159      // this.Icon = HeuristicLab.Common.Resources.VSImageLibrary.Error; // TODO
    158160      this.MaximizeBox = false;
    159161      this.MinimizeBox = false;
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.MainForm.WindowsForms/3.3/Dialogs/ErrorDialog.cs

    r13337 r13338  
    2222using System;
    2323using System.Windows.Forms;
     24using HeuristicLab.Common;
    2425
    25 namespace HeuristicLab.PluginInfrastructure {
     26namespace HeuristicLab.MainForm.WindowsForms {
    2627  public partial class ErrorDialog : Form {
    2728    public ErrorDialog() {
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.MainForm.WindowsForms/3.3/HeuristicLab.MainForm.WindowsForms-3.3.csproj

    r11623 r13338  
    144144      <DependentUpon>DefineArithmeticProgressionDialog.cs</DependentUpon>
    145145    </Compile>
     146    <Compile Include="Dialogs\ErrorDialog.cs">
     147      <SubType>Form</SubType>
     148    </Compile>
     149    <Compile Include="Dialogs\ErrorDialog.Designer.cs">
     150      <DependentUpon>ErrorDialog.cs</DependentUpon>
     151    </Compile>
    146152    <Compile Include="Dialogs\InfoBox.cs">
    147153      <SubType>Form</SubType>
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs

    r12012 r13338  
    556556        ((IActionUserInterfaceItem)item.Tag).Execute();
    557557      } catch (Exception ex) {
    558         ErrorHandling.ShowErrorDialog((Control)MainFormManager.MainForm, ex);
     558        ShowError(ex.Message, ex);
    559559      }
    560560    }
     
    600600    }
    601601    #endregion
     602
     603    #region Error Handling
     604    public void ShowError(string message, Exception exception) {
     605      ShowErrorDialog(this, message, exception);
     606    }
     607    private void ShowErrorDialog(Control owner, string message, Exception exception) {
     608      if (owner == null) throw new ArgumentNullException("owner");
     609      if (owner.InvokeRequired) {
     610        owner.Invoke(new Action<Control, string, Exception>(ShowErrorDialog), owner, message, exception);
     611      } else {
     612        using (ErrorDialog dialog = new ErrorDialog(message, exception)) {
     613          dialog.ShowDialog(owner);
     614        }
     615      }
     616    }
     617    #endregion
    602618  }
    603619}
Note: See TracChangeset for help on using the changeset viewer.