private void errorOccurred(object sender, Exception e)
 {
     ErrorDialog dialog = new ErrorDialog();
     dialog.Owner = this;
     dialog.ErrorDetails.ErrorMessage = e.Message;
     dialog.ErrorDetails.StackTrace = e.StackTrace;
     dialog.ShowDialog();
 }
 private void showErrorDialog(Exception exception)
 {
     ErrorDialog errorDialog = new ErrorDialog();
     errorDialog.Owner = this;
     errorDialog.Title = "Failed to Connect";
     errorDialog.ErrorDetails.ErrorMessage = exception.Message;
     errorDialog.ErrorDetails.StackTrace = exception.StackTrace;
     errorDialog.ShowDialog();
 }