/TimeSheetReporting/TimeSheetReporting/Views/ErrorWindow.xaml.cs

# · C# · 38 lines · 34 code · 4 blank · 0 comment · 4 complexity · 119da0b61b38bf8b1b172c02e1b5262d MD5 · raw file

  1. using System;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. namespace TimeSheetReporting
  5. {
  6. public partial class ErrorWindow : ChildWindow
  7. {
  8. public ErrorWindow(Exception e)
  9. {
  10. InitializeComponent();
  11. if (e != null)
  12. {
  13. ErrorTextBox.Text = e.Message + Environment.NewLine + Environment.NewLine + e.StackTrace;
  14. }
  15. }
  16. public ErrorWindow(Uri uri)
  17. {
  18. InitializeComponent();
  19. if (uri != null)
  20. {
  21. ErrorTextBox.Text = "Page not found: \"" + uri.ToString() + "\"";
  22. }
  23. }
  24. public ErrorWindow(string message, string details)
  25. {
  26. InitializeComponent();
  27. ErrorTextBox.Text = message + Environment.NewLine + Environment.NewLine + details;
  28. }
  29. private void OKButton_Click(object sender, RoutedEventArgs e)
  30. {
  31. this.DialogResult = true;
  32. }
  33. }
  34. }