Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/23/15 16:14:30 (8 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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.