view SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml.cs @ 67:b0e369f1e948

Updated name for window title
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sun, 22 Apr 2012 16:01:14 +0100
parents ba89e36631bc
children a0bcd783e612
line wrap: on
line source

using System;
using System.Collections.Generic;
using System.Windows;

namespace SilverlightGlimpse.Test
{
    public partial class MainPage
    {
        public MainPage()
        {
            InitializeComponent();

            // uncomment this exception to view exception on startup 
            //ThrowNestedException();

            var list = new List<object>(5)
            {
                new Person { Id = 1 , Name = "Steve"},
                new Person { Id = 2 , Name = "Dave"},
                new Person { Id = 3 , Name = "Bob"},
                new Person { Id = 4 , Name = "Rich"},
                new Person { Id = 5 , Name = "Clare"}
            };
            
            listbox1.ItemsSource = list;
        }

        private void ThrowNestedException()
        {
            throw new Exception("Oh dear we've hit an exception!",
                                new Exception("This is an inner exception"));
        }

        private void btnThrowException_Click(object sender, RoutedEventArgs e)
        {
            ThrowNestedException();
        }
    }

    public class Person
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }
}