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.Common/3.3
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.Common/3.3/ErrorHandling.cs

    r13337 r13338  
    2121
    2222using System;
    23 using System.Windows.Forms;
     23using HeuristicLab.PluginInfrastructure;
    2424
    25 namespace HeuristicLab.PluginInfrastructure {
     25namespace HeuristicLab.Common {
    2626  public static class ErrorHandling {
    2727    public static string BuildErrorMessage(Exception exception) {
     
    2929        return string.Empty;
    3030      } else {
     31        var asm = typeof(ErrorHandling).Assembly;
    3132        string message =
    32           "HeuristicLab version: " + AssemblyHelpers.GetFileVersion(typeof(ErrorHandling).Assembly) + Environment.NewLine +
     33          "HeuristicLab version: " + asm.GetFileVersion() + Environment.NewLine +
    3334          exception.GetType().Name + ": " + exception.Message + Environment.NewLine +
    3435                         exception.StackTrace;
     
    4445      }
    4546    }
    46 
    47     public static void ShowErrorDialog(Exception exception) {
    48       ShowErrorDialog(string.Empty, exception);
    49     }
    50     public static void ShowErrorDialog(Control owner, Exception exception) {
    51       ShowErrorDialog(owner, string.Empty, exception);
    52     }
    53     public static void ShowErrorDialog(string message, Exception exception) {
    54       using (ErrorDialog dialog = new ErrorDialog(message, exception)) {
    55         dialog.StartPosition = FormStartPosition.CenterScreen;
    56         dialog.ShowDialog();
    57       }
    58     }
    59     public static void ShowErrorDialog(Control owner, string message, Exception exception) {
    60       if (owner == null) throw new ArgumentNullException("owner");
    61       if (owner.InvokeRequired) {
    62         owner.Invoke(new Action<Control, string, Exception>(ShowErrorDialog), owner, message, exception);
    63       } else {
    64         using (ErrorDialog dialog = new ErrorDialog(message, exception)) {
    65           dialog.ShowDialog(owner);
    66         }
    67       }
    68     }
    6947  }
    7048}
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.Common/3.3/HeuristicLab.Common-3.3.csproj

    r12292 r13338  
    131131    <Compile Include="Constants.cs" />
    132132    <Compile Include="ArrayExtensions.cs" />
     133    <Compile Include="ErrorHandling.cs" />
    133134    <Compile Include="ListExtensions.cs" />
    134135    <Compile Include="Point2D.cs" />
Note: See TracChangeset for help on using the changeset viewer.