protected virtual void Navigate() { if (GetType().TryGetCustomAttribute(out UrlAttribute attribute) || !AtataContext.Current.IsNavigated) { Go.ToUrl(attribute?.Url); } }
private T GoToFollowingPageObject <T>( UIComponent currentPageObject, T nextPageObject, GoOptions options) where T : PageObject <T> { bool isReturnedFromTemporary = TryResolvePreviousPageObjectNavigatedTemporarily(ref nextPageObject); nextPageObject = nextPageObject ?? ActivatorEx.CreateInstance <T>(); if (!isReturnedFromTemporary) { if (!options.Temporarily) { _context.CleanUpTemporarilyPreservedPageObjectList(); } nextPageObject.NavigateOnInit = options.Navigate; if (options.Temporarily) { nextPageObject.IsTemporarilyNavigated = options.Temporarily; _context.TemporarilyPreservedPageObjectList.Add(currentPageObject); } } ((IPageObject)currentPageObject).DeInit(); _context.PageObject = nextPageObject; // TODO: Review this condition. if (!options.Temporarily) { UIComponentResolver.CleanUpPageObject(currentPageObject); } if (!string.IsNullOrWhiteSpace(options.Url)) { Go.ToUrl(options.Url); } if (!string.IsNullOrWhiteSpace(options.WindowName)) { ((IPageObject)currentPageObject).SwitchToWindow(options.WindowName); } if (isReturnedFromTemporary) { _context.Log.Info("Go to {0}", nextPageObject.ComponentFullName); } else { nextPageObject.PreviousPageObject = currentPageObject; nextPageObject.Init(); } return(nextPageObject); }
protected virtual void Navigate() { string url = Metadata.Get <UrlAttribute>()?.Url; if (url != null || !AtataContext.Current.IsNavigated) { Go.ToUrl(url); } }
TOther IPageObject.GoTo <TOther>(TOther pageObject, GoOptions options) { bool isReturnedFromTemporary = TryResolvePreviousPageObjectNavigatedTemporarily(ref pageObject); pageObject = pageObject ?? ActivatorEx.CreateInstance <TOther>(); if (!isReturnedFromTemporary) { if (!options.Temporarily) { AtataContext.Current.CleanUpTemporarilyPreservedPageObjectList(); } pageObject.NavigateOnInit = options.Navigate; if (options.Temporarily) { pageObject.IsTemporarilyNavigated = options.Temporarily; AtataContext.Current.TemporarilyPreservedPageObjectList.Add(this); } } ExecuteTriggers(TriggerEvents.DeInit); // TODO: Review that condition. if (!options.Temporarily) { UIComponentResolver.CleanUpPageObject(this); } if (!string.IsNullOrWhiteSpace(options.Url)) { Go.ToUrl(options.Url); } if (!string.IsNullOrWhiteSpace(options.WindowName)) { SwitchTo(options.WindowName); } if (isReturnedFromTemporary) { Log.Info("Go to {0}", pageObject.ComponentFullName); } else { pageObject.PreviousPageObject = this; pageObject.Init(); } return(pageObject); }