annotate SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml.cs @ 65:5d0c5cc83a7a

Click event handler added
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sun, 22 Apr 2012 14:21:33 +0100
parents ba89e36631bc
children a0bcd783e612
rev   line source
64
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
1 using System;
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
2 using System.Collections.Generic;
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
3 using System.Windows;
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
4
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
5 namespace SilverlightGlimpse.Test
62
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
6 {
63
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 62
diff changeset
7 public partial class MainPage
62
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
8 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
9 public MainPage()
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
10 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
11 InitializeComponent();
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
12
63
536498832a79 Latest version before changing bindings to Listbox
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 62
diff changeset
13 // uncomment this exception to view exception on startup
64
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
14 //ThrowNestedException();
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
15
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
16 var list = new List<object>(5)
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
17 {
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
18 new Person { Id = 1 , Name = "Steve"},
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
19 new Person { Id = 2 , Name = "Dave"},
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
20 new Person { Id = 3 , Name = "Bob"},
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
21 new Person { Id = 4 , Name = "Rich"},
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
22 new Person { Id = 5 , Name = "Clare"}
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
23 };
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
24
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
25 listbox1.ItemsSource = list;
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
26 }
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
27
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
28 private void ThrowNestedException()
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
29 {
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
30 throw new Exception("Oh dear we've hit an exception!",
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
31 new Exception("This is an inner exception"));
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
32 }
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
33
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
34 private void btnThrowException_Click(object sender, RoutedEventArgs e)
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
35 {
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
36 ThrowNestedException();
62
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
37 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
38 }
64
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
39
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
40 public class Person
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
41 {
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
42 public int Id { get; set; }
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
43 public string Name { get; set; }
ba89e36631bc Latest version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 63
diff changeset
44 }
62
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
45 }