annotate SilverlightGlimpse/SilverlightValidation/Views/UserView.xaml.cs @ 78:dd6bcd2535b6

Working version
author Steven Hollidge <stevenhollidge@hotmail.com>
date Mon, 23 Apr 2012 22:43:53 +0100
parents 86ed4919b126
children 5172a9b9800c
rev   line source
77
86ed4919b126 Working version!
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 69
diff changeset
1 using System;
86ed4919b126 Working version!
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 69
diff changeset
2 using System.Windows;
86ed4919b126 Working version!
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 69
diff changeset
3 using System.Windows.Browser;
69
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
4 using System.Windows.Input;
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
5 using SilverlightValidation.Models;
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
6 using SilverlightValidation.Validators;
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
7 using SilverlightValidation.ViewModels;
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
8
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
9 namespace SilverlightValidation.Views
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
10 {
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
11 public partial class UserView
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
12 {
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
13 private UserViewModel vm;
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
14
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
15 public UserView()
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
16 {
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
17 InitializeComponent();
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
18 HtmlPage.Document.SetProperty("title", "Silverlight Validation");
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
19
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
20 vm = new UserViewModel(UserModel.Create(), new UserModelValidator());
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
21 this.DataContext = vm;
78
dd6bcd2535b6 Working version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 77
diff changeset
22
dd6bcd2535b6 Working version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 77
diff changeset
23 // uncomment this exception to view exception on startup
dd6bcd2535b6 Working version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 77
diff changeset
24 //ThrowNestedException();
69
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
25 }
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
26
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
27 private void DatePicker_KeyDown(object sender, KeyEventArgs e)
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
28 {
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
29 if (e.Key != Key.Tab)
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
30 e.Handled = true;
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
31 }
77
86ed4919b126 Working version!
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 69
diff changeset
32
86ed4919b126 Working version!
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 69
diff changeset
33 private void btnThrowException_OnClick(object sender, RoutedEventArgs e)
86ed4919b126 Working version!
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 69
diff changeset
34 {
78
dd6bcd2535b6 Working version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 77
diff changeset
35 ThrowNestedException();
dd6bcd2535b6 Working version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 77
diff changeset
36 }
dd6bcd2535b6 Working version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 77
diff changeset
37
dd6bcd2535b6 Working version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 77
diff changeset
38 private void ThrowNestedException()
dd6bcd2535b6 Working version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 77
diff changeset
39 {
dd6bcd2535b6 Working version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 77
diff changeset
40 throw new Exception("Oh dear we've hit an exception!",
dd6bcd2535b6 Working version
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 77
diff changeset
41 new Exception("This is an inner exception"));
77
86ed4919b126 Working version!
Steven Hollidge <stevenhollidge@hotmail.com>
parents: 69
diff changeset
42 }
69
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
43 }
a0bcd783e612 Latest work
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
44 }