Free cookie consent management tool by TermsFeed Policy Generator

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

#2522 added overrides for ShowError in IMainForm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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) {
Note: See TracChangeset for help on using the changeset viewer.