private static async Task OnShowPopup(Page page) { var dt = GetCoachMark(page); if (dt == null) { return; } SetCoachMark(page, null); var nav = DependencyService.Get <INavigation>(); AtomCoachMarkPage coachMark = CreatePage(dt); if (coachMark == null) { string error = "Coachmark should be derived from AtomCoachMarkPage"; UIAtomsApplication.Instance.LogException?.Invoke(new InvalidOperationException(error) { }); await DependencyService.Get <INotificationService>().NotifyAsync(error); return; } await nav.PushModalAsync(coachMark); SetIsDisplayed(page, true); }
private static AtomCoachMarkPage CreatePage(object t) { AtomCoachMarkPage result = null; var dt = t as DataTemplate; if (dt != null) { result = dt.CreateContent() as AtomCoachMarkPage; } else { var type = t as Type; result = Activator.CreateInstance(type) as AtomCoachMarkPage; } if (result == null) { throw new InvalidOperationException($"Unable to create AtomCoachMarkPage from object {t}"); } return(result); }