view SilverlightGlimpse/SilverlightGlimpse/Controls/LoadExceptionViewer.xaml.cs @ 62:810116cd6b8e

ErrorWindow working
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sun, 22 Apr 2012 09:01:20 +0100
parents
children 536498832a79
line wrap: on
line source

using System;
using System.Windows.Controls;

namespace SilverlightGlimpse.Controls
{
    public partial class LoadExceptionViewer : UserControl
    {
        public LoadExceptionViewer()
        {
            InitializeComponent();
        }

        public LoadExceptionViewer(Exception e, string sourceLocation) : this()
        {
            this.txtTitle.Text = string.Concat("Exception ", sourceLocation.TrimStart());

            Exception ex = e;

            while (ex != null)
            {
                this.lbExceptions.Items.Add(ex);
                ex = ex.InnerException;
            }

            if (this.lbExceptions.Items.Count > 0)
            {
                this.lbExceptions.SelectedIndex = 0;
            }
        }
    }
}