Changeset 13352


Ignore:
Timestamp:
11/24/15 11:53:58 (3 years ago)
Author:
gkronber
Message:

#2522 added overrides for ShowError in IMainForm

Location:
branches/RefactorPluginInfrastructure-2522
Files:
3 edited

Legend:

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

    r13338 r13352  
    2626namespace HeuristicLab.MainForm.WindowsForms {
    2727  public partial class ErrorDialog : Form {
    28     public ErrorDialog() {
     28    public ErrorDialog() : this(null, null) { }
     29    public ErrorDialog(Exception exception) : this(null, exception) { }
     30    public ErrorDialog(string message) : this(message, null) { }
     31    public ErrorDialog(string message, Exception exception) {
    2932      InitializeComponent();
    30       Initialize(null, null);
    31     }
    32     public ErrorDialog(Exception exception)
    33       : this() {
    34       Initialize(null, exception);
    35     }
    36     public ErrorDialog(string message, Exception exception)
    37       : this() {
    3833      Initialize(message, exception);
    3934    }
     
    5954        System.Diagnostics.Process.Start("mailto:" + supportLinkLabel.Text);
    6055        supportLinkLabel.LinkVisited = true;
    61       }
    62       catch (Exception) { }
     56      } catch (Exception) { }
    6357    }
    6458  }
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs

    r13338 r13352  
    602602
    603603    #region Error Handling
     604    public void ShowError(string message) {
     605      ShowErrorDialog(this, message);
     606    }
     607    public void ShowError(Exception ex) {
     608      ShowErrorDialog(this, ex);
     609    }
    604610    public void ShowError(string message, Exception exception) {
    605611      ShowErrorDialog(this, message, exception);
     612    }
     613    private void ShowErrorDialog(Control owner, string message) {
     614      if (owner == null) throw new ArgumentNullException("owner");
     615      if (owner.InvokeRequired) {
     616        owner.Invoke(new Action<Control, string, Exception>(ShowErrorDialog), owner, message);
     617      } else {
     618        using (ErrorDialog dialog = new ErrorDialog(message)) {
     619          dialog.ShowDialog(owner);
     620        }
     621      }
     622    }
     623    private void ShowErrorDialog(Control owner, Exception ex) {
     624      if (owner == null) throw new ArgumentNullException("owner");
     625      if (owner.InvokeRequired) {
     626        owner.Invoke(new Action<Control, string, Exception>(ShowErrorDialog), owner, ex);
     627      } else {
     628        using (ErrorDialog dialog = new ErrorDialog(ex)) {
     629          dialog.ShowDialog(owner);
     630        }
     631      }
    606632    }
    607633    private void ShowErrorDialog(Control owner, string message, Exception exception) {
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.MainForm/3.3/Interfaces/IMainForm.cs

    r13338 r13352  
    4242    IContentView ShowContent(IContent content, Type viewType);
    4343    void ShowError(string message, Exception e);
     44    void ShowError(string message);
     45    void ShowError(Exception e);
    4446
    4547    Type UserInterfaceItemType { get; }
Note: See TracChangeset for help on using the changeset viewer.