Merge lp:~mandel/ubuntuone-windows-installer/improve_sso_ui into lp:ubuntuone-windows-installer/beta
- improve_sso_ui
- Merge into beta
Proposed by
Manuel de la Peña
Status: | Merged |
---|---|
Approved by: | Rick McBride |
Approved revision: | 90 |
Merged at revision: | 92 |
Proposed branch: | lp:~mandel/ubuntuone-windows-installer/improve_sso_ui |
Merge into: | lp:ubuntuone-windows-installer/beta |
Prerequisite: | lp:~mandel/ubuntuone-windows-installer/sso_di |
Diff against target: |
777 lines (+682/-17) 6 files modified
src/Canonical.Ubuntu.SSO.Views/Canonical.Ubuntu.SSO.Views.csproj (+12/-0) src/Canonical.Ubuntu.SSO.Views/LoginDialog.xaml (+32/-17) src/Canonical.Ubuntu.SSO.Views/Resources/Resources.Designer.cs (+108/-0) src/Canonical.Ubuntu.SSO.Views/Resources/Resources.resx (+135/-0) src/Canonical.Ubuntu.SSO.Views/WatermarkAdorner.cs (+141/-0) src/Canonical.Ubuntu.SSO.Views/WatermarkService.cs (+254/-0) |
To merge this branch: | bzr merge lp:~mandel/ubuntuone-windows-installer/improve_sso_ui |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Rick McBride (community) | Approve | ||
John Lenton (community) | Approve | ||
Review via email:
|
Commit message
Description of the change
Improves the login view used in the Ubuntu SSO to match better the one present in linux.
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
John Lenton (chipaca) : | # |
review:
Approve
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Rick McBride (rmcbride) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/Canonical.Ubuntu.SSO.Views/Canonical.Ubuntu.SSO.Views.csproj' | |||
2 | --- src/Canonical.Ubuntu.SSO.Views/Canonical.Ubuntu.SSO.Views.csproj 2010-10-05 11:24:46 +0000 | |||
3 | +++ src/Canonical.Ubuntu.SSO.Views/Canonical.Ubuntu.SSO.Views.csproj 2010-10-05 11:24:47 +0000 | |||
4 | @@ -72,11 +72,23 @@ | |||
5 | 72 | <DependentUpon>Settings.settings</DependentUpon> | 72 | <DependentUpon>Settings.settings</DependentUpon> |
6 | 73 | <DesignTimeSharedInput>True</DesignTimeSharedInput> | 73 | <DesignTimeSharedInput>True</DesignTimeSharedInput> |
7 | 74 | </Compile> | 74 | </Compile> |
8 | 75 | <Compile Include="Resources\Resources.Designer.cs"> | ||
9 | 76 | <AutoGen>True</AutoGen> | ||
10 | 77 | <DesignTime>True</DesignTime> | ||
11 | 78 | <DependentUpon>Resources.resx</DependentUpon> | ||
12 | 79 | </Compile> | ||
13 | 80 | <Compile Include="WatermarkAdorner.cs" /> | ||
14 | 81 | <Compile Include="WatermarkService.cs" /> | ||
15 | 75 | <EmbeddedResource Include="Properties\Resources.resx"> | 82 | <EmbeddedResource Include="Properties\Resources.resx"> |
16 | 76 | <Generator>ResXFileCodeGenerator</Generator> | 83 | <Generator>ResXFileCodeGenerator</Generator> |
17 | 77 | <LastGenOutput>Resources.Designer.cs</LastGenOutput> | 84 | <LastGenOutput>Resources.Designer.cs</LastGenOutput> |
18 | 78 | <SubType>Designer</SubType> | 85 | <SubType>Designer</SubType> |
19 | 79 | </EmbeddedResource> | 86 | </EmbeddedResource> |
20 | 87 | <EmbeddedResource Include="Resources\Resources.resx"> | ||
21 | 88 | <Generator>PublicResXFileCodeGenerator</Generator> | ||
22 | 89 | <LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
23 | 90 | <SubType>Designer</SubType> | ||
24 | 91 | </EmbeddedResource> | ||
25 | 80 | <None Include="Properties\Settings.settings"> | 92 | <None Include="Properties\Settings.settings"> |
26 | 81 | <Generator>SettingsSingleFileGenerator</Generator> | 93 | <Generator>SettingsSingleFileGenerator</Generator> |
27 | 82 | <LastGenOutput>Settings.Designer.cs</LastGenOutput> | 94 | <LastGenOutput>Settings.Designer.cs</LastGenOutput> |
28 | 83 | 95 | ||
29 | === modified file 'src/Canonical.Ubuntu.SSO.Views/LoginDialog.xaml' | |||
30 | --- src/Canonical.Ubuntu.SSO.Views/LoginDialog.xaml 2010-10-05 11:24:46 +0000 | |||
31 | +++ src/Canonical.Ubuntu.SSO.Views/LoginDialog.xaml 2010-10-05 11:24:47 +0000 | |||
32 | @@ -1,8 +1,10 @@ | |||
33 | 1 | <Window x:Class="Canonical.Ubuntu.SSO.Views.LoginDialog" | 1 | <Window x:Class="Canonical.Ubuntu.SSO.Views.LoginDialog" |
34 | 2 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | 2 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
38 | 3 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | 3 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
39 | 4 | Title="Login" Height="300" Width="300"> | 4 | xmlns:controls="clr-namespace:Canonical.Ubuntu.SSO.Views" |
40 | 5 | <Grid> | 5 | xmlns:resx="clr-namespace:Canonical.Ubuntu.SSO.Views.Resources" |
41 | 6 | Title="Login" Height="350" Width="550"> | ||
42 | 7 | <Grid Margin="10"> | ||
43 | 6 | <Grid.RowDefinitions> | 8 | <Grid.RowDefinitions> |
44 | 7 | <RowDefinition Height="*" /> | 9 | <RowDefinition Height="*" /> |
45 | 8 | <RowDefinition Height="28" /> | 10 | <RowDefinition Height="28" /> |
46 | @@ -12,35 +14,48 @@ | |||
47 | 12 | <RowDefinition Height="*" /> | 14 | <RowDefinition Height="*" /> |
48 | 13 | <RowDefinition Height="34" /> | 15 | <RowDefinition Height="34" /> |
49 | 14 | <RowDefinition Height="34" /> | 16 | <RowDefinition Height="34" /> |
50 | 17 | <RowDefinition Height="34" /> | ||
51 | 15 | <RowDefinition Height="*" /> | 18 | <RowDefinition Height="*" /> |
52 | 16 | </Grid.RowDefinitions> | 19 | </Grid.RowDefinitions> |
53 | 17 | <Grid Grid.Row="0"> | 20 | <Grid Grid.Row="0"> |
54 | 18 | <Grid.RowDefinitions> | 21 | <Grid.RowDefinitions> |
56 | 19 | <RowDefinition Height="32" /> | 22 | <RowDefinition Height="*" /> |
57 | 20 | <RowDefinition Height="*" /> | 23 | <RowDefinition Height="*" /> |
58 | 21 | </Grid.RowDefinitions> | 24 | </Grid.RowDefinitions> |
61 | 22 | <Label Name="InfoLabel" Grid.Row="0" Margin="3" >Please provide the email you used register in</Label> | 25 | <TextBlock Name="TitleLabel" Grid.Row="0" Margin="3" FontSize="20" FontFamily="Calibry" Text="{x:Static resx:Resources.LoginViewTitle}"></TextBlock> |
62 | 23 | <Label Grid.Row="1">Ubuntu One and you password.</Label> | 26 | <TextBlock Name="InfoText" Grid.Row="1" Margin="3" FontFamily="Calibry" Text="{x:Static resx:Resources.LoginViewInfo}"></TextBlock> |
63 | 24 | </Grid> | 27 | </Grid> |
64 | 25 | <Grid Grid.Row="1"> | 28 | <Grid Grid.Row="1"> |
65 | 26 | <Grid.ColumnDefinitions> | 29 | <Grid.ColumnDefinitions> |
66 | 27 | <ColumnDefinition Width="*"/> | 30 | <ColumnDefinition Width="*"/> |
69 | 28 | <ColumnDefinition Width="120"/> | 31 | <ColumnDefinition Width="240"/> |
68 | 29 | <ColumnDefinition Width="120"/> | ||
70 | 30 | <ColumnDefinition Width="*"/> | 32 | <ColumnDefinition Width="*"/> |
71 | 31 | </Grid.ColumnDefinitions> | 33 | </Grid.ColumnDefinitions> |
74 | 32 | <Label Name="MessageLabel" Grid.Column="1" Margin="3">Email</Label> | 34 | <TextBox Name="EmailTextBox" Grid.Column="1" Margin="3"> |
75 | 33 | <TextBox Name="EmailTextBox" Grid.Column="2" Margin="3"></TextBox> | 35 | <controls:WatermarkService.Watermark> |
76 | 36 | <TextBlock Text="{x:Static resx:Resources.LoginEmailAddressWatermark}"></TextBlock> | ||
77 | 37 | </controls:WatermarkService.Watermark> | ||
78 | 38 | </TextBox> | ||
79 | 34 | </Grid> | 39 | </Grid> |
80 | 35 | <Grid Grid.Row="2"> | 40 | <Grid Grid.Row="2"> |
81 | 36 | <Grid.ColumnDefinitions> | 41 | <Grid.ColumnDefinitions> |
82 | 37 | <ColumnDefinition Width="*"/> | 42 | <ColumnDefinition Width="*"/> |
89 | 38 | <ColumnDefinition Width="120"/> | 43 | <ColumnDefinition Width="240"/> |
90 | 39 | <ColumnDefinition Width="120"/> | 44 | <ColumnDefinition Width="*"/> |
91 | 40 | <ColumnDefinition Width="*"/> | 45 | </Grid.ColumnDefinitions> |
92 | 41 | </Grid.ColumnDefinitions> | 46 | <PasswordBox Name="PasswordTextBox" Grid.Column="1" Margin="3" PasswordChar="*"> |
93 | 42 | <Label Name="PasswordLabel" Grid.Column="1" Margin="3">Password</Label> | 47 | <controls:WatermarkService.Watermark> |
94 | 43 | <PasswordBox Name="PasswordTextBox" Grid.Column="2" Margin="3" PasswordChar="*"></PasswordBox > | 48 | <TextBlock Text="{x:Static resx:Resources.LoginPasswordWatermark}"></TextBlock> |
95 | 49 | </controls:WatermarkService.Watermark> | ||
96 | 50 | </PasswordBox > | ||
97 | 51 | </Grid> | ||
98 | 52 | <Grid Grid.Row="3"> | ||
99 | 53 | <Grid.ColumnDefinitions> | ||
100 | 54 | <ColumnDefinition Width="*"/> | ||
101 | 55 | <ColumnDefinition Width="240"/> | ||
102 | 56 | <ColumnDefinition Width="*"/> | ||
103 | 57 | </Grid.ColumnDefinitions> | ||
104 | 58 | <TextBlock Name="ForgottenLink" Grid.Column="1" Margin="3" TextAlignment="Center"><Hyperlink >I've forgotten my password.</Hyperlink></TextBlock> | ||
105 | 44 | </Grid> | 59 | </Grid> |
106 | 45 | </Grid> | 60 | </Grid> |
107 | 46 | <Grid Grid.Row="1"> | 61 | <Grid Grid.Row="1"> |
108 | @@ -49,7 +64,7 @@ | |||
109 | 49 | <ColumnDefinition Width="85"/> | 64 | <ColumnDefinition Width="85"/> |
110 | 50 | <ColumnDefinition Width="85"/> | 65 | <ColumnDefinition Width="85"/> |
111 | 51 | </Grid.ColumnDefinitions> | 66 | </Grid.ColumnDefinitions> |
113 | 52 | <Button Name="LoginButton" Grid.Column="1" Margin="3" Click="LoginButton_Click">Login</Button> | 67 | <Button Name="LoginButton" Grid.Column="1" Margin="3" Click="LoginButton_Click">Connect</Button> |
114 | 53 | <Button Name="CancelButton" Grid.Column="2" Margin="3" Click="CancelButton_Click">Cancel</Button> | 68 | <Button Name="CancelButton" Grid.Column="2" Margin="3" Click="CancelButton_Click">Cancel</Button> |
115 | 54 | </Grid> | 69 | </Grid> |
116 | 55 | </Grid> | 70 | </Grid> |
117 | 56 | 71 | ||
118 | === added directory 'src/Canonical.Ubuntu.SSO.Views/Resources' | |||
119 | === added file 'src/Canonical.Ubuntu.SSO.Views/Resources/Resources.Designer.cs' | |||
120 | --- src/Canonical.Ubuntu.SSO.Views/Resources/Resources.Designer.cs 1970-01-01 00:00:00 +0000 | |||
121 | +++ src/Canonical.Ubuntu.SSO.Views/Resources/Resources.Designer.cs 2010-10-05 11:24:47 +0000 | |||
122 | @@ -0,0 +1,108 @@ | |||
123 | 1 | //------------------------------------------------------------------------------ | ||
124 | 2 | // <auto-generated> | ||
125 | 3 | // This code was generated by a tool. | ||
126 | 4 | // Runtime Version:2.0.50727.4952 | ||
127 | 5 | // | ||
128 | 6 | // Changes to this file may cause incorrect behavior and will be lost if | ||
129 | 7 | // the code is regenerated. | ||
130 | 8 | // </auto-generated> | ||
131 | 9 | //------------------------------------------------------------------------------ | ||
132 | 10 | |||
133 | 11 | namespace Canonical.Ubuntu.SSO.Views.Resources { | ||
134 | 12 | using System; | ||
135 | 13 | |||
136 | 14 | |||
137 | 15 | /// <summary> | ||
138 | 16 | /// A strongly-typed resource class, for looking up localized strings, etc. | ||
139 | 17 | /// </summary> | ||
140 | 18 | // This class was auto-generated by the StronglyTypedResourceBuilder | ||
141 | 19 | // class via a tool like ResGen or Visual Studio. | ||
142 | 20 | // To add or remove a member, edit your .ResX file then rerun ResGen | ||
143 | 21 | // with the /str option, or rebuild your VS project. | ||
144 | 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] | ||
145 | 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | ||
146 | 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | ||
147 | 25 | public class Resources { | ||
148 | 26 | |||
149 | 27 | private static global::System.Resources.ResourceManager resourceMan; | ||
150 | 28 | |||
151 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; | ||
152 | 30 | |||
153 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] | ||
154 | 32 | internal Resources() { | ||
155 | 33 | } | ||
156 | 34 | |||
157 | 35 | /// <summary> | ||
158 | 36 | /// Returns the cached ResourceManager instance used by this class. | ||
159 | 37 | /// </summary> | ||
160 | 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | ||
161 | 39 | public static global::System.Resources.ResourceManager ResourceManager { | ||
162 | 40 | get { | ||
163 | 41 | if (object.ReferenceEquals(resourceMan, null)) { | ||
164 | 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Canonical.Ubuntu.SSO.Views.Resources.Resources", typeof(Resources).Assembly); | ||
165 | 43 | resourceMan = temp; | ||
166 | 44 | } | ||
167 | 45 | return resourceMan; | ||
168 | 46 | } | ||
169 | 47 | } | ||
170 | 48 | |||
171 | 49 | /// <summary> | ||
172 | 50 | /// Overrides the current thread's CurrentUICulture property for all | ||
173 | 51 | /// resource lookups using this strongly typed resource class. | ||
174 | 52 | /// </summary> | ||
175 | 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | ||
176 | 54 | public static global::System.Globalization.CultureInfo Culture { | ||
177 | 55 | get { | ||
178 | 56 | return resourceCulture; | ||
179 | 57 | } | ||
180 | 58 | set { | ||
181 | 59 | resourceCulture = value; | ||
182 | 60 | } | ||
183 | 61 | } | ||
184 | 62 | |||
185 | 63 | /// <summary> | ||
186 | 64 | /// Looks up a localized string similar to Email address. | ||
187 | 65 | /// </summary> | ||
188 | 66 | public static string LoginEmailAddressWatermark { | ||
189 | 67 | get { | ||
190 | 68 | return ResourceManager.GetString("LoginEmailAddressWatermark", resourceCulture); | ||
191 | 69 | } | ||
192 | 70 | } | ||
193 | 71 | |||
194 | 72 | /// <summary> | ||
195 | 73 | /// Looks up a localized string similar to I've forgotten my password.. | ||
196 | 74 | /// </summary> | ||
197 | 75 | public static string LoginForgottenLink { | ||
198 | 76 | get { | ||
199 | 77 | return ResourceManager.GetString("LoginForgottenLink", resourceCulture); | ||
200 | 78 | } | ||
201 | 79 | } | ||
202 | 80 | |||
203 | 81 | /// <summary> | ||
204 | 82 | /// Looks up a localized string similar to Password. | ||
205 | 83 | /// </summary> | ||
206 | 84 | public static string LoginPasswordWatermark { | ||
207 | 85 | get { | ||
208 | 86 | return ResourceManager.GetString("LoginPasswordWatermark", resourceCulture); | ||
209 | 87 | } | ||
210 | 88 | } | ||
211 | 89 | |||
212 | 90 | /// <summary> | ||
213 | 91 | /// Looks up a localized string similar to To connect this computer to Ubuntu One enter your details below.. | ||
214 | 92 | /// </summary> | ||
215 | 93 | public static string LoginViewInfo { | ||
216 | 94 | get { | ||
217 | 95 | return ResourceManager.GetString("LoginViewInfo", resourceCulture); | ||
218 | 96 | } | ||
219 | 97 | } | ||
220 | 98 | |||
221 | 99 | /// <summary> | ||
222 | 100 | /// Looks up a localized string similar to Connect to Ubuntu One. | ||
223 | 101 | /// </summary> | ||
224 | 102 | public static string LoginViewTitle { | ||
225 | 103 | get { | ||
226 | 104 | return ResourceManager.GetString("LoginViewTitle", resourceCulture); | ||
227 | 105 | } | ||
228 | 106 | } | ||
229 | 107 | } | ||
230 | 108 | } | ||
231 | 0 | 109 | ||
232 | === added file 'src/Canonical.Ubuntu.SSO.Views/Resources/Resources.resx' | |||
233 | --- src/Canonical.Ubuntu.SSO.Views/Resources/Resources.resx 1970-01-01 00:00:00 +0000 | |||
234 | +++ src/Canonical.Ubuntu.SSO.Views/Resources/Resources.resx 2010-10-05 11:24:47 +0000 | |||
235 | @@ -0,0 +1,135 @@ | |||
236 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
237 | 2 | <root> | ||
238 | 3 | <!-- | ||
239 | 4 | Microsoft ResX Schema | ||
240 | 5 | |||
241 | 6 | Version 2.0 | ||
242 | 7 | |||
243 | 8 | The primary goals of this format is to allow a simple XML format | ||
244 | 9 | that is mostly human readable. The generation and parsing of the | ||
245 | 10 | various data types are done through the TypeConverter classes | ||
246 | 11 | associated with the data types. | ||
247 | 12 | |||
248 | 13 | Example: | ||
249 | 14 | |||
250 | 15 | ... ado.net/XML headers & schema ... | ||
251 | 16 | <resheader name="resmimetype">text/microsoft-resx</resheader> | ||
252 | 17 | <resheader name="version">2.0</resheader> | ||
253 | 18 | <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||
254 | 19 | <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||
255 | 20 | <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||
256 | 21 | <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||
257 | 22 | <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||
258 | 23 | <value>[base64 mime encoded serialized .NET Framework object]</value> | ||
259 | 24 | </data> | ||
260 | 25 | <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||
261 | 26 | <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||
262 | 27 | <comment>This is a comment</comment> | ||
263 | 28 | </data> | ||
264 | 29 | |||
265 | 30 | There are any number of "resheader" rows that contain simple | ||
266 | 31 | name/value pairs. | ||
267 | 32 | |||
268 | 33 | Each data row contains a name, and value. The row also contains a | ||
269 | 34 | type or mimetype. Type corresponds to a .NET class that support | ||
270 | 35 | text/value conversion through the TypeConverter architecture. | ||
271 | 36 | Classes that don't support this are serialized and stored with the | ||
272 | 37 | mimetype set. | ||
273 | 38 | |||
274 | 39 | The mimetype is used for serialized objects, and tells the | ||
275 | 40 | ResXResourceReader how to depersist the object. This is currently not | ||
276 | 41 | extensible. For a given mimetype the value must be set accordingly: | ||
277 | 42 | |||
278 | 43 | Note - application/x-microsoft.net.object.binary.base64 is the format | ||
279 | 44 | that the ResXResourceWriter will generate, however the reader can | ||
280 | 45 | read any of the formats listed below. | ||
281 | 46 | |||
282 | 47 | mimetype: application/x-microsoft.net.object.binary.base64 | ||
283 | 48 | value : The object must be serialized with | ||
284 | 49 | : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||
285 | 50 | : and then encoded with base64 encoding. | ||
286 | 51 | |||
287 | 52 | mimetype: application/x-microsoft.net.object.soap.base64 | ||
288 | 53 | value : The object must be serialized with | ||
289 | 54 | : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||
290 | 55 | : and then encoded with base64 encoding. | ||
291 | 56 | |||
292 | 57 | mimetype: application/x-microsoft.net.object.bytearray.base64 | ||
293 | 58 | value : The object must be serialized into a byte array | ||
294 | 59 | : using a System.ComponentModel.TypeConverter | ||
295 | 60 | : and then encoded with base64 encoding. | ||
296 | 61 | --> | ||
297 | 62 | <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
298 | 63 | <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||
299 | 64 | <xsd:element name="root" msdata:IsDataSet="true"> | ||
300 | 65 | <xsd:complexType> | ||
301 | 66 | <xsd:choice maxOccurs="unbounded"> | ||
302 | 67 | <xsd:element name="metadata"> | ||
303 | 68 | <xsd:complexType> | ||
304 | 69 | <xsd:sequence> | ||
305 | 70 | <xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||
306 | 71 | </xsd:sequence> | ||
307 | 72 | <xsd:attribute name="name" use="required" type="xsd:string" /> | ||
308 | 73 | <xsd:attribute name="type" type="xsd:string" /> | ||
309 | 74 | <xsd:attribute name="mimetype" type="xsd:string" /> | ||
310 | 75 | <xsd:attribute ref="xml:space" /> | ||
311 | 76 | </xsd:complexType> | ||
312 | 77 | </xsd:element> | ||
313 | 78 | <xsd:element name="assembly"> | ||
314 | 79 | <xsd:complexType> | ||
315 | 80 | <xsd:attribute name="alias" type="xsd:string" /> | ||
316 | 81 | <xsd:attribute name="name" type="xsd:string" /> | ||
317 | 82 | </xsd:complexType> | ||
318 | 83 | </xsd:element> | ||
319 | 84 | <xsd:element name="data"> | ||
320 | 85 | <xsd:complexType> | ||
321 | 86 | <xsd:sequence> | ||
322 | 87 | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
323 | 88 | <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||
324 | 89 | </xsd:sequence> | ||
325 | 90 | <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||
326 | 91 | <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||
327 | 92 | <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||
328 | 93 | <xsd:attribute ref="xml:space" /> | ||
329 | 94 | </xsd:complexType> | ||
330 | 95 | </xsd:element> | ||
331 | 96 | <xsd:element name="resheader"> | ||
332 | 97 | <xsd:complexType> | ||
333 | 98 | <xsd:sequence> | ||
334 | 99 | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
335 | 100 | </xsd:sequence> | ||
336 | 101 | <xsd:attribute name="name" type="xsd:string" use="required" /> | ||
337 | 102 | </xsd:complexType> | ||
338 | 103 | </xsd:element> | ||
339 | 104 | </xsd:choice> | ||
340 | 105 | </xsd:complexType> | ||
341 | 106 | </xsd:element> | ||
342 | 107 | </xsd:schema> | ||
343 | 108 | <resheader name="resmimetype"> | ||
344 | 109 | <value>text/microsoft-resx</value> | ||
345 | 110 | </resheader> | ||
346 | 111 | <resheader name="version"> | ||
347 | 112 | <value>2.0</value> | ||
348 | 113 | </resheader> | ||
349 | 114 | <resheader name="reader"> | ||
350 | 115 | <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
351 | 116 | </resheader> | ||
352 | 117 | <resheader name="writer"> | ||
353 | 118 | <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
354 | 119 | </resheader> | ||
355 | 120 | <data name="LoginEmailAddressWatermark" xml:space="preserve"> | ||
356 | 121 | <value>Email address</value> | ||
357 | 122 | </data> | ||
358 | 123 | <data name="LoginForgottenLink" xml:space="preserve"> | ||
359 | 124 | <value>I've forgotten my password.</value> | ||
360 | 125 | </data> | ||
361 | 126 | <data name="LoginPasswordWatermark" xml:space="preserve"> | ||
362 | 127 | <value>Password</value> | ||
363 | 128 | </data> | ||
364 | 129 | <data name="LoginViewInfo" xml:space="preserve"> | ||
365 | 130 | <value>To connect this computer to Ubuntu One enter your details below.</value> | ||
366 | 131 | </data> | ||
367 | 132 | <data name="LoginViewTitle" xml:space="preserve"> | ||
368 | 133 | <value>Connect to Ubuntu One</value> | ||
369 | 134 | </data> | ||
370 | 135 | </root> | ||
371 | 0 | \ No newline at end of file | 136 | \ No newline at end of file |
372 | 1 | 137 | ||
373 | === added file 'src/Canonical.Ubuntu.SSO.Views/WatermarkAdorner.cs' | |||
374 | --- src/Canonical.Ubuntu.SSO.Views/WatermarkAdorner.cs 1970-01-01 00:00:00 +0000 | |||
375 | +++ src/Canonical.Ubuntu.SSO.Views/WatermarkAdorner.cs 2010-10-05 11:24:47 +0000 | |||
376 | @@ -0,0 +1,141 @@ | |||
377 | 1 | /* | ||
378 | 2 | * Copyright 2010 Canonical Ltd. | ||
379 | 3 | * | ||
380 | 4 | * This file is part of UbuntuOne on Windows. | ||
381 | 5 | * | ||
382 | 6 | * UbuntuOne on Windows is free software: you can redistribute it and/or modify | ||
383 | 7 | * it under the terms of the GNU Lesser General Public License version | ||
384 | 8 | * as published by the Free Software Foundation. | ||
385 | 9 | * | ||
386 | 10 | * Ubuntu One on Windows is distributed in the hope that it will be useful, | ||
387 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
388 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
389 | 13 | * GNU Lesser General Public License for more details. | ||
390 | 14 | * | ||
391 | 15 | * You should have received a copy of the GNU Lesser General Public License | ||
392 | 16 | * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. | ||
393 | 17 | * | ||
394 | 18 | * Authors: Manuel de la Peña <manuel.delapena@canonical.com> | ||
395 | 19 | */ | ||
396 | 20 | using System.Windows; | ||
397 | 21 | using System.Windows.Controls; | ||
398 | 22 | using System.Windows.Data; | ||
399 | 23 | using System.Windows.Documents; | ||
400 | 24 | using System.Windows.Media; | ||
401 | 25 | |||
402 | 26 | namespace Canonical.Ubuntu.SSO.Views | ||
403 | 27 | { | ||
404 | 28 | /// <summary> | ||
405 | 29 | /// Adorner for the watermark | ||
406 | 30 | /// </summary> | ||
407 | 31 | internal class WatermarkAdorner : Adorner | ||
408 | 32 | { | ||
409 | 33 | #region Private Fields | ||
410 | 34 | |||
411 | 35 | /// <summary> | ||
412 | 36 | /// <see cref="ContentPresenter"/> that holds the watermark | ||
413 | 37 | /// </summary> | ||
414 | 38 | private readonly ContentPresenter _contentPresenter; | ||
415 | 39 | |||
416 | 40 | #endregion | ||
417 | 41 | |||
418 | 42 | #region Constructor | ||
419 | 43 | |||
420 | 44 | /// <summary> | ||
421 | 45 | /// Initializes a new instance of the <see cref="WatermarkAdorner"/> class | ||
422 | 46 | /// </summary> | ||
423 | 47 | /// <param name="adornedElement"><see cref="UIElement"/> to be adorned</param> | ||
424 | 48 | /// <param name="watermark">The watermark</param> | ||
425 | 49 | public WatermarkAdorner(UIElement adornedElement, object watermark) : | ||
426 | 50 | base(adornedElement) | ||
427 | 51 | { | ||
428 | 52 | IsHitTestVisible = false; | ||
429 | 53 | |||
430 | 54 | _contentPresenter = new ContentPresenter | ||
431 | 55 | { | ||
432 | 56 | Content = watermark, | ||
433 | 57 | Opacity = 0.5, | ||
434 | 58 | Margin = | ||
435 | 59 | new Thickness(Control.Margin.Left + Control.Padding.Left, | ||
436 | 60 | Control.Margin.Top + Control.Padding.Top, 0, 0) | ||
437 | 61 | }; | ||
438 | 62 | |||
439 | 63 | if (Control is ItemsControl && !(Control is ComboBox)) | ||
440 | 64 | { | ||
441 | 65 | _contentPresenter.VerticalAlignment = VerticalAlignment.Center; | ||
442 | 66 | _contentPresenter.HorizontalAlignment = HorizontalAlignment.Center; | ||
443 | 67 | } | ||
444 | 68 | |||
445 | 69 | // Hide the control adorner when the adorned element is hidden | ||
446 | 70 | var binding = new Binding("IsVisible") | ||
447 | 71 | { | ||
448 | 72 | Source = adornedElement, | ||
449 | 73 | Converter = new BooleanToVisibilityConverter() | ||
450 | 74 | }; | ||
451 | 75 | SetBinding(VisibilityProperty, binding); | ||
452 | 76 | } | ||
453 | 77 | |||
454 | 78 | #endregion | ||
455 | 79 | |||
456 | 80 | #region Protected Properties | ||
457 | 81 | |||
458 | 82 | /// <summary> | ||
459 | 83 | /// Gets the number of children for the <see cref="ContainerVisual"/>. | ||
460 | 84 | /// </summary> | ||
461 | 85 | protected override int VisualChildrenCount | ||
462 | 86 | { | ||
463 | 87 | get { return 1; } | ||
464 | 88 | } | ||
465 | 89 | |||
466 | 90 | #endregion | ||
467 | 91 | |||
468 | 92 | #region Private Properties | ||
469 | 93 | |||
470 | 94 | /// <summary> | ||
471 | 95 | /// Gets the control that is being adorned | ||
472 | 96 | /// </summary> | ||
473 | 97 | private Control Control | ||
474 | 98 | { | ||
475 | 99 | get { return (Control)AdornedElement; } | ||
476 | 100 | } | ||
477 | 101 | |||
478 | 102 | #endregion | ||
479 | 103 | |||
480 | 104 | #region Protected Overrides | ||
481 | 105 | |||
482 | 106 | /// <summary> | ||
483 | 107 | /// Returns a specified child <see cref="Visual"/> for the parent <see cref="ContainerVisual"/>. | ||
484 | 108 | /// </summary> | ||
485 | 109 | /// <param name="index">A 32-bit signed integer that represents the index value of the child <see cref="Visual"/>. The value of index must be between 0 and <see cref="VisualChildrenCount"/> - 1.</param> | ||
486 | 110 | /// <returns>The child <see cref="Visual"/>.</returns> | ||
487 | 111 | protected override Visual GetVisualChild(int index) | ||
488 | 112 | { | ||
489 | 113 | return _contentPresenter; | ||
490 | 114 | } | ||
491 | 115 | |||
492 | 116 | /// <summary> | ||
493 | 117 | /// Implements any custom measuring behavior for the adorner. | ||
494 | 118 | /// </summary> | ||
495 | 119 | /// <param name="constraint">A size to constrain the adorner to.</param> | ||
496 | 120 | /// <returns>A <see cref="Size"/> object representing the amount of layout space needed by the adorner.</returns> | ||
497 | 121 | protected override Size MeasureOverride(Size constraint) | ||
498 | 122 | { | ||
499 | 123 | // Here's the secret to getting the adorner to cover the whole control | ||
500 | 124 | _contentPresenter.Measure(Control.RenderSize); | ||
501 | 125 | return Control.RenderSize; | ||
502 | 126 | } | ||
503 | 127 | |||
504 | 128 | /// <summary> | ||
505 | 129 | /// When overridden in a derived class, positions child elements and determines a size for a <see cref="FrameworkElement"/> derived class. | ||
506 | 130 | /// </summary> | ||
507 | 131 | /// <param name="finalSize">The final area within the parent that this element should use to arrange itself and its children.</param> | ||
508 | 132 | /// <returns>The actual size used.</returns> | ||
509 | 133 | protected override Size ArrangeOverride(Size finalSize) | ||
510 | 134 | { | ||
511 | 135 | _contentPresenter.Arrange(new Rect(finalSize)); | ||
512 | 136 | return finalSize; | ||
513 | 137 | } | ||
514 | 138 | |||
515 | 139 | #endregion | ||
516 | 140 | } | ||
517 | 141 | } | ||
518 | 0 | \ No newline at end of file | 142 | \ No newline at end of file |
519 | 1 | 143 | ||
520 | === added file 'src/Canonical.Ubuntu.SSO.Views/WatermarkService.cs' | |||
521 | --- src/Canonical.Ubuntu.SSO.Views/WatermarkService.cs 1970-01-01 00:00:00 +0000 | |||
522 | +++ src/Canonical.Ubuntu.SSO.Views/WatermarkService.cs 2010-10-05 11:24:47 +0000 | |||
523 | @@ -0,0 +1,254 @@ | |||
524 | 1 | /* | ||
525 | 2 | * Copyright 2010 Canonical Ltd. | ||
526 | 3 | * | ||
527 | 4 | * This file is part of UbuntuOne on Windows. | ||
528 | 5 | * | ||
529 | 6 | * UbuntuOne on Windows is free software: you can redistribute it and/or modify | ||
530 | 7 | * it under the terms of the GNU Lesser General Public License version | ||
531 | 8 | * as published by the Free Software Foundation. | ||
532 | 9 | * | ||
533 | 10 | * Ubuntu One on Windows is distributed in the hope that it will be useful, | ||
534 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
535 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
536 | 13 | * GNU Lesser General Public License for more details. | ||
537 | 14 | * | ||
538 | 15 | * You should have received a copy of the GNU Lesser General Public License | ||
539 | 16 | * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>. | ||
540 | 17 | * | ||
541 | 18 | * Authors: Manuel de la Peña <manuel.delapena@canonical.com> | ||
542 | 19 | */ | ||
543 | 20 | using System; | ||
544 | 21 | using System.Collections.Generic; | ||
545 | 22 | using System.ComponentModel; | ||
546 | 23 | using System.Windows; | ||
547 | 24 | using System.Windows.Controls; | ||
548 | 25 | using System.Windows.Controls.Primitives; | ||
549 | 26 | using System.Windows.Documents; | ||
550 | 27 | |||
551 | 28 | namespace Canonical.Ubuntu.SSO.Views | ||
552 | 29 | { | ||
553 | 30 | /// <summary> | ||
554 | 31 | /// Class that provides the Watermark attached property | ||
555 | 32 | /// </summary> | ||
556 | 33 | public static class WatermarkService | ||
557 | 34 | { | ||
558 | 35 | /// <summary> | ||
559 | 36 | /// Watermark Attached Dependency Property | ||
560 | 37 | /// </summary> | ||
561 | 38 | public static readonly DependencyProperty WatermarkProperty = DependencyProperty.RegisterAttached( | ||
562 | 39 | "Watermark", | ||
563 | 40 | typeof(object), | ||
564 | 41 | typeof(WatermarkService), | ||
565 | 42 | new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnWatermarkChanged))); | ||
566 | 43 | |||
567 | 44 | #region Private Fields | ||
568 | 45 | |||
569 | 46 | /// <summary> | ||
570 | 47 | /// Dictionary of ItemsControls | ||
571 | 48 | /// </summary> | ||
572 | 49 | private static readonly Dictionary<object, ItemsControl> _itemsControls = new Dictionary<object, ItemsControl>(); | ||
573 | 50 | |||
574 | 51 | #endregion | ||
575 | 52 | |||
576 | 53 | /// <summary> | ||
577 | 54 | /// Gets the Watermark property. This dependency property indicates the watermark for the control. | ||
578 | 55 | /// </summary> | ||
579 | 56 | /// <param name="d"><see cref="DependencyObject"/> to get the property from</param> | ||
580 | 57 | /// <returns>The value of the Watermark property</returns> | ||
581 | 58 | public static object GetWatermark(DependencyObject d) | ||
582 | 59 | { | ||
583 | 60 | return d.GetValue(WatermarkProperty); | ||
584 | 61 | } | ||
585 | 62 | |||
586 | 63 | /// <summary> | ||
587 | 64 | /// Sets the Watermark property. This dependency property indicates the watermark for the control. | ||
588 | 65 | /// </summary> | ||
589 | 66 | /// <param name="d"><see cref="DependencyObject"/> to set the property on</param> | ||
590 | 67 | /// <param name="value">value of the property</param> | ||
591 | 68 | public static void SetWatermark(DependencyObject d, object value) | ||
592 | 69 | { | ||
593 | 70 | d.SetValue(WatermarkProperty, value); | ||
594 | 71 | } | ||
595 | 72 | |||
596 | 73 | /// <summary> | ||
597 | 74 | /// Handles changes to the Watermark property. | ||
598 | 75 | /// </summary> | ||
599 | 76 | /// <param name="d"><see cref="DependencyObject"/> that fired the event</param> | ||
600 | 77 | /// <param name="e">A <see cref="DependencyPropertyChangedEventArgs"/> that contains the event data.</param> | ||
601 | 78 | private static void OnWatermarkChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | ||
602 | 79 | { | ||
603 | 80 | var control = (Control)d; | ||
604 | 81 | control.Loaded += ControlLoaded; | ||
605 | 82 | |||
606 | 83 | if (d is ComboBox || d is TextBox || d is PasswordBox) | ||
607 | 84 | { | ||
608 | 85 | control.GotKeyboardFocus += ControlGotKeyboardFocus; | ||
609 | 86 | control.LostKeyboardFocus += ControlLoaded; | ||
610 | 87 | } | ||
611 | 88 | |||
612 | 89 | if (d is ItemsControl && !(d is ComboBox)) | ||
613 | 90 | { | ||
614 | 91 | var i = (ItemsControl)d; | ||
615 | 92 | |||
616 | 93 | // for Items property | ||
617 | 94 | i.ItemContainerGenerator.ItemsChanged += ItemsChanged; | ||
618 | 95 | _itemsControls.Add(i.ItemContainerGenerator, i); | ||
619 | 96 | |||
620 | 97 | // for ItemsSource property | ||
621 | 98 | DependencyPropertyDescriptor prop = DependencyPropertyDescriptor.FromProperty(ItemsControl.ItemsSourceProperty, i.GetType()); | ||
622 | 99 | prop.AddValueChanged(i, ItemsSourceChanged); | ||
623 | 100 | } | ||
624 | 101 | } | ||
625 | 102 | |||
626 | 103 | #region Event Handlers | ||
627 | 104 | |||
628 | 105 | /// <summary> | ||
629 | 106 | /// Handle the GotFocus event on the control | ||
630 | 107 | /// </summary> | ||
631 | 108 | /// <param name="sender">The source of the event.</param> | ||
632 | 109 | /// <param name="e">A <see cref="RoutedEventArgs"/> that contains the event data.</param> | ||
633 | 110 | private static void ControlGotKeyboardFocus(object sender, RoutedEventArgs e) | ||
634 | 111 | { | ||
635 | 112 | var c = (Control)sender; | ||
636 | 113 | if (ShouldShowWatermark(c)) | ||
637 | 114 | { | ||
638 | 115 | RemoveWatermark(c); | ||
639 | 116 | } | ||
640 | 117 | } | ||
641 | 118 | |||
642 | 119 | /// <summary> | ||
643 | 120 | /// Handle the Loaded and LostFocus event on the control | ||
644 | 121 | /// </summary> | ||
645 | 122 | /// <param name="sender">The source of the event.</param> | ||
646 | 123 | /// <param name="e">A <see cref="RoutedEventArgs"/> that contains the event data.</param> | ||
647 | 124 | private static void ControlLoaded(object sender, RoutedEventArgs e) | ||
648 | 125 | { | ||
649 | 126 | var control = (Control)sender; | ||
650 | 127 | if (ShouldShowWatermark(control)) | ||
651 | 128 | { | ||
652 | 129 | ShowWatermark(control); | ||
653 | 130 | } | ||
654 | 131 | } | ||
655 | 132 | |||
656 | 133 | /// <summary> | ||
657 | 134 | /// Event handler for the items source changed event | ||
658 | 135 | /// </summary> | ||
659 | 136 | /// <param name="sender">The source of the event.</param> | ||
660 | 137 | /// <param name="e">A <see cref="EventArgs"/> that contains the event data.</param> | ||
661 | 138 | private static void ItemsSourceChanged(object sender, EventArgs e) | ||
662 | 139 | { | ||
663 | 140 | var c = (ItemsControl)sender; | ||
664 | 141 | if (c.ItemsSource != null) | ||
665 | 142 | { | ||
666 | 143 | if (ShouldShowWatermark(c)) | ||
667 | 144 | { | ||
668 | 145 | ShowWatermark(c); | ||
669 | 146 | } | ||
670 | 147 | else | ||
671 | 148 | { | ||
672 | 149 | RemoveWatermark(c); | ||
673 | 150 | } | ||
674 | 151 | } | ||
675 | 152 | else | ||
676 | 153 | { | ||
677 | 154 | ShowWatermark(c); | ||
678 | 155 | } | ||
679 | 156 | } | ||
680 | 157 | |||
681 | 158 | /// <summary> | ||
682 | 159 | /// Event handler for the items changed event | ||
683 | 160 | /// </summary> | ||
684 | 161 | /// <param name="sender">The source of the event.</param> | ||
685 | 162 | /// <param name="e">A <see cref="ItemsChangedEventArgs"/> that contains the event data.</param> | ||
686 | 163 | private static void ItemsChanged(object sender, ItemsChangedEventArgs e) | ||
687 | 164 | { | ||
688 | 165 | ItemsControl control; | ||
689 | 166 | if (_itemsControls.TryGetValue(sender, out control)) | ||
690 | 167 | { | ||
691 | 168 | if (ShouldShowWatermark(control)) | ||
692 | 169 | { | ||
693 | 170 | ShowWatermark(control); | ||
694 | 171 | } | ||
695 | 172 | else | ||
696 | 173 | { | ||
697 | 174 | RemoveWatermark(control); | ||
698 | 175 | } | ||
699 | 176 | } | ||
700 | 177 | } | ||
701 | 178 | |||
702 | 179 | #endregion | ||
703 | 180 | |||
704 | 181 | #region Helper Methods | ||
705 | 182 | |||
706 | 183 | /// <summary> | ||
707 | 184 | /// Remove the watermark from the specified element | ||
708 | 185 | /// </summary> | ||
709 | 186 | /// <param name="control">Element to remove the watermark from</param> | ||
710 | 187 | private static void RemoveWatermark(UIElement control) | ||
711 | 188 | { | ||
712 | 189 | AdornerLayer layer = AdornerLayer.GetAdornerLayer(control); | ||
713 | 190 | |||
714 | 191 | // layer could be null if control is no longer in the visual tree | ||
715 | 192 | if (layer != null) | ||
716 | 193 | { | ||
717 | 194 | Adorner[] adorners = layer.GetAdorners(control); | ||
718 | 195 | if (adorners == null) | ||
719 | 196 | { | ||
720 | 197 | return; | ||
721 | 198 | } | ||
722 | 199 | |||
723 | 200 | foreach (Adorner adorner in adorners) | ||
724 | 201 | { | ||
725 | 202 | if (adorner is WatermarkAdorner) | ||
726 | 203 | { | ||
727 | 204 | adorner.Visibility = Visibility.Hidden; | ||
728 | 205 | layer.Remove(adorner); | ||
729 | 206 | } | ||
730 | 207 | } | ||
731 | 208 | } | ||
732 | 209 | } | ||
733 | 210 | |||
734 | 211 | /// <summary> | ||
735 | 212 | /// Show the watermark on the specified control | ||
736 | 213 | /// </summary> | ||
737 | 214 | /// <param name="control">Control to show the watermark on</param> | ||
738 | 215 | private static void ShowWatermark(Control control) | ||
739 | 216 | { | ||
740 | 217 | AdornerLayer layer = AdornerLayer.GetAdornerLayer(control); | ||
741 | 218 | |||
742 | 219 | // layer could be null if control is no longer in the visual tree | ||
743 | 220 | if (layer != null) | ||
744 | 221 | { | ||
745 | 222 | layer.Add(new WatermarkAdorner(control, GetWatermark(control))); | ||
746 | 223 | } | ||
747 | 224 | } | ||
748 | 225 | |||
749 | 226 | /// <summary> | ||
750 | 227 | /// Indicates whether or not the watermark should be shown on the specified control | ||
751 | 228 | /// </summary> | ||
752 | 229 | /// <param name="c"><see cref="Control"/> to test</param> | ||
753 | 230 | /// <returns>true if the watermark should be shown; false otherwise</returns> | ||
754 | 231 | private static bool ShouldShowWatermark(Control c) | ||
755 | 232 | { | ||
756 | 233 | if (c is ComboBox) | ||
757 | 234 | { | ||
758 | 235 | return (c as ComboBox).Text == string.Empty; | ||
759 | 236 | } | ||
760 | 237 | if (c is TextBoxBase) | ||
761 | 238 | { | ||
762 | 239 | return (c as TextBox).Text == string.Empty; | ||
763 | 240 | } | ||
764 | 241 | if(c is PasswordBox) | ||
765 | 242 | { | ||
766 | 243 | return (c as PasswordBox).Password == string.Empty; | ||
767 | 244 | } | ||
768 | 245 | if (c is ItemsControl) | ||
769 | 246 | { | ||
770 | 247 | return (c as ItemsControl).Items.Count == 0; | ||
771 | 248 | } | ||
772 | 249 | return false; | ||
773 | 250 | } | ||
774 | 251 | |||
775 | 252 | #endregion | ||
776 | 253 | } | ||
777 | 254 | } |