annotate SilverlightGlimpse/FloatableWindow/FloatableWindowAutomationPeer.cs @ 62:810116cd6b8e

ErrorWindow working
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sun, 22 Apr 2012 09:01:20 +0100
parents
children a0bcd783e612
rev   line source
62
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
1 // (c) Copyright Microsoft Corporation.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
2 // This source is subject to the Microsoft Public License (Ms-PL).
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
3 // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
4 // All other rights reserved.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
5
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
6 using System.Windows.Automation.Provider;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
7 using System.Windows.Controls;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
8 using System.Windows.Media;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
9
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
10 namespace System.Windows.Automation.Peers
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
11 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
12 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
13 /// Exposes <see cref="T:System.Windows.Controls.FloatableWindow" /> types to UI
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
14 /// automation.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
15 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
16 /// <QualityBand>Preview</QualityBand>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
17 public class FloatableWindowAutomationPeer : FrameworkElementAutomationPeer, IWindowProvider, ITransformProvider
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
18 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
19 #region Data
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
20
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
21 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
22 /// Specifies whether the FloatableWindow is the top most element.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
23 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
24 private bool _isTopMost;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
25
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
26 #endregion Data
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
27
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
28 #region Properties
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
29
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
30 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
31 /// Gets or sets a value indicating whether the FloatableWindow is the top most element.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
32 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
33 private bool IsTopMostPrivate
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
34 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
35 get
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
36 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
37 return this._isTopMost;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
38 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
39 set
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
40 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
41 if (this._isTopMost != value)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
42 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
43 this._isTopMost = value;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
44 this.RaisePropertyChangedEvent(WindowPatternIdentifiers.IsTopmostProperty, !this._isTopMost, this._isTopMost);
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
45 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
46 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
47 }
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 /// Gets the owning FloatableWindow.
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 FloatableWindow OwningFloatableWindow
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
53 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
54 get
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
55 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
56 return (FloatableWindow)Owner;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
57 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
58 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
59
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
60 #endregion Properties
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
61
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
62 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
63 /// Initializes a new instance of the
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
64 /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" />
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
65 /// class.
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 /// <param name="owner">
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
68 /// The <see cref="T:System.Windows.Controls.FloatableWindow" /> to
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
69 /// associate with this
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
70 /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" />.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
71 /// </param>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
72 public FloatableWindowAutomationPeer(FloatableWindow owner)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
73 : base(owner)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
74 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
75 if (owner == null)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
76 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
77 throw new ArgumentNullException("owner");
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
78 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
79 this.RefreshIsTopMostProperty();
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
80 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
81
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
82 #region AutomationPeer overrides
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
83
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
84 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
85 /// Gets the control pattern for this
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
86 /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" />.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
87 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
88 /// <param name="patternInterface">
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
89 /// One of the enumeration values.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
90 /// </param>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
91 /// <returns>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
92 /// The object that implements the pattern interface, or null if the
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
93 /// specified pattern interface is not implemented by this peer.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
94 /// </returns>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
95 public override object GetPattern(PatternInterface patternInterface)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
96 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
97 if (patternInterface == PatternInterface.Transform || patternInterface == PatternInterface.Window)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
98 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
99 return this;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
100 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
101
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
102 return base.GetPattern(patternInterface);
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
103 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
104
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
105 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
106 /// Gets the
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
107 /// <see cref="T:System.Windows.Automation.Peers.AutomationControlType" />
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
108 /// for the element associated with this
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
109 /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" />.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
110 /// Called by
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
111 /// <see cref="M:System.Windows.Automation.Peers.AutomationPeer.GetAutomationControlType" />.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
112 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
113 /// <returns>A value of the enumeration.</returns>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
114 protected override AutomationControlType GetAutomationControlTypeCore()
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
115 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
116 return AutomationControlType.Window;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
117 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
118
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
119 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
120 /// Gets the name of the class for the object associated with this
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
121 /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" />.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
122 /// Called by
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
123 /// <see cref="M:System.Windows.Automation.Peers.AutomationPeer.GetClassName" />.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
124 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
125 /// <returns>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
126 /// A string value that represents the type of the child window.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
127 /// </returns>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
128 protected override string GetClassNameCore()
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
129 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
130 return this.Owner.GetType().Name;
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 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
134 /// Gets the text label of the
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
135 /// <see cref="T:System.Windows.Controls.FloatableWindow" /> that is
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
136 /// associated with this
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
137 /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" />.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
138 /// Called by
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
139 /// <see cref="M:System.Windows.Automation.Peers.AutomationPeer.GetName" />.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
140 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
141 /// <returns>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
142 /// The text label of the element that is associated with this
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
143 /// automation peer.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
144 /// </returns>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
145 protected override string GetNameCore()
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
146 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
147 string name = base.GetNameCore();
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
148 if (string.IsNullOrEmpty(name))
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
149 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
150 AutomationPeer labeledBy = GetLabeledByCore();
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
151 if (labeledBy != null)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
152 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
153 name = labeledBy.GetName();
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
154 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
155
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
156 if (string.IsNullOrEmpty(name) && this.OwningFloatableWindow.Title != null)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
157 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
158 name = this.OwningFloatableWindow.Title.ToString();
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
159 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
160 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
161 return name;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
162 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
163
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
164 #endregion AutomationPeer overrides
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
165
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
166 #region IWindowProvider
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
167
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
168 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
169 /// Gets the interaction state of the window.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
170 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
171 /// <value>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
172 /// The interaction state of the control, as a value of the enumeration.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
173 /// </value>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
174 WindowInteractionState IWindowProvider.InteractionState
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
175 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
176 get
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
177 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
178 return this.OwningFloatableWindow.InteractionState;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
179 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
180 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
181
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
182 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
183 /// Gets a value indicating whether the window is modal.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
184 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
185 /// <value>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
186 /// True in all cases.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
187 /// </value>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
188 bool IWindowProvider.IsModal
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
189 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
190 get { return true; }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
191 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
192
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 /// Gets a value indicating whether the window is the topmost
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
195 /// element in the z-order of layout.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
196 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
197 /// <value>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
198 /// True if the window is topmost; otherwise, false.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
199 /// </value>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
200 bool IWindowProvider.IsTopmost
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
201 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
202 get
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
203 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
204 return this.IsTopMostPrivate;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
205 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
206 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
207
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
208 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
209 /// Gets a value indicating whether the window can be maximized.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
210 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
211 /// <value>False in all cases.</value>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
212 bool IWindowProvider.Maximizable
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
213 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
214 get { return false; }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
215 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
216
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
217 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
218 /// Gets a value indicating whether the window can be minimized.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
219 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
220 /// <value>False in all cases.</value>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
221 bool IWindowProvider.Minimizable
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
222 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
223 get { return false; }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
224 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
225
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
226 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
227 /// Gets the visual state of the window.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
228 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
229 /// <value>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
230 /// <see cref="F:System.Windows.Automation.WindowVisualState.Normal" />
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
231 /// in all cases.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
232 /// </value>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
233 WindowVisualState IWindowProvider.VisualState
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
234 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
235 get
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
236 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
237 return WindowVisualState.Normal;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
238 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
239 }
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 /// Closes the window.
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 void IWindowProvider.Close()
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
245 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
246 this.OwningFloatableWindow.Close();
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
247 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
248
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
249 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
250 /// Changes the visual state of the window (such as minimizing or
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
251 /// maximizing it).
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
252 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
253 /// <param name="state">
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
254 /// The visual state of the window to change to, as a value of the
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
255 /// enumeration.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
256 /// </param>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
257 void IWindowProvider.SetVisualState(WindowVisualState state)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
258 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
259 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
260
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
261 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
262 /// Blocks the calling code for the specified time or until the
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
263 /// associated process enters an idle state, whichever completes first.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
264 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
265 /// <param name="milliseconds">
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
266 /// The amount of time, in milliseconds, to wait for the associated
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
267 /// process to become idle.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
268 /// </param>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
269 /// <returns>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
270 /// True if the window has entered the idle state; false if the timeout
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
271 /// occurred.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
272 /// </returns>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
273 bool IWindowProvider.WaitForInputIdle(int milliseconds)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
274 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
275 return false;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
276 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
277
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
278 #endregion IWindowProvider
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
279
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
280 #region ITransformProvider
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
281
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
282 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
283 /// Moves the control.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
284 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
285 /// <param name="x">
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
286 /// The absolute screen coordinates of the left side of the control.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
287 /// </param>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
288 /// <param name="y">
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
289 /// The absolute screen coordinates of the top of the control.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
290 /// </param>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
291 void ITransformProvider.Move(double x, double y)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
292 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
293 if (x < 0)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
294 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
295 x = 0;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
296 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
297
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
298 if (y < 0)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
299 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
300 y = 0;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
301 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
302
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
303 if (x > this.OwningFloatableWindow.Width)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
304 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
305 x = this.OwningFloatableWindow.Width;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
306 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
307
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
308 if (y > this.OwningFloatableWindow.Height)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
309 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
310 y = this.OwningFloatableWindow.Height;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
311 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
312
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
313 FrameworkElement contentRoot = this.OwningFloatableWindow.ContentRoot;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
314
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
315 if (contentRoot != null)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
316 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
317 GeneralTransform gt = contentRoot.TransformToVisual(null);
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
318
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
319 if (gt != null)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
320 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
321 Point p = gt.Transform(new Point(0, 0));
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
322
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
323 TransformGroup transformGroup = contentRoot.RenderTransform as TransformGroup;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
324
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
325 if (transformGroup == null)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
326 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
327 transformGroup = new TransformGroup();
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
328 transformGroup.Children.Add(contentRoot.RenderTransform);
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
329 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
330
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
331 TranslateTransform t = new TranslateTransform();
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
332 t.X = x - p.X;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
333 t.Y = y - p.Y;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
334
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
335 if (transformGroup != null)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
336 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
337 transformGroup.Children.Add(t);
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
338 contentRoot.RenderTransform = transformGroup;
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
339 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
340 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
341 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
342 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
343
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 /// Resizes the control.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
346 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
347 /// <param name="width">The new width of the window, in pixels.</param>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
348 /// <param name="height">
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
349 /// The new height of the window, in pixels.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
350 /// </param>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
351 void ITransformProvider.Resize(double width, double height)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
352 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
353 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
354
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
355 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
356 /// Rotates the control.
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 /// <param name="degrees">
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
359 /// The number of degrees to rotate the control. A positive number
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
360 /// rotates the control clockwise. A negative number rotates the
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
361 /// control counterclockwise.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
362 /// </param>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
363 void ITransformProvider.Rotate(double degrees)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
364 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
365 }
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 /// Gets a value indicating whether the element can be moved.
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 /// <value>True in all cases.</value>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
371 bool ITransformProvider.CanMove
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
372 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
373 get { return true; }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
374 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
375
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
376 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
377 /// Gets a value indicating whether the element can be resized.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
378 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
379 /// <value>False in all cases.</value>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
380 bool ITransformProvider.CanResize
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
381 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
382 get { return false; }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
383 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
384
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
385 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
386 /// Gets a value indicating whether the element can be rotated.
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 /// <value>False in all cases.</value>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
389 bool ITransformProvider.CanRotate
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
390 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
391 get { return false; }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
392 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
393
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
394 #endregion ITransformProvider
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
395
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
396 #region Methods
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
397
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
398 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
399 /// Returns if the FloatableWindow is the top most element.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
400 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
401 /// <returns>Bool value.</returns>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
402 private bool GetIsTopMostCore()
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
403 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
404 return !(this.OwningFloatableWindow.InteractionState == WindowInteractionState.BlockedByModalWindow);
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
405 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
406
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
407 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
408 /// Raises PropertyChangedEvent for WindowInteractionStateProperty.
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
409 /// </summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
410 /// <param name="oldValue">Old WindowInteractionStateProperty.</param>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
411 /// <param name="newValue">New WindowInteractionStateProperty.</param>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
412 internal void RaiseInteractionStatePropertyChangedEvent(WindowInteractionState oldValue, WindowInteractionState newValue)
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
413 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
414 this.RaisePropertyChangedEvent(WindowPatternIdentifiers.WindowInteractionStateProperty, oldValue, newValue);
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
415 this.RefreshIsTopMostProperty();
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
416 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
417
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
418 /// <summary>
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
419 /// Updates the IsTopMostPrivate property.
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 private void RefreshIsTopMostProperty()
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
422 {
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
423 this.IsTopMostPrivate = this.GetIsTopMostCore();
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
424 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
425
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
426 #endregion Methods
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
427 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
428 }
810116cd6b8e ErrorWindow working
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
429