PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms 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. //===================================================================================
  17. using System;
  18. using System.Collections.Generic;
  19. using System.Linq;
  20. using System.Text;
  21. using AcceptanceTestLibrary.Common;
  22. using System.Windows.Automation;
  23. using AcceptanceTestLibrary.TestEntityBase;
  24. using AcceptanceTestLibrary.ApplicationHelper;
  25. namespace ViewSwitchingNavigation.Tests.AcceptanceTest.TestEntities.Page
  26. {
  27. public static class ViewSwitchingNavigationPage<TApp>
  28. where TApp : AppLauncherBase, new()
  29. {
  30. #region SILVERLIGHT
  31. public static AutomationElement Window
  32. {
  33. get { return PageBase<TApp>.Window; }
  34. set { PageBase<TApp>.Window = value; }
  35. }
  36. public static AutomationElement EMailButton
  37. {
  38. get {return PageBase<TApp>.FindControlByAutomationId("EmailRadioButton");}
  39. }
  40. public static AutomationElement CalendarButton
  41. {
  42. get { return PageBase<TApp>.FindControlByAutomationId("CalendarRadioButton"); }
  43. }
  44. public static AutomationElement ContactDetailsButton
  45. {
  46. get { return PageBase<TApp>.FindControlByAutomationId("ContactDetailsRadioButton"); }
  47. }
  48. public static AutomationElement ContactAvatarsButton
  49. {
  50. get { return PageBase<TApp>.FindControlByAutomationId("ContactAvatarsRadioButton"); }
  51. }
  52. public static AutomationElement CalendarGrid
  53. {
  54. get { return PageBase<TApp>.FindControlByAutomationId("CalendarGrid"); }
  55. }
  56. public static AutomationElement NewEmailButton
  57. {
  58. get
  59. {
  60. PropertyCondition cond = new PropertyCondition(AutomationElement.NameProperty,
  61. new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("NewButton"));
  62. PropertyCondition cond1 = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button);
  63. AndCondition andCond = new AndCondition(cond, cond1);
  64. AutomationElement aeElement = Window.FindFirst(TreeScope.Descendants, andCond);
  65. return aeElement;
  66. }
  67. }
  68. public static AutomationElement Email
  69. {
  70. get
  71. {
  72. PropertyCondition cond = new PropertyCondition(AutomationElement.NameProperty,
  73. new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("Email"));
  74. PropertyCondition cond1 = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button);
  75. AndCondition andCond = new AndCondition(cond, cond1);
  76. AutomationElement aeElement = Window.FindFirst(TreeScope.Descendants, andCond);
  77. return aeElement;
  78. }
  79. }
  80. public static AutomationElement ReplyEmailButton
  81. {
  82. get
  83. {
  84. PropertyCondition cond = new PropertyCondition(AutomationElement.NameProperty,
  85. new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("ReplyButton"));
  86. PropertyCondition cond1 = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button);
  87. AndCondition andCond = new AndCondition(cond, cond1);
  88. return Window.FindFirst(TreeScope.Descendants, andCond);
  89. }
  90. }
  91. public static AutomationElement SendEmailButton
  92. {
  93. get
  94. {
  95. PropertyCondition cond = new PropertyCondition(AutomationElement.NameProperty,
  96. new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("SendButton"));
  97. PropertyCondition cond1 = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button);
  98. AndCondition andCond = new AndCondition(cond, cond1);
  99. return Window.FindFirst(TreeScope.Descendants, andCond);
  100. }
  101. }
  102. public static AutomationElementCollection Hyperlinks
  103. {
  104. get
  105. {
  106. PropertyCondition cond = new PropertyCondition(AutomationElement.AutomationIdProperty,
  107. new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("OpenMailHyperLink"));
  108. PropertyCondition cond1 = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Hyperlink);
  109. AndCondition andCond = new AndCondition(cond, cond1);
  110. return Window.FindAll(TreeScope.Descendants, andCond);
  111. }
  112. }
  113. public static AutomationElement MessagesList
  114. {
  115. get { return PageBase<TApp>.FindControlByAutomationId("MessagesList"); }
  116. }
  117. public static AutomationElement ContactsList
  118. {
  119. get { return PageBase<TApp>.FindControlByAutomationId("ContactsList"); }
  120. }
  121. public static AutomationElement SubjectTextBox
  122. {
  123. get { return PageBase<TApp>.FindControlByAutomationId("SubjectTextBox"); }
  124. }
  125. public static AutomationElement ToTextBox
  126. {
  127. get { return PageBase<TApp>.FindControlByAutomationId("ToTextBox"); }
  128. }
  129. public static AutomationElement EmailTextBox
  130. {
  131. get { return PageBase<TApp>.FindControlByAutomationId("EmailTextBox"); }
  132. }
  133. public static AutomationElement FromTextBlockData
  134. {
  135. get { return PageBase<TApp>.FindControlByAutomationId("TextBlockFromData"); }
  136. }
  137. public static AutomationElement TextBlockTo
  138. {
  139. get { return PageBase<TApp>.FindControlByAutomationId("TextBlockTo"); }
  140. }
  141. public static AutomationElement TextBlockToData
  142. {
  143. get { return PageBase<TApp>.FindControlByAutomationId("TextBlockToData"); }
  144. }
  145. public static AutomationElement TextBlockSubject
  146. {
  147. get { return PageBase<TApp>.FindControlByAutomationId("TextBlockSubject"); }
  148. }
  149. public static AutomationElement TextBlockSubjectData
  150. {
  151. get { return PageBase<TApp>.FindControlByAutomationId("TextBlockSubjectData"); }
  152. }
  153. public static AutomationElement TextBlockEmailData
  154. {
  155. get { return PageBase<TApp>.FindControlByAutomationId("TextBlockEmailData"); }
  156. }
  157. public static AutomationElement FromDataBlock
  158. {
  159. get { return PageBase<TApp>.FindControlByAutomationId("FromDataBlock"); }
  160. }
  161. public static AutomationElement ToBlock
  162. {
  163. get { return PageBase<TApp>.FindControlByAutomationId("ToBlock"); }
  164. }
  165. public static AutomationElement ToBlockData
  166. {
  167. get { return PageBase<TApp>.FindControlByAutomationId("ToBlockData"); }
  168. }
  169. public static AutomationElement SubjectBlock
  170. {
  171. get { return PageBase<TApp>.FindControlByAutomationId("SubjectBlock"); }
  172. }
  173. public static AutomationElement SubjectDataBlock
  174. {
  175. get { return PageBase<TApp>.FindControlByAutomationId("SubjectDataBlock"); }
  176. }
  177. public static AutomationElement EmailTextBlock
  178. {
  179. get { return PageBase<TApp>.FindControlByAutomationId("EmailTextBlock"); }
  180. }
  181. public static AutomationElementCollection OpenButton
  182. {
  183. get { return PageBase<TApp>.FindAllControlsByAutomationId("OpenButton"); }
  184. }
  185. public static AutomationElementCollection ChildElements(AutomationElement parent)
  186. {
  187. return PageBase<TApp>.FindControlsByParent(parent);
  188. }
  189. #endregion
  190. }
  191. }