PageRenderTime 173ms CodeModel.GetById 70ms app.highlight 2ms RepoModel.GetById 98ms app.codeStats 1ms

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

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