annotate Chronosv2/source/Presentation/Windows/Controls/MessageWindowElement.cs @ 19:09d18d6e5f40

airport work
author stevenh7776 stevenhollidge@hotmail.com
date Thu, 15 Mar 2012 06:59:15 +0000
parents 443821e55f06
children
rev   line source
10
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
1 /*
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
2 The MIT License
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
3
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
4 Copyright (c) 2009-2010. Carlos Guzmán Álvarez. http://chronoswpf.codeplex.com/
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
5
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
6 Permission is hereby granted, free of charge, to any person obtaining a copy
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
7 of this software and associated documentation files (the "Software"), to deal
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
8 in the Software without restriction, including without limitation the rights
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
10 copies of the Software, and to permit persons to whom the Software is
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
11 furnished to do so, subject to the following conditions:
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
12
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
13 The above copyright notice and this permission notice shall be included in
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
14 all copies or substantial portions of the Software.
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
15
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
22 THE SOFTWARE.
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
23 */
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
24
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
25 using System;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
26 using System.Windows;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
27 using System.Windows.Input;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
28 using Chronos.Extensions.Windows;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
29 using Chronos.Presentation.Core.VirtualDesktops;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
30 using Chronos.Presentation.Core.Windows;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
31 using nRoute.Services;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
32
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
33 namespace Chronos.Presentation.Windows.Controls
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
34 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
35 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
36 /// Provides the ability to create modal message windows (like messageboxes)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
37 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
38 public sealed class MessageWindowElement
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
39 : WindowElement
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
40 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
41 #region · Dependency Properties ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
42
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
43 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
44 /// Identifies the Buttons dependency property.
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
45 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
46 public static readonly DependencyProperty ButtonsProperty =
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
47 DependencyProperty.Register("Buttons", typeof(DialogButton), typeof(MessageWindowElement),
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
48 new FrameworkPropertyMetadata(DialogButton.Ok));
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
49
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
50 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
51
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
52 #region · Sync Object ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
53
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
54 static readonly object SyncObject = new object();
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
55
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
56 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
57
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
58 #region · Static Commands ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
59
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
60 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
61 /// Accept command
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
62 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
63 public static RoutedCommand AcceptCommand;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
64
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
65 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
66 /// Cancel command
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
67 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
68 public static RoutedCommand CancelCommand;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
69
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
70 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
71
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
72 #region · Static Constructors ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
73
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
74 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
75 /// Initializes the <see cref="MessageWindowElement"/> class.
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
76 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
77 static MessageWindowElement()
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
78 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
79 MessageWindowElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(MessageWindowElement),
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
80 new FrameworkPropertyMetadata(typeof(MessageWindowElement)));
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
81
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
82 KeyboardNavigation.IsTabStopProperty.OverrideMetadata(typeof(MessageWindowElement),
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
83 new FrameworkPropertyMetadata(false));
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
84
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
85 MessageWindowElement.AcceptCommand = new RoutedCommand("Accept", typeof(MessageWindowElement));
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
86 MessageWindowElement.CancelCommand = new RoutedCommand("Cancel", typeof(MessageWindowElement));
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
87 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
88
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
89 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
90
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
91 #region · Show "Factory" Methods ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
92
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
93 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
94 /// Shows a new <see cref="MessageWindowElement"/> with the given message
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
95 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
96 /// <param name="message"></param>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
97 /// <returns></returns>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
98 public static DialogResult Show(string message)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
99 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
100 return MessageWindowElement.Show("Message", message, DialogButton.OkCancel);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
101 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
102
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
103 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
104 /// Shows a new <see cref="MessageWindowElement"/> with the given caption and message
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
105 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
106 /// <param name="caption"></param>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
107 /// <param name="message"></param>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
108 /// <returns></returns>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
109 public static DialogResult Show(string caption, string message)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
110 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
111 return MessageWindowElement.Show(caption, message, DialogButton.OkCancel);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
112 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
113
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
114 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
115 /// Shows a new <see cref="MessageWindowElement"/> with the given caption, message and buttons
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
116 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
117 /// <param name="caption"></param>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
118 /// <param name="message"></param>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
119 /// <param name="buttons"></param>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
120 /// <returns></returns>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
121 public static DialogResult Show(string caption, string message, DialogButton buttons)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
122 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
123 lock (SyncObject)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
124 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
125 DialogResult result = DialogResult.None;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
126
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
127 System.Windows.Application.Current.Dispatcher.Invoke(
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
128 (Action)delegate
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
129 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
130 MessageWindowElement window = new MessageWindowElement
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
131 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
132 Title = caption,
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
133 Content = message,
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
134 Buttons = buttons,
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
135 StartupLocation = StartupPosition.CenterParent
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
136 };
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
137
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
138 result = ServiceLocator.GetService<IVirtualDesktopManager>().ShowDialog(window);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
139 });
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
140
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
141 return result;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
142 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
143 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
144
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
145 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
146
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
147 #region · Properties ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
148
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
149 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
150 /// Gets or sets the button combination to be shown
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
151 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
152 public DialogButton Buttons
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
153 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
154 get { return (DialogButton)base.GetValue(MessageWindowElement.ButtonsProperty); }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
155 set { base.SetValue(MessageWindowElement.ButtonsProperty, value); }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
156 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
157
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
158 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
159
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
160 #region · Constructors ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
161
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
162 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
163 /// Initializes a new instance of the <see cref="MessageWindowElement"/> class
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
164 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
165 public MessageWindowElement()
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
166 : base()
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
167 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
168 CommandBinding bindinAccept = new CommandBinding(MessageWindowElement.AcceptCommand, new ExecutedRoutedEventHandler(OnAccept));
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
169 this.CommandBindings.Add(bindinAccept);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
170
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
171 CommandBinding bindingCancel = new CommandBinding(MessageWindowElement.CancelCommand, new ExecutedRoutedEventHandler(OnCancel));
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
172 this.CommandBindings.Add(bindingCancel);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
173 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
174
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
175 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
176
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
177 #region · Protected Methods ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
178
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
179 /// <summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
180 /// Focuses the window
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
181 /// </summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
182 protected override void GiveFocus()
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
183 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
184 this.SetFocus();
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
185 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
186
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
187 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
188
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
189 #region · Command Actions ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
190
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
191 private void OnAccept(object sender, ExecutedRoutedEventArgs e)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
192 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
193 if (this.Buttons == DialogButton.Ok ||
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
194 this.Buttons == DialogButton.OkCancel)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
195 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
196 this.DialogResult = DialogResult.Ok;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
197 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
198 else
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
199 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
200 this.DialogResult = DialogResult.Yes;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
201 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
202
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
203 this.Hide();
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
204 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
205
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
206 private void OnCancel(object sender, ExecutedRoutedEventArgs e)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
207 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
208 if (this.Buttons == DialogButton.OkCancel)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
209 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
210 this.DialogResult = DialogResult.Cancel;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
211 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
212 else
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
213 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
214 this.DialogResult = DialogResult.No;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
215 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
216
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
217 this.Hide();
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
218 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
219
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
220 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
221 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
222 }