Mercurial > silverbladetech
annotate SilverlightGlimpse/FloatableWindow/FloatableWindow.cs @ 69:a0bcd783e612
Latest work
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Mon, 23 Apr 2012 11:06:10 +0100 |
parents | 810116cd6b8e |
children |
rev | line source |
---|---|
62
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1 // This source is subject to the Microsoft Public License (Ms-PL). |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
2 // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
3 // All other rights reserved. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
4 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
5 using System.Collections; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
6 using System.ComponentModel; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
7 using System.Diagnostics; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
8 using System.Windows.Automation; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
9 using System.Windows.Automation.Peers; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
10 using System.Windows.Controls.Primitives; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
11 using System.Windows.Input; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
12 using System.Windows.Media; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
13 using System.Windows.Media.Animation; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
14 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
15 namespace System.Windows.Controls |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
16 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
17 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
18 /// Provides a window that can be displayed over a parent window and blocks |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
19 /// interaction with the parent window. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
20 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
21 /// <QualityBand>Preview</QualityBand> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
22 [TemplatePart(Name = PART_Chrome, Type = typeof(FrameworkElement))] |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
23 [TemplatePart(Name = PART_CloseButton, Type = typeof(ButtonBase))] |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
24 [TemplatePart(Name = PART_ContentPresenter, Type = typeof(FrameworkElement))] |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
25 [TemplatePart(Name = PART_ContentRoot, Type = typeof(FrameworkElement))] |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
26 [TemplatePart(Name = PART_Overlay, Type = typeof(Panel))] |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
27 [TemplatePart(Name = PART_Root, Type = typeof(FrameworkElement))] |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
28 [TemplateVisualState(Name = VSMSTATE_StateClosed, GroupName = VSMGROUP_Window)] |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
29 [TemplateVisualState(Name = VSMSTATE_StateOpen, GroupName = VSMGROUP_Window)] |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
30 public class FloatableWindow : ContentControl |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
31 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
32 #region Static Fields and Constants |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
33 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
34 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
35 /// The name of the Chrome template part. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
36 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
37 private const string PART_Chrome = "Chrome"; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
38 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
39 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
40 /// The name of the CloseButton template part. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
41 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
42 private const string PART_CloseButton = "CloseButton"; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
43 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
44 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
45 /// The name of the ContentPresenter template part. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
46 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
47 private const string PART_ContentPresenter = "ContentPresenter"; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
48 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
49 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
50 /// The name of the ContentRoot template part. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
51 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
52 private const string PART_ContentRoot = "ContentRoot"; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
53 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
54 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
55 /// The name of the Overlay template part. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
56 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
57 private const string PART_Overlay = "Overlay"; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
58 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
59 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
60 /// The name of the Root template part. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
61 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
62 private const string PART_Root = "Root"; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
63 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
64 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
65 /// The name of the WindowStates VSM group. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
66 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
67 private const string VSMGROUP_Window = "WindowStates"; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
68 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
69 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
70 /// The name of the Closing VSM state. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
71 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
72 private const string VSMSTATE_StateClosed = "Closed"; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
73 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
74 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
75 /// The name of the Opening VSM state. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
76 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
77 private const string VSMSTATE_StateOpen = "Open"; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
78 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
79 #region public bool HasCloseButton |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
80 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
81 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
82 /// Gets or sets a value indicating whether the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
83 /// <see cref="T:System.Windows.Controls.FloatableWindow" /> has a close |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
84 /// button. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
85 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
86 /// <value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
87 /// True if the child window has a close button; otherwise, false. The |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
88 /// default is true. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
89 /// </value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
90 public bool HasCloseButton |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
91 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
92 get { return (bool)GetValue(HasCloseButtonProperty); } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
93 set { SetValue(HasCloseButtonProperty, value); } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
94 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
95 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
96 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
97 /// Identifies the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
98 /// <see cref="P:System.Windows.Controls.FloatableWindow.HasCloseButton" /> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
99 /// dependency property. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
100 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
101 /// <value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
102 /// The identifier for the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
103 /// <see cref="P:System.Windows.Controls.FloatableWindow.HasCloseButton" /> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
104 /// dependency property. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
105 /// </value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
106 public static readonly DependencyProperty HasCloseButtonProperty = |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
107 DependencyProperty.Register( |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
108 "HasCloseButton", |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
109 typeof(bool), |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
110 typeof(FloatableWindow), |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
111 new PropertyMetadata(true, OnHasCloseButtonPropertyChanged)); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
112 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
113 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
114 /// HasCloseButtonProperty PropertyChangedCallback call back static function. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
115 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
116 /// <param name="d">FloatableWindow object whose HasCloseButton property is changed.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
117 /// <param name="e">DependencyPropertyChangedEventArgs which contains the old and new values.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
118 private static void OnHasCloseButtonPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
119 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
120 FloatableWindow cw = (FloatableWindow)d; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
121 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
122 if (cw.CloseButton != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
123 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
124 if ((bool)e.NewValue) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
125 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
126 cw.CloseButton.Visibility = Visibility.Visible; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
127 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
128 else |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
129 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
130 cw.CloseButton.Visibility = Visibility.Collapsed; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
131 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
132 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
133 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
134 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
135 #endregion public bool HasCloseButton |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
136 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
137 #region public Brush OverlayBrush |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
138 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
139 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
140 /// Gets or sets the visual brush that is used to cover the parent |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
141 /// window when the child window is open. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
142 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
143 /// <value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
144 /// The visual brush that is used to cover the parent window when the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
145 /// <see cref="T:System.Windows.Controls.FloatableWindow" /> is open. The |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
146 /// default is null. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
147 /// </value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
148 public Brush OverlayBrush |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
149 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
150 get { return (Brush)GetValue(OverlayBrushProperty); } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
151 set { SetValue(OverlayBrushProperty, value); } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
152 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
153 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
154 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
155 /// Identifies the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
156 /// <see cref="P:System.Windows.Controls.FloatableWindow.OverlayBrush" /> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
157 /// dependency property. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
158 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
159 /// <value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
160 /// The identifier for the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
161 /// <see cref="P:System.Windows.Controls.FloatableWindow.OverlayBrush" /> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
162 /// dependency property. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
163 /// </value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
164 public static readonly DependencyProperty OverlayBrushProperty = |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
165 DependencyProperty.Register( |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
166 "OverlayBrush", |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
167 typeof(Brush), |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
168 typeof(FloatableWindow), |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
169 new PropertyMetadata(OnOverlayBrushPropertyChanged)); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
170 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
171 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
172 /// OverlayBrushProperty PropertyChangedCallback call back static function. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
173 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
174 /// <param name="d">FloatableWindow object whose OverlayBrush property is changed.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
175 /// <param name="e">DependencyPropertyChangedEventArgs which contains the old and new values.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
176 private static void OnOverlayBrushPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
177 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
178 FloatableWindow cw = (FloatableWindow)d; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
179 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
180 if (cw.Overlay != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
181 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
182 cw.Overlay.Background = (Brush)e.NewValue; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
183 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
184 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
185 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
186 #endregion public Brush OverlayBrush |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
187 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
188 #region public double OverlayOpacity |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
189 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
190 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
191 /// Gets or sets the opacity of the overlay brush that is used to cover |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
192 /// the parent window when the child window is open. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
193 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
194 /// <value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
195 /// The opacity of the overlay brush that is used to cover the parent |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
196 /// window when the <see cref="T:System.Windows.Controls.FloatableWindow" /> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
197 /// is open. The default is 1.0. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
198 /// </value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
199 public double OverlayOpacity |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
200 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
201 get { return (double)GetValue(OverlayOpacityProperty); } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
202 set { SetValue(OverlayOpacityProperty, value); } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
203 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
204 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
205 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
206 /// Identifies the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
207 /// <see cref="P:System.Windows.Controls.FloatableWindow.OverlayOpacity" /> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
208 /// dependency property. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
209 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
210 /// <value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
211 /// The identifier for the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
212 /// <see cref="P:System.Windows.Controls.FloatableWindow.OverlayOpacity" /> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
213 /// dependency property. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
214 /// </value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
215 public static readonly DependencyProperty OverlayOpacityProperty = |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
216 DependencyProperty.Register( |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
217 "OverlayOpacity", |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
218 typeof(double), |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
219 typeof(FloatableWindow), |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
220 new PropertyMetadata(OnOverlayOpacityPropertyChanged)); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
221 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
222 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
223 /// OverlayOpacityProperty PropertyChangedCallback call back static function. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
224 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
225 /// <param name="d">FloatableWindow object whose OverlayOpacity property is changed.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
226 /// <param name="e">DependencyPropertyChangedEventArgs which contains the old and new values.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
227 private static void OnOverlayOpacityPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
228 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
229 FloatableWindow cw = (FloatableWindow)d; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
230 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
231 if (cw.Overlay != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
232 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
233 cw.Overlay.Opacity = (double)e.NewValue; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
234 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
235 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
236 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
237 #endregion public double OverlayOpacity |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
238 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
239 #region private static Control RootVisual |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
240 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
241 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
242 /// Gets the root visual element. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
243 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
244 private static Control RootVisual |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
245 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
246 get |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
247 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
248 return Application.Current == null ? null : (Application.Current.RootVisual as Control); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
249 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
250 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
251 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
252 #endregion private static Control RootVisual |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
253 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
254 #region public object Title |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
255 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
256 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
257 /// Gets or sets the title that is displayed in the frame of the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
258 /// <see cref="T:System.Windows.Controls.FloatableWindow" />. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
259 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
260 /// <value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
261 /// The title displayed at the top of the window. The default is null. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
262 /// </value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
263 public object Title |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
264 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
265 get { return GetValue(TitleProperty); } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
266 set { SetValue(TitleProperty, value); } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
267 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
268 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
269 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
270 /// Identifies the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
271 /// <see cref="P:System.Windows.Controls.FloatableWindow.Title" /> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
272 /// dependency property. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
273 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
274 /// <value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
275 /// The identifier for the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
276 /// <see cref="P:System.Windows.Controls.FloatableWindow.Title" /> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
277 /// dependency property. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
278 /// </value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
279 public static readonly DependencyProperty TitleProperty = |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
280 DependencyProperty.Register( |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
281 "Title", |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
282 typeof(object), |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
283 typeof(FloatableWindow), |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
284 null); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
285 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
286 #endregion public object Title |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
287 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
288 #endregion Static Fields and Constants |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
289 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
290 #region Member Fields |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
291 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
292 /// Set in the overloaded Show method. Offsets the Popup vertically from the top left corner of the browser window by this amount. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
293 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
294 private double _verticalOffset; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
295 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
296 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
297 /// Set in the overloaded Show method. Offsets the Popup horizontally from the top left corner of the browser window by this amount. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
298 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
299 private double _horizontalOffset; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
300 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
301 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
302 /// Private accessor for the Resizer. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
303 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
304 private FrameworkElement _resizer; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
305 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
306 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
307 /// Private accessor for the IsModal |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
308 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
309 [DefaultValue(false)] |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
310 private bool _modal; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
311 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
312 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
313 /// Private accessor for the Chrome. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
314 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
315 private FrameworkElement _chrome; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
316 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
317 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
318 /// Private accessor for the click point on the chrome. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
319 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
320 private Point _clickPoint; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
321 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
322 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
323 /// Private accessor for the Closing storyboard. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
324 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
325 private Storyboard _closed; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
326 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
327 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
328 /// Private accessor for the ContentPresenter. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
329 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
330 private FrameworkElement _contentPresenter; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
331 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
332 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
333 /// Private accessor for the translate transform that needs to be applied on to the ContentRoot. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
334 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
335 private TranslateTransform _contentRootTransform; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
336 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
337 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
338 /// Content area desired width. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
339 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
340 private double _desiredContentWidth; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
341 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
342 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
343 /// Content area desired height. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
344 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
345 private double _desiredContentHeight; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
346 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
347 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
348 /// Desired margin for the window. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
349 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
350 private Thickness _desiredMargin; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
351 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
352 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
353 /// Private accessor for the Dialog Result property. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
354 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
355 private bool? _dialogresult; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
356 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
357 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
358 /// Private accessor for the FloatableWindow InteractionState. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
359 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
360 private WindowInteractionState _interactionState; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
361 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
362 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
363 /// Boolean value that specifies whether the application is exit or not. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
364 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
365 private bool _isAppExit; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
366 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
367 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
368 /// Boolean value that specifies whether the window is in closing state or not. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
369 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
370 private bool _isClosing; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
371 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
372 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
373 /// Boolean value that specifies whether the window is opened. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
374 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
375 private bool _isOpen; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
376 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
377 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
378 /// Private accessor for the Opening storyboard. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
379 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
380 private Storyboard _opened; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
381 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
382 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
383 /// Boolean value that specifies whether the mouse is captured or not. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
384 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
385 private bool _isMouseCaptured; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
386 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
387 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
388 /// Private accessor for the Root of the window. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
389 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
390 private FrameworkElement _root; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
391 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
392 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
393 /// Private accessor for the position of the window with respect to RootVisual. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
394 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
395 private Point _windowPosition; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
396 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
397 private static int z; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
398 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
399 #endregion Member Fields |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
400 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
401 #region Constructors |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
402 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
403 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
404 /// Initializes a new instance of the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
405 /// <see cref="T:System.Windows.Controls.FloatableWindow" /> class. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
406 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
407 public FloatableWindow() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
408 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
409 this.DefaultStyleKey = typeof(FloatableWindow); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
410 this.InteractionState = WindowInteractionState.NotResponding; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
411 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
412 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
413 #endregion Constructors |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
414 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
415 #region Events |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
416 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
417 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
418 /// Occurs when the <see cref="T:System.Windows.Controls.FloatableWindow" /> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
419 /// is closed. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
420 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
421 public event EventHandler Closed; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
422 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
423 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
424 /// Occurs when the <see cref="T:System.Windows.Controls.FloatableWindow" /> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
425 /// is closing. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
426 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
427 public event EventHandler<CancelEventArgs> Closing; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
428 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
429 #endregion Events |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
430 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
431 #region Properties |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
432 |
69 | 433 private Panel _parentLayoutRoot; |
62
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
434 public Panel ParentLayoutRoot |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
435 { |
69 | 436 get { return _parentLayoutRoot; } |
437 set { _parentLayoutRoot = value; } | |
62
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
438 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
439 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
440 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
441 /// Gets the internal accessor for the ContentRoot of the window. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
442 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
443 internal FrameworkElement ContentRoot |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
444 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
445 get; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
446 private set; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
447 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
448 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
449 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
450 /// Setting for the horizontal positioning offset for start position |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
451 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
452 public double HorizontalOffset |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
453 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
454 get { return _horizontalOffset; } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
455 set { _horizontalOffset = value; } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
456 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
457 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
458 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
459 /// Setting for the vertical positioning offset for start position |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
460 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
461 public double VerticalOffset |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
462 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
463 get { return _verticalOffset; } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
464 set { _verticalOffset = value; } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
465 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
466 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
467 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
468 /// Gets the internal accessor for the modal of the window. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
469 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
470 public bool IsModal |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
471 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
472 get |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
473 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
474 return _modal; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
475 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
476 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
477 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
478 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
479 /// Gets or sets a value indicating whether the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
480 /// <see cref="T:System.Windows.Controls.FloatableWindow" /> was accepted or |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
481 /// canceled. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
482 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
483 /// <value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
484 /// True if the child window was accepted; false if the child window was |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
485 /// canceled. The default is null. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
486 /// </value> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
487 [TypeConverter(typeof(NullableBoolConverter))] |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
488 public bool? DialogResult |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
489 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
490 get |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
491 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
492 return this._dialogresult; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
493 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
494 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
495 set |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
496 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
497 if (this._dialogresult != value) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
498 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
499 this._dialogresult = value; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
500 this.Close(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
501 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
502 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
503 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
504 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
505 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
506 /// Gets the internal accessor for the PopUp of the window. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
507 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
508 internal Popup ChildWindowPopup |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
509 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
510 get; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
511 private set; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
512 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
513 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
514 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
515 /// Gets the internal accessor for the close button of the window. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
516 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
517 internal ButtonBase CloseButton |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
518 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
519 get; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
520 private set; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
521 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
522 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
523 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
524 /// Gets the InteractionState for the FloatableWindow. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
525 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
526 internal WindowInteractionState InteractionState |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
527 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
528 get |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
529 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
530 return this._interactionState; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
531 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
532 private set |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
533 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
534 if (this._interactionState != value) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
535 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
536 WindowInteractionState oldValue = this._interactionState; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
537 this._interactionState = value; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
538 FloatableWindowAutomationPeer peer = FloatableWindowAutomationPeer.FromElement(this) as FloatableWindowAutomationPeer; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
539 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
540 if (peer != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
541 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
542 peer.RaiseInteractionStatePropertyChangedEvent(oldValue, this._interactionState); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
543 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
544 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
545 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
546 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
547 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
548 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
549 /// Gets a value indicating whether the PopUp is open or not. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
550 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
551 private bool IsOpen |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
552 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
553 get |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
554 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
555 return (this.ChildWindowPopup != null && this.ChildWindowPopup.IsOpen) || |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
556 ((ParentLayoutRoot != null) && (ParentLayoutRoot.Children.Contains(this))); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
557 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
558 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
559 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
560 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
561 /// Gets the internal accessor for the overlay of the window. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
562 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
563 internal Panel Overlay |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
564 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
565 get; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
566 private set; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
567 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
568 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
569 #endregion Properties |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
570 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
571 #region Static Methods |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
572 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
573 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
574 /// Inverts the input matrix. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
575 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
576 /// <param name="matrix">The matrix values that is to be inverted.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
577 /// <returns>Returns a value indicating whether the inversion was successful or not.</returns> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
578 private static bool InvertMatrix(ref Matrix matrix) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
579 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
580 double determinant = (matrix.M11 * matrix.M22) - (matrix.M12 * matrix.M21); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
581 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
582 if (determinant == 0.0) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
583 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
584 return false; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
585 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
586 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
587 Matrix matCopy = matrix; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
588 matrix.M11 = matCopy.M22 / determinant; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
589 matrix.M12 = -1 * matCopy.M12 / determinant; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
590 matrix.M21 = -1 * matCopy.M21 / determinant; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
591 matrix.M22 = matCopy.M11 / determinant; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
592 matrix.OffsetX = ((matCopy.OffsetY * matCopy.M21) - (matCopy.OffsetX * matCopy.M22)) / determinant; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
593 matrix.OffsetY = ((matCopy.OffsetX * matCopy.M12) - (matCopy.OffsetY * matCopy.M11)) / determinant; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
594 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
595 return true; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
596 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
597 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
598 #endregion Static Methods |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
599 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
600 #region Methods |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
601 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
602 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
603 /// Executed when the application is exited. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
604 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
605 /// <param name="sender">The sender.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
606 /// <param name="e">Event args.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
607 internal void Application_Exit(object sender, EventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
608 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
609 if (this.IsOpen) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
610 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
611 this._isAppExit = true; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
612 try |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
613 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
614 this.Close(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
615 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
616 finally |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
617 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
618 this._isAppExit = false; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
619 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
620 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
621 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
622 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
623 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
624 /// Executed when focus is given to the window via a click. Attempts to bring current |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
625 /// window to the front in the event there are more windows. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
626 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
627 internal void BringToFront() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
628 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
629 z++; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
630 Canvas.SetZIndex(this, z); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
631 #if DEBUG |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
632 this.Title = z.ToString(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
633 #endif |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
634 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
635 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
636 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
637 /// Changes the visual state of the FloatableWindow. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
638 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
639 private void ChangeVisualState() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
640 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
641 if (this._isClosing) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
642 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
643 VisualStateManager.GoToState(this, VSMSTATE_StateClosed, true); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
644 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
645 else |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
646 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
647 VisualStateManager.GoToState(this, VSMSTATE_StateOpen, true); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
648 BringToFront(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
649 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
650 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
651 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
652 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
653 /// Executed when FloatableWindow size is changed. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
654 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
655 /// <param name="sender">Sender object.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
656 /// <param name="e">Size changed event args.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
657 private void ChildWindow_SizeChanged(object sender, SizeChangedEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
658 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
659 if (_modal) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
660 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
661 if (this.Overlay != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
662 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
663 if (e.NewSize.Height != this.Overlay.Height) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
664 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
665 this._desiredContentHeight = e.NewSize.Height; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
666 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
667 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
668 if (e.NewSize.Width != this.Overlay.Width) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
669 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
670 this._desiredContentWidth = e.NewSize.Width; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
671 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
672 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
673 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
674 if (this.IsOpen) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
675 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
676 this.UpdateOverlaySize(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
677 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
678 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
679 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
680 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
681 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
682 /// Closes a <see cref="T:System.Windows.Controls.FloatableWindow" />. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
683 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
684 public void Close() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
685 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
686 // AutomationPeer returns "Closing" when Close() is called |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
687 // but the window is not closed completely: |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
688 this.InteractionState = WindowInteractionState.Closing; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
689 CancelEventArgs e = new CancelEventArgs(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
690 this.OnClosing(e); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
691 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
692 // On ApplicationExit, close() cannot be cancelled |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
693 if (!e.Cancel || this._isAppExit) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
694 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
695 if (RootVisual != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
696 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
697 RootVisual.IsEnabled = true; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
698 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
699 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
700 // Close Popup |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
701 if (this.IsOpen) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
702 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
703 if (this._closed != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
704 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
705 // Popup will be closed when the storyboard ends |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
706 this._isClosing = true; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
707 try |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
708 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
709 var sb = GetVisualStateStoryboard("WindowStates", "Closed"); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
710 sb.Completed += (s, args) => |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
711 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
712 this.ParentLayoutRoot.Children.Remove(this); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
713 this.OnClosed(EventArgs.Empty); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
714 this.UnSubscribeFromEvents(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
715 this.UnsubscribeFromTemplatePartEvents(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
716 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
717 if (Application.Current.RootVisual != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
718 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
719 Application.Current.RootVisual.GotFocus -= new RoutedEventHandler(this.RootVisual_GotFocus); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
720 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
721 }; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
722 this.ChangeVisualState(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
723 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
724 finally |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
725 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
726 this._isClosing = false; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
727 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
728 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
729 else |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
730 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
731 // If no closing storyboard is defined, close the Popup |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
732 this.ChildWindowPopup.IsOpen = false; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
733 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
734 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
735 if (!this._dialogresult.HasValue) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
736 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
737 // If close action is not happening because of DialogResult property change action, |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
738 // Dialogresult is always false: |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
739 this._dialogresult = false; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
740 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
741 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
742 //this.OnClosed(EventArgs.Empty); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
743 //this.UnSubscribeFromEvents(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
744 //this.UnsubscribeFromTemplatePartEvents(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
745 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
746 //if (Application.Current.RootVisual != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
747 //{ |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
748 // Application.Current.RootVisual.GotFocus -= new RoutedEventHandler(this.RootVisual_GotFocus); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
749 //} |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
750 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
751 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
752 else |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
753 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
754 // If the Close is cancelled, DialogResult should always be NULL: |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
755 this._dialogresult = null; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
756 this.InteractionState = WindowInteractionState.Running; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
757 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
758 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
759 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
760 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
761 /// Brings the window to the front of others |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
762 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
763 /// <param name="sender"></param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
764 /// <param name="e"></param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
765 internal void ContentRoot_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
766 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
767 BringToFront(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
768 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
769 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
770 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
771 /// Executed when the CloseButton is clicked. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
772 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
773 /// <param name="sender">Sender object.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
774 /// <param name="e">Routed event args.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
775 internal void CloseButton_Click(object sender, RoutedEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
776 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
777 this.Close(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
778 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
779 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
780 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
781 /// Executed when the Closing storyboard ends. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
782 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
783 /// <param name="sender">Sender object.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
784 /// <param name="e">Event args.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
785 private void Closing_Completed(object sender, EventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
786 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
787 if (this.ChildWindowPopup != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
788 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
789 this.ChildWindowPopup.IsOpen = false; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
790 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
791 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
792 // AutomationPeer returns "NotResponding" when the FloatableWindow is closed: |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
793 this.InteractionState = WindowInteractionState.NotResponding; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
794 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
795 if (this._closed != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
796 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
797 this._closed.Completed -= new EventHandler(this.Closing_Completed); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
798 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
799 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
800 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
801 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
802 /// Executed when the a key is presses when the window is open. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
803 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
804 /// <param name="sender">Sender object.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
805 /// <param name="e">Key event args.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
806 private void ChildWindow_KeyDown(object sender, KeyEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
807 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
808 FloatableWindow ew = sender as FloatableWindow; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
809 Debug.Assert(ew != null, "FloatableWindow instance is null."); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
810 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
811 // Ctrl+Shift+F4 closes the FloatableWindow |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
812 if (e != null && !e.Handled && e.Key == Key.F4 && |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
813 ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) && |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
814 ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
815 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
816 ew.Close(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
817 e.Handled = true; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
818 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
819 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
820 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
821 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
822 /// Executed when the window loses focus. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
823 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
824 /// <param name="sender">Sender object.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
825 /// <param name="e">Routed event args.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
826 private void ChildWindow_LostFocus(object sender, RoutedEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
827 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
828 // If the FloatableWindow loses focus but the popup is still open, |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
829 // it means another popup is opened. To get the focus back when the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
830 // popup is closed, we handle GotFocus on the RootVisual |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
831 // TODO: Something else could get focus and handle the GotFocus event right. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
832 // Try listening to routed events that were Handled (new SL 3 feature) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
833 // Blocked by Jolt bug #29419 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
834 if (this.IsOpen && Application.Current != null && Application.Current.RootVisual != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
835 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
836 this.InteractionState = WindowInteractionState.BlockedByModalWindow; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
837 Application.Current.RootVisual.GotFocus += new RoutedEventHandler(this.RootVisual_GotFocus); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
838 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
839 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
840 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
841 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
842 /// Executed when mouse left button is down on the chrome. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
843 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
844 /// <param name="sender">Sender object.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
845 /// <param name="e">Mouse button event args.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
846 private void Chrome_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
847 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
848 if (this._chrome != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
849 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
850 e.Handled = true; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
851 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
852 if (this.CloseButton != null && !this.CloseButton.IsTabStop) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
853 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
854 this.CloseButton.IsTabStop = true; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
855 try |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
856 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
857 this.Focus(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
858 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
859 finally |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
860 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
861 this.CloseButton.IsTabStop = false; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
862 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
863 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
864 else |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
865 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
866 this.Focus(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
867 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
868 this._chrome.CaptureMouse(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
869 this._isMouseCaptured = true; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
870 this._clickPoint = e.GetPosition(sender as UIElement); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
871 #if DEBUG |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
872 this.Title = string.Format("X:{0},Y:{1}", this._clickPoint.X.ToString(), this._clickPoint.Y.ToString()); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
873 #endif |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
874 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
875 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
876 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
877 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
878 /// Executed when mouse left button is up on the chrome. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
879 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
880 /// <param name="sender">Sender object.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
881 /// <param name="e">Mouse button event args.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
882 private void Chrome_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
883 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
884 if (this._chrome != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
885 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
886 //e.Handled = true; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
887 this._chrome.ReleaseMouseCapture(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
888 this._isMouseCaptured = false; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
889 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
890 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
891 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
892 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
893 /// Executed when mouse moves on the chrome. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
894 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
895 /// <param name="sender">Sender object.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
896 /// <param name="e">Mouse event args.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
897 private void Chrome_MouseMove(object sender, MouseEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
898 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
899 #region New ChildWindow Code not working |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
900 //if (this._isMouseCaptured && this.ContentRoot != null && Application.Current != null && Application.Current.RootVisual != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
901 //{ |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
902 // Point position = e.GetPosition(Application.Current.RootVisual); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
903 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
904 // GeneralTransform gt = this.ContentRoot.TransformToVisual(Application.Current.RootVisual); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
905 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
906 // if (gt != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
907 // { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
908 // Point p = gt.Transform(this._clickPoint); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
909 // this._windowPosition = gt.Transform(new Point(0, 0)); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
910 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
911 // if (position.X < 0) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
912 // { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
913 // double Y = FindPositionY(p, position, 0); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
914 // position = new Point(0, Y); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
915 // } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
916 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
917 // if (position.X > this.Width) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
918 // { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
919 // double Y = FindPositionY(p, position, this.Width); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
920 // position = new Point(this.Width, Y); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
921 // } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
922 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
923 // if (position.Y < 0) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
924 // { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
925 // double X = FindPositionX(p, position, 0); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
926 // position = new Point(X, 0); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
927 // } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
928 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
929 // if (position.Y > this.Height) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
930 // { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
931 // double X = FindPositionX(p, position, this.Height); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
932 // position = new Point(X, this.Height); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
933 // } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
934 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
935 // double x = position.X - p.X; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
936 // double y = position.Y - p.Y; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
937 // UpdateContentRootTransform(x, y); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
938 // } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
939 //} |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
940 #endregion |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
941 if (this._isMouseCaptured && this.ContentRoot != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
942 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
943 // If the child window is dragged out of the page, return |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
944 if (Application.Current != null && Application.Current.RootVisual != null && |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
945 (e.GetPosition(Application.Current.RootVisual).X < 0 || e.GetPosition(Application.Current.RootVisual).Y < 0)) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
946 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
947 return; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
948 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
949 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
950 TransformGroup transformGroup = this.ContentRoot.RenderTransform as TransformGroup; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
951 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
952 if (transformGroup == null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
953 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
954 transformGroup = new TransformGroup(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
955 transformGroup.Children.Add(this.ContentRoot.RenderTransform); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
956 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
957 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
958 TranslateTransform t = new TranslateTransform(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
959 t.X = e.GetPosition(this.ContentRoot).X - this._clickPoint.X; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
960 t.Y = e.GetPosition(this.ContentRoot).Y - this._clickPoint.Y; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
961 if (transformGroup != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
962 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
963 transformGroup.Children.Add(t); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
964 this.ContentRoot.RenderTransform = transformGroup; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
965 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
966 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
967 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
968 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
969 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
970 /// Finds the X coordinate of a point that is defined by a line. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
971 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
972 /// <param name="p1">Starting point of the line.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
973 /// <param name="p2">Ending point of the line.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
974 /// <param name="y">Y coordinate of the point.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
975 /// <returns>X coordinate of the point.</returns> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
976 private static double FindPositionX(Point p1, Point p2, double y) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
977 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
978 if (y == p1.Y || p1.X == p2.X) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
979 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
980 return p2.X; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
981 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
982 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
983 Debug.Assert(p1.Y != p2.Y, "Unexpected equal Y coordinates"); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
984 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
985 return (((y - p1.Y) * (p1.X - p2.X)) / (p1.Y - p2.Y)) + p1.X; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
986 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
987 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
988 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
989 /// Finds the Y coordinate of a point that is defined by a line. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
990 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
991 /// <param name="p1">Starting point of the line.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
992 /// <param name="p2">Ending point of the line.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
993 /// <param name="x">X coordinate of the point.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
994 /// <returns>Y coordinate of the point.</returns> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
995 private static double FindPositionY(Point p1, Point p2, double x) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
996 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
997 if (p1.Y == p2.Y || x == p1.X) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
998 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
999 return p2.Y; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1000 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1001 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1002 Debug.Assert(p1.X != p2.X, "Unexpected equal X coordinates"); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1003 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1004 return (((p1.Y - p2.Y) * (x - p1.X)) / (p1.X - p2.X)) + p1.Y; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1005 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1006 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1007 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1008 /// Builds the visual tree for the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1009 /// <see cref="T:System.Windows.Controls.FloatableWindow" /> control when a |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1010 /// new template is applied. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1011 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1012 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "No need to split the code into two parts.")] |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1013 public override void OnApplyTemplate() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1014 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1015 this.UnsubscribeFromTemplatePartEvents(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1016 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1017 base.OnApplyTemplate(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1018 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1019 this.CloseButton = GetTemplateChild(PART_CloseButton) as ButtonBase; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1020 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1021 if (this.CloseButton != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1022 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1023 if (this.HasCloseButton) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1024 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1025 this.CloseButton.Visibility = Visibility.Visible; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1026 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1027 else |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1028 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1029 this.CloseButton.Visibility = Visibility.Collapsed; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1030 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1031 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1032 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1033 if (this._closed != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1034 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1035 this._closed.Completed -= new EventHandler(this.Closing_Completed); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1036 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1037 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1038 if (this._opened != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1039 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1040 this._opened.Completed -= new EventHandler(this.Opening_Completed); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1041 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1042 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1043 this._root = GetTemplateChild(PART_Root) as FrameworkElement; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1044 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1045 if (this._root != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1046 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1047 IList groups = VisualStateManager.GetVisualStateGroups(this._root); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1048 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1049 if (groups != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1050 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1051 IList states = null; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1052 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1053 foreach (VisualStateGroup vsg in groups) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1054 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1055 if (vsg.Name == FloatableWindow.VSMGROUP_Window) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1056 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1057 states = vsg.States; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1058 break; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1059 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1060 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1061 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1062 if (states != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1063 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1064 foreach (VisualState state in states) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1065 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1066 if (state.Name == FloatableWindow.VSMSTATE_StateClosed) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1067 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1068 this._closed = state.Storyboard; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1069 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1070 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1071 if (state.Name == FloatableWindow.VSMSTATE_StateOpen) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1072 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1073 this._opened = state.Storyboard; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1074 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1075 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1076 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1077 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1078 //TODO: Figure out why I can't wire up the event below in SubscribeToTemplatePartEvents |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1079 this._root.MouseLeftButtonDown += new MouseButtonEventHandler(this.ContentRoot_MouseLeftButtonDown); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1080 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1081 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1082 this.ContentRoot = GetTemplateChild(PART_ContentRoot) as FrameworkElement; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1083 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1084 this._chrome = GetTemplateChild(PART_Chrome) as FrameworkElement; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1085 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1086 this.Overlay = GetTemplateChild(PART_Overlay) as Panel; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1087 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1088 this._contentPresenter = GetTemplateChild(PART_ContentPresenter) as FrameworkElement; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1089 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1090 this.SubscribeToTemplatePartEvents(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1091 this.SubscribeToStoryBoardEvents(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1092 this._desiredMargin = this.Margin; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1093 this.Margin = new Thickness(0); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1094 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1095 // Update overlay size |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1096 if (this.IsOpen && (this.ChildWindowPopup != null)) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1097 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1098 this._desiredContentHeight = this.Height; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1099 this._desiredContentWidth = this.Width; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1100 this.UpdateOverlaySize(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1101 this.UpdateRenderTransform(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1102 this.ChangeVisualState(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1103 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1104 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1105 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1106 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1107 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1108 /// Raises the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1109 /// <see cref="E:System.Windows.Controls.FloatableWindow.Closed" /> event. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1110 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1111 /// <param name="e">The event data.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1112 protected virtual void OnClosed(EventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1113 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1114 EventHandler handler = this.Closed; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1115 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1116 if (null != handler) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1117 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1118 handler(this, e); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1119 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1120 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1121 this._isOpen = false; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1122 if (!_modal) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1123 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1124 this.ParentLayoutRoot.Children.Remove(this); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1125 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1126 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1127 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1128 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1129 /// Raises the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1130 /// <see cref="E:System.Windows.Controls.FloatableWindow.Closing" /> event. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1131 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1132 /// <param name="e">The event data.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1133 protected virtual void OnClosing(CancelEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1134 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1135 EventHandler<CancelEventArgs> handler = this.Closing; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1136 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1137 if (null != handler) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1138 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1139 handler(this, e); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1140 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1141 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1142 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1143 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1144 /// Returns a |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1145 /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" /> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1146 /// for use by the Silverlight automation infrastructure. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1147 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1148 /// <returns> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1149 /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" /> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1150 /// for the <see cref="T:System.Windows.Controls.FloatableWindow" /> object. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1151 /// </returns> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1152 protected override AutomationPeer OnCreateAutomationPeer() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1153 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1154 return new FloatableWindowAutomationPeer(this); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1155 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1156 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1157 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1158 /// This method is called every time a |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1159 /// <see cref="T:System.Windows.Controls.FloatableWindow" /> is displayed. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1160 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1161 protected virtual void OnOpened() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1162 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1163 this.UpdatePosition(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1164 this._isOpen = true; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1165 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1166 if (this.Overlay != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1167 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1168 this.Overlay.Opacity = this.OverlayOpacity; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1169 this.Overlay.Background = this.OverlayBrush; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1170 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1171 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1172 if (!this.Focus()) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1173 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1174 // If the Focus() fails it means there is no focusable element in the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1175 // FloatableWindow. In this case we set IsTabStop to true to have the keyboard functionality |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1176 this.IsTabStop = true; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1177 this.Focus(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1178 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1179 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1180 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1181 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1182 /// Executed when the opening storyboard finishes. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1183 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1184 /// <param name="sender">Sender object.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1185 /// <param name="e">Event args.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1186 private void Opening_Completed(object sender, EventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1187 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1188 if (this._opened != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1189 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1190 this._opened.Completed -= new EventHandler(this.Opening_Completed); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1191 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1192 // AutomationPeer returns "ReadyForUserInteraction" when the FloatableWindow |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1193 // is open and all animations have been completed. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1194 this.InteractionState = WindowInteractionState.ReadyForUserInteraction; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1195 this.OnOpened(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1196 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1197 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1198 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1199 /// Executed when the page resizes. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1200 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1201 /// <param name="sender">Sender object.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1202 /// <param name="e">Event args.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1203 private void Page_Resized(object sender, EventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1204 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1205 if (this.ChildWindowPopup != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1206 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1207 this.UpdateOverlaySize(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1208 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1209 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1210 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1211 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1212 /// Executed when the root visual gets focus. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1213 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1214 /// <param name="sender">Sender object.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1215 /// <param name="e">Routed event args.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1216 private void RootVisual_GotFocus(object sender, RoutedEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1217 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1218 this.Focus(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1219 this.InteractionState = WindowInteractionState.ReadyForUserInteraction; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1220 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1221 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1222 public void Show() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1223 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1224 ShowWindow(false); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1225 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1226 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1227 public void ShowDialog() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1228 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1229 _verticalOffset = 0; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1230 _horizontalOffset = 0; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1231 ShowWindow(true); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1232 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1233 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1234 public void Show(double horizontalOffset, double verticalOffset) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1235 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1236 _horizontalOffset = horizontalOffset; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1237 _verticalOffset = verticalOffset; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1238 ShowWindow(false); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1239 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1240 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1241 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1242 /// Opens a <see cref="T:System.Windows.Controls.FloatableWindow" /> and |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1243 /// returns without waiting for the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1244 /// <see cref="T:System.Windows.Controls.FloatableWindow" /> to close. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1245 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1246 /// <exception cref="T:System.InvalidOperationException"> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1247 /// The child window is already in the visual tree. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1248 /// </exception> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1249 internal void ShowWindow(bool isModal) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1250 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1251 _modal = isModal; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1252 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1253 // AutomationPeer returns "Running" when Show() is called |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1254 // but the FloatableWindow is not ready for user interaction: |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1255 this.InteractionState = WindowInteractionState.Running; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1256 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1257 this.SubscribeToEvents(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1258 this.SubscribeToTemplatePartEvents(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1259 this.SubscribeToStoryBoardEvents(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1260 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1261 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1262 // MaxHeight and MinHeight properties should not be overwritten: |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1263 this.MaxHeight = double.PositiveInfinity; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1264 this.MaxWidth = double.PositiveInfinity; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1265 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1266 if (_modal) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1267 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1268 if (this.ChildWindowPopup == null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1269 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1270 this.ChildWindowPopup = new Popup(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1271 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1272 try |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1273 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1274 this.ChildWindowPopup.Child = this; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1275 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1276 catch (ArgumentException) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1277 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1278 // If the FloatableWindow is already in the visualtree, we cannot set it to be the child of the popup |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1279 // we are throwing a friendlier exception for this case: |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1280 this.InteractionState = WindowInteractionState.NotResponding; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1281 throw new InvalidOperationException(Properties.Resources.ChildWindow_InvalidOperation); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1282 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1283 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1284 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1285 if (this.ChildWindowPopup != null && Application.Current.RootVisual != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1286 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1287 this.ChildWindowPopup.IsOpen = true; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1288 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1289 this.ChildWindowPopup.HorizontalOffset = _horizontalOffset; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1290 this.ChildWindowPopup.VerticalOffset = _verticalOffset; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1291 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1292 // while the FloatableWindow is open, the DialogResult is always NULL: |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1293 this._dialogresult = null; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1294 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1295 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1296 else |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1297 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1298 if (ParentLayoutRoot != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1299 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1300 this.SetValue(Canvas.TopProperty, _verticalOffset); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1301 this.SetValue(Canvas.LeftProperty, _horizontalOffset); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1302 this.ParentLayoutRoot.Children.Add(this); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1303 this.BringToFront(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1304 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1305 else |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1306 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1307 throw new ArgumentNullException("ParentLayoutRoot", "You need to specify a root Panel element to add the window elements to."); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1308 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1309 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1310 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1311 // disable the underlying UI |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1312 if (RootVisual != null && _modal) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1313 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1314 RootVisual.IsEnabled = false; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1315 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1316 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1317 // if the template is already loaded, display loading visuals animation |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1318 if (this.ContentRoot == null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1319 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1320 this.Loaded += (s, args) => |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1321 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1322 if (this.ContentRoot != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1323 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1324 this.ChangeVisualState(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1325 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1326 }; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1327 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1328 else |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1329 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1330 this.ChangeVisualState(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1331 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1332 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1333 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1334 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1335 /// Subscribes to events when the FloatableWindow is opened. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1336 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1337 private void SubscribeToEvents() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1338 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1339 if (Application.Current != null && Application.Current.Host != null && Application.Current.Host.Content != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1340 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1341 Application.Current.Exit += new EventHandler(this.Application_Exit); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1342 Application.Current.Host.Content.Resized += new EventHandler(this.Page_Resized); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1343 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1344 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1345 this.KeyDown += new KeyEventHandler(this.ChildWindow_KeyDown); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1346 if (_modal) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1347 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1348 this.LostFocus += new RoutedEventHandler(this.ChildWindow_LostFocus); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1349 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1350 this.SizeChanged += new SizeChangedEventHandler(this.ChildWindow_SizeChanged); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1351 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1352 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1353 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1354 /// Subscribes to events that are on the storyboards. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1355 /// Unsubscribing from these events happen in the event handlers individually. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1356 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1357 private void SubscribeToStoryBoardEvents() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1358 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1359 if (this._closed != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1360 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1361 this._closed.Completed += new EventHandler(this.Closing_Completed); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1362 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1363 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1364 if (this._opened != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1365 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1366 this._opened.Completed += new EventHandler(this.Opening_Completed); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1367 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1368 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1369 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1370 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1371 /// Subscribes to events on the template parts. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1372 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1373 private void SubscribeToTemplatePartEvents() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1374 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1375 if (this.CloseButton != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1376 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1377 this.CloseButton.Click += new RoutedEventHandler(this.CloseButton_Click); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1378 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1379 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1380 if (this._chrome != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1381 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1382 this._chrome.MouseLeftButtonDown += new MouseButtonEventHandler(this.Chrome_MouseLeftButtonDown); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1383 this._chrome.MouseLeftButtonUp += new MouseButtonEventHandler(this.Chrome_MouseLeftButtonUp); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1384 this._chrome.MouseMove += new MouseEventHandler(this.Chrome_MouseMove); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1385 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1386 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1387 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1388 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1389 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1390 /// Unsubscribe from events when the FloatableWindow is closed. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1391 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1392 private void UnSubscribeFromEvents() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1393 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1394 if (Application.Current != null && Application.Current.Host != null && Application.Current.Host.Content != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1395 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1396 Application.Current.Exit -= new EventHandler(this.Application_Exit); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1397 Application.Current.Host.Content.Resized -= new EventHandler(this.Page_Resized); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1398 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1399 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1400 this.KeyDown -= new KeyEventHandler(this.ChildWindow_KeyDown); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1401 if (_modal) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1402 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1403 this.LostFocus -= new RoutedEventHandler(this.ChildWindow_LostFocus); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1404 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1405 this.SizeChanged -= new SizeChangedEventHandler(this.ChildWindow_SizeChanged); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1406 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1407 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1408 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1409 /// Unsubscribe from the events that are subscribed on the template part elements. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1410 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1411 private void UnsubscribeFromTemplatePartEvents() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1412 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1413 if (this.CloseButton != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1414 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1415 this.CloseButton.Click -= new RoutedEventHandler(this.CloseButton_Click); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1416 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1417 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1418 if (this._chrome != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1419 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1420 this._chrome.MouseLeftButtonDown -= new MouseButtonEventHandler(this.Chrome_MouseLeftButtonDown); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1421 this._chrome.MouseLeftButtonUp -= new MouseButtonEventHandler(this.Chrome_MouseLeftButtonUp); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1422 this._chrome.MouseMove -= new MouseEventHandler(this.Chrome_MouseMove); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1423 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1424 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1425 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1426 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1427 /// Updates the size of the overlay of the window. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1428 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1429 private void UpdateOverlaySize() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1430 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1431 if (_modal) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1432 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1433 if (this.Overlay != null && Application.Current != null && Application.Current.Host != null && Application.Current.Host.Content != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1434 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1435 this.Height = Application.Current.Host.Content.ActualHeight; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1436 this.Width = Application.Current.Host.Content.ActualWidth; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1437 this.Overlay.Height = this.Height; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1438 this.Overlay.Width = this.Width; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1439 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1440 if (this.ContentRoot != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1441 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1442 this.ContentRoot.Width = this._desiredContentWidth; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1443 this.ContentRoot.Height = this._desiredContentHeight; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1444 this.ContentRoot.Margin = this._desiredMargin; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1445 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1446 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1447 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1448 else |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1449 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1450 if (this.Overlay != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1451 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1452 this.Overlay.Visibility = Visibility.Collapsed; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1453 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1454 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1455 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1456 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1457 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1458 /// Updates the position of the window in case the size of the content changes. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1459 /// This allows FloatableWindow only scale from right and bottom. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1460 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1461 private void UpdatePosition() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1462 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1463 if (this.ContentRoot != null && Application.Current != null && Application.Current.RootVisual != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1464 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1465 GeneralTransform gt = this.ContentRoot.TransformToVisual(Application.Current.RootVisual); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1466 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1467 if (gt != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1468 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1469 this._windowPosition = gt.Transform(new Point(0, 0)); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1470 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1471 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1472 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1473 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1474 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1475 /// Updates the render transform applied on the overlay. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1476 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1477 private void UpdateRenderTransform() |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1478 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1479 if (this._root != null && this.ContentRoot != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1480 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1481 // The Overlay part should not be affected by the render transform applied on the |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1482 // FloatableWindow. In order to achieve this, we adjust an identity matrix to represent |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1483 // the _root's transformation, invert it, apply the inverted matrix on the _root, so that |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1484 // nothing is affected by the rendertransform, and apply the original transform only on the Content |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1485 GeneralTransform gt = this._root.TransformToVisual(null); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1486 if (gt != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1487 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1488 Point p10 = new Point(1, 0); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1489 Point p01 = new Point(0, 1); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1490 Point transform10 = gt.Transform(p10); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1491 Point transform01 = gt.Transform(p01); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1492 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1493 Matrix transformToRootMatrix = Matrix.Identity; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1494 transformToRootMatrix.M11 = transform10.X; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1495 transformToRootMatrix.M12 = transform10.Y; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1496 transformToRootMatrix.M21 = transform01.X; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1497 transformToRootMatrix.M22 = transform01.Y; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1498 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1499 MatrixTransform original = new MatrixTransform(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1500 original.Matrix = transformToRootMatrix; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1501 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1502 InvertMatrix(ref transformToRootMatrix); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1503 MatrixTransform mt = new MatrixTransform(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1504 mt.Matrix = transformToRootMatrix; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1505 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1506 TransformGroup tg = this._root.RenderTransform as TransformGroup; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1507 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1508 if (tg != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1509 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1510 tg.Children.Add(mt); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1511 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1512 else |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1513 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1514 this._root.RenderTransform = mt; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1515 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1516 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1517 tg = this.ContentRoot.RenderTransform as TransformGroup; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1518 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1519 if (tg != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1520 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1521 tg.Children.Add(original); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1522 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1523 else |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1524 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1525 this.ContentRoot.RenderTransform = original; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1526 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1527 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1528 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1529 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1530 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1531 /// <summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1532 /// Updates the ContentRootTranslateTransform. |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1533 /// </summary> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1534 /// <param name="X">X coordinate of the transform.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1535 /// <param name="Y">Y coordinate of the transform.</param> |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1536 private void UpdateContentRootTransform(double X, double Y) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1537 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1538 if (this._contentRootTransform == null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1539 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1540 this._contentRootTransform = new TranslateTransform(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1541 this._contentRootTransform.X = X; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1542 this._contentRootTransform.Y = Y; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1543 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1544 TransformGroup transformGroup = this.ContentRoot.RenderTransform as TransformGroup; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1545 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1546 if (transformGroup == null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1547 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1548 transformGroup = new TransformGroup(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1549 transformGroup.Children.Add(this.ContentRoot.RenderTransform); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1550 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1551 transformGroup.Children.Add(this._contentRootTransform); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1552 this.ContentRoot.RenderTransform = transformGroup; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1553 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1554 else |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1555 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1556 this._contentRootTransform.X += X; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1557 this._contentRootTransform.Y += Y; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1558 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1559 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1560 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1561 private void Resizer_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1562 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1563 this._resizer.CaptureMouse(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1564 this._isMouseCaptured = true; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1565 this._clickPoint = e.GetPosition(sender as UIElement); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1566 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1567 #if DEBUG |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1568 this.Title = string.Format("X:{0},Y:{1}", this._clickPoint.X.ToString(), this._clickPoint.Y.ToString()); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1569 #endif |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1570 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1571 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1572 private void Resizer_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1573 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1574 this._resizer.ReleaseMouseCapture(); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1575 this._isMouseCaptured = false; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1576 this._resizer.Opacity = 0.25; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1577 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1578 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1579 private void Resizer_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1580 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1581 if (this._isMouseCaptured && this.ContentRoot != null) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1582 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1583 // If the child window is dragged out of the page, return |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1584 if (Application.Current != null && Application.Current.RootVisual != null && |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1585 (e.GetPosition(Application.Current.RootVisual).X < 0 || e.GetPosition(Application.Current.RootVisual).Y < 0)) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1586 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1587 return; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1588 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1589 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1590 #if DEBUG |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1591 this.Title = string.Format("X:{0},Y:{1}", this._clickPoint.X.ToString(), this._clickPoint.Y.ToString()); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1592 #endif |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1593 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1594 Point p = e.GetPosition(this.ContentRoot); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1595 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1596 if ((p.X > this._clickPoint.X) && (p.Y > this._clickPoint.Y)) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1597 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1598 this.Width = (double)(p.X - (12 - this._clickPoint.X)); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1599 this.Height = (double)(p.Y - (12 - this._clickPoint.Y)); |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1600 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1601 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1602 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1603 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1604 private Storyboard GetVisualStateStoryboard(string visualStateGroupName, string visualStateName) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1605 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1606 foreach (VisualStateGroup g in VisualStateManager.GetVisualStateGroups((FrameworkElement)this.ContentRoot.Parent)) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1607 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1608 if (g.Name != visualStateGroupName) continue; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1609 foreach (VisualState s in g.States) |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1610 { |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1611 if (s.Name != visualStateName) continue; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1612 return s.Storyboard; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1613 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1614 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1615 return null; |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1616 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1617 |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1618 #endregion Methods |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1619 } |
810116cd6b8e
ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1620 } |