public void Remove(INavigationElement element) { if (_elements.Contains(element)) { _elements.Remove(element); } }
public MenuControl(Browser browser, IElement parent, IElementLocator locator) : base(browser, parent, locator) { this.TxtUserName = WebElement.Create(this.browser, this, ElementLocator.Create(By.Id, "userName")); this.TxtPassword = WebElement.Create(this.browser, this, ElementLocator.Create(By.Id, "password")); this.BtnLogin = WebElement.CreateNavigation <Test000HomePage>(this.browser, this, ElementLocator.Create(By.Id, "login")); }
public void Remove(INavigationElement element) { if (_registerElements.ContainsKey(element)) { _registerElements.Remove(element); UpdateCurrentElement(); } }
private void UpdateCurrentElement() { UpdateSiblingValues(); _lastSiblingElement = null; foreach (var key in _registerElements.Keys) { if (_lastSiblingElement == null) { _lastSiblingElement = key; } else if (_registerElements[key] > _registerElements[_lastSiblingElement]) { _lastSiblingElement = key; } } }
/// <summary> /// Gets the final URL by encoding the path and by removing the filename if it equals <c>index.htm</c>. /// </summary> /// <param name="navigationElement">The navigation element.</param> /// <param name="navigationContext">The navigation context.</param> /// <returns></returns> public static string GetFinalTargetUrl(this INavigationElement navigationElement, NavigationContext navigationContext) { var targetUrl = navigationElement.GetTargetURL(navigationContext); var link = HttpUtility.UrlPathEncode(targetUrl); if (navigationContext.StripIndexHtm) { if (link.Length > IndexHtmFileName.Length && link.EndsWith(IndexHtmFileName, StringComparison.InvariantCultureIgnoreCase)) { link = link.Substring(0, link.Length - IndexHtmFileName.Length); } } return(link); }
private int GetSiblingValue(INavigationElement element) { var elementTransform = element.RectTransform; var siblingValue = elementTransform.GetSiblingIndex(); var navigationParent = elementTransform.parent; var parentCount = 0; while (navigationParent != null && parentCount < 5) { const int maxElementsInOneParent = 200; siblingValue -= maxElementsInOneParent; siblingValue += navigationParent.GetSiblingIndex(); navigationParent = navigationParent.parent; parentCount++; } return(siblingValue); }
public bool IsCurrent(INavigationElement element) { return(_elements.Count > 0 && _elements[_elements.Count - 1].Equals(element)); }
public bool IsCurrent(INavigationElement element) { return(element.Equals(_lastSiblingElement)); }
public SortBySiblingNavigationRegister() { _registerElements = new Dictionary <INavigationElement, int>(); _lastSiblingElement = null; }
public static bool IsCurrent(INavigationElement element) { return(_currentRegister.IsCurrent(element)); }
public static void Remove(INavigationElement element) { _currentRegister.Remove(element); }
public static void Add(INavigationElement element) { _currentRegister.Add(element); }
/// <summary> /// Gets the final URL by encoding the path and by removing the filename if it equals <c>index.htm</c>. /// </summary> /// <param name="navigationElement">The navigation element.</param> /// <param name="navigationContext">The navigation context.</param> /// <returns></returns> public static string GetFinalTargetUrl(this INavigationElement navigationElement, NavigationContext navigationContext) { var targetUrl = navigationElement.GetTargetURL(navigationContext); return(GetFinalTargetUrl(targetUrl, navigationContext)); }