view SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml.cs @ 71:96e6fbd70f49

Latest version
author Steven Hollidge <stevenhollidge@hotmail.com>
date Mon, 23 Apr 2012 14:54:24 +0100
parents a0bcd783e612
children
line wrap: on
line source

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;

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; }
    }
}