PageRenderTime 28ms CodeModel.GetById 14ms app.highlight 10ms RepoModel.GetById 2ms app.codeStats 0ms

/V4/Quickstarts/View-Switching Navigation/View-Switching Navigation.Tests.AcceptanceTest/RegionNavigation.Tests.AcceptanceTest/TestEntities/Page/ViewSwitchingNavigationPage.cs

#
C# | 247 lines | 175 code | 56 blank | 16 comment | 0 complexity | 42e16f2b61ee4fe3fe23a6f9be68bb0d MD5 | raw file
  1//===================================================================================
  2// Microsoft patterns & practices
  3// Composite Application Guidance for Windows Presentation Foundation and Silverlight
  4//===================================================================================
  5// Copyright (c) Microsoft Corporation.  All rights reserved.
  6// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
  7// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
  8// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  9// FITNESS FOR A PARTICULAR PURPOSE.
 10//===================================================================================
 11// The example companies, organizations, products, domain names,
 12// e-mail addresses, logos, people, places, and events depicted
 13// herein are fictitious.  No association with any real company,
 14// organization, product, domain name, email address, logo, person,
 15// places, or events is intended or should be inferred.
 16//===================================================================================
 17using System;
 18using System.Collections.Generic;
 19using System.Linq;
 20using System.Text;
 21using AcceptanceTestLibrary.Common;
 22using System.Windows.Automation;
 23using AcceptanceTestLibrary.TestEntityBase;
 24using AcceptanceTestLibrary.ApplicationHelper;
 25
 26namespace ViewSwitchingNavigation.Tests.AcceptanceTest.TestEntities.Page
 27{
 28    public static class ViewSwitchingNavigationPage<TApp>
 29         where TApp : AppLauncherBase, new()
 30    
 31    {
 32        #region SILVERLIGHT
 33        public static AutomationElement Window
 34        {
 35            get { return PageBase<TApp>.Window; }
 36            set { PageBase<TApp>.Window = value; }
 37        }
 38
 39        public static AutomationElement EMailButton
 40        {
 41         get {return PageBase<TApp>.FindControlByAutomationId("EmailRadioButton");}
 42    
 43        }
 44
 45        public static AutomationElement CalendarButton
 46        {
 47            get { return PageBase<TApp>.FindControlByAutomationId("CalendarRadioButton"); }
 48
 49        }
 50
 51        public static AutomationElement ContactDetailsButton
 52        {
 53            get { return PageBase<TApp>.FindControlByAutomationId("ContactDetailsRadioButton"); }
 54
 55        }
 56
 57        public static AutomationElement ContactAvatarsButton
 58        {
 59            get { return PageBase<TApp>.FindControlByAutomationId("ContactAvatarsRadioButton"); }
 60
 61        }
 62
 63        public static AutomationElement CalendarGrid
 64        {
 65            get { return PageBase<TApp>.FindControlByAutomationId("CalendarGrid"); }
 66
 67        }
 68
 69        public static AutomationElement NewEmailButton
 70        {
 71            get 
 72            {
 73                PropertyCondition cond = new PropertyCondition(AutomationElement.NameProperty,
 74                    new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("NewButton"));
 75                PropertyCondition cond1 = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button);
 76                AndCondition andCond = new AndCondition(cond, cond1);
 77                AutomationElement aeElement = Window.FindFirst(TreeScope.Descendants, andCond);
 78                return aeElement;
 79            }
 80        }
 81
 82        public static AutomationElement Email
 83        {
 84            get
 85            {
 86                PropertyCondition cond = new PropertyCondition(AutomationElement.NameProperty,
 87                    new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("Email"));
 88                PropertyCondition cond1 = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button);
 89                AndCondition andCond = new AndCondition(cond, cond1);
 90                AutomationElement aeElement = Window.FindFirst(TreeScope.Descendants, andCond);
 91                return aeElement;
 92            }
 93        }
 94
 95        public static AutomationElement ReplyEmailButton
 96        {
 97            get
 98            {
 99                PropertyCondition cond = new PropertyCondition(AutomationElement.NameProperty,
100                    new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("ReplyButton"));
101                PropertyCondition cond1 = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button);
102                AndCondition andCond = new AndCondition(cond, cond1);
103                return Window.FindFirst(TreeScope.Descendants, andCond);
104            }
105        }
106
107        public static AutomationElement SendEmailButton
108        {
109            get
110            {
111                PropertyCondition cond = new PropertyCondition(AutomationElement.NameProperty,
112                    new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("SendButton"));
113                PropertyCondition cond1 = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button);
114                AndCondition andCond = new AndCondition(cond, cond1);
115                return Window.FindFirst(TreeScope.Descendants, andCond);
116            }
117        }
118
119        public static AutomationElementCollection Hyperlinks
120        {
121            get
122            {
123                PropertyCondition cond = new PropertyCondition(AutomationElement.AutomationIdProperty,
124                    new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("OpenMailHyperLink"));
125                PropertyCondition cond1 = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Hyperlink);
126                AndCondition andCond = new AndCondition(cond, cond1);
127                return Window.FindAll(TreeScope.Descendants, andCond);
128            }
129        }
130
131        public static AutomationElement MessagesList
132        {
133            get { return PageBase<TApp>.FindControlByAutomationId("MessagesList"); }
134
135        }
136
137        public static AutomationElement ContactsList
138        {
139            get { return PageBase<TApp>.FindControlByAutomationId("ContactsList"); }
140
141        }
142
143        public static AutomationElement SubjectTextBox
144        {
145            get { return PageBase<TApp>.FindControlByAutomationId("SubjectTextBox"); }
146
147        }
148
149        public static AutomationElement ToTextBox
150        {
151            get { return PageBase<TApp>.FindControlByAutomationId("ToTextBox"); }
152
153        }
154
155        public static AutomationElement EmailTextBox
156        {
157            get { return PageBase<TApp>.FindControlByAutomationId("EmailTextBox"); }
158
159        }
160
161        public static AutomationElement FromTextBlockData
162        {
163            get { return PageBase<TApp>.FindControlByAutomationId("TextBlockFromData"); }
164
165        }
166
167        public static AutomationElement TextBlockTo
168        {
169            get { return PageBase<TApp>.FindControlByAutomationId("TextBlockTo"); }
170
171        }
172
173        public static AutomationElement TextBlockToData
174        {
175            get { return PageBase<TApp>.FindControlByAutomationId("TextBlockToData"); }
176
177        }
178
179        public static AutomationElement TextBlockSubject
180        {
181            get { return PageBase<TApp>.FindControlByAutomationId("TextBlockSubject"); }
182
183        }
184
185        public static AutomationElement TextBlockSubjectData
186        {
187            get { return PageBase<TApp>.FindControlByAutomationId("TextBlockSubjectData"); }
188
189        }
190
191        public static AutomationElement TextBlockEmailData
192        {
193            get { return PageBase<TApp>.FindControlByAutomationId("TextBlockEmailData"); }
194
195        }
196
197        public static AutomationElement FromDataBlock
198        {
199            get { return PageBase<TApp>.FindControlByAutomationId("FromDataBlock"); }
200
201        }
202
203        public static AutomationElement ToBlock
204        {
205            get { return PageBase<TApp>.FindControlByAutomationId("ToBlock"); }
206
207        }
208
209        public static AutomationElement ToBlockData
210        {
211            get { return PageBase<TApp>.FindControlByAutomationId("ToBlockData"); }
212
213        }
214
215        public static AutomationElement SubjectBlock
216        {
217            get { return PageBase<TApp>.FindControlByAutomationId("SubjectBlock"); }
218
219        }
220
221        public static AutomationElement SubjectDataBlock
222        {
223            get { return PageBase<TApp>.FindControlByAutomationId("SubjectDataBlock"); }
224
225        }
226
227        public static AutomationElement EmailTextBlock
228        {
229            get { return PageBase<TApp>.FindControlByAutomationId("EmailTextBlock"); }
230
231        }
232
233        public static AutomationElementCollection OpenButton
234        {
235            get { return PageBase<TApp>.FindAllControlsByAutomationId("OpenButton"); }
236
237        }    
238
239
240        public static AutomationElementCollection ChildElements(AutomationElement parent)
241        {
242             return PageBase<TApp>.FindControlsByParent(parent); 
243        }
244        #endregion
245    
246    }
247}