protected override void OnViewEvents(object sender, ViewEvent e) { base.OnViewEvents(sender, e); if (e.IsSaved()) // authenticated successfully { DetailsViewModel dvm = sender as DetailsViewModel; AuthenticationObject authObj = dvm == null ? null : dvm.DetailsObject as AuthenticationObject; ClaimsIdentity ci = null; if (authObj != null && authObj.EmailProperty.Value != null) { PersonInfo userInfo = ServiceProvider.GetService <IPersonService>().Read(authObj.EmailProperty.Value).Result; ci = SecurityManager.CreateIdentity(CookieAuthenticationDefaults.AuthenticationType, userInfo); } if (ci != null) { HttpContext.Current.GetOwinContext().Authentication.SignIn(ci); string url = HttpContext.Current.Request.QueryString[CookieAuthenticationDefaults.ReturnUrlParameter]; if (url != null) { Response.Redirect(url); } } } }
/// <summary> /// Default handler for saving or deleting of a child details view. /// </summary> /// <param name="childViewModel">Child view model that fired the original event</param> /// <param name="e">Event object</param> protected override void OnChildEvent(object childViewModel, ViewEvent e) { // ignore events from grandchildren if (e.IsSaved() || e.IsDeleted()) { LoadData(); // reload child lists if a child was updated } base.OnChildEvent(childViewModel, e); }
/// <summary> /// Handles child closing or change to refresh the list. /// </summary> /// <param name="childViewModel">Child view model that fired the original event</param> /// <param name="e">Event object</param> /// <param name="token">Cancellation token.</param> protected override async Task OnChildEventAsync(object childViewModel, ViewEvent e, CancellationToken token = default) { UpdateDetailsSelection(childViewModel as DetailsViewModel, e); if (e.IsSaved(false) || e.IsDeleted(false)) { await SearchAsync(true, token); } await base.OnChildEventAsync(childViewModel, e, token); }
/// <summary> /// Handles child closing or change to refresh the list. /// </summary> /// <param name="childViewModel">Child view model that fired the original event</param> /// <param name="e">Event object</param> protected override void OnChildEvent(object childViewModel, ViewEvent e) { UpdateDetailsSelection(childViewModel as DetailsViewModel, e); if (e.IsSaved(false) || e.IsDeleted(false)) { Search(true); } base.OnChildEvent(childViewModel, e); }
/// <summary> /// Handles child closing or change to refresh the list. /// </summary> /// <param name="childViewModel">Child view model that fired the original event</param> /// <param name="e">Event object</param> protected override void OnChildEvent(object childViewModel, ViewEvent e) { if (e.IsClosed() && List != null) { List.ClearSelectedRows(); List.FireCollectionChanged(); } if (e.IsSaved() || e.IsDeleted()) { Search(true); } base.OnChildEvent(childViewModel, e); }
protected override async Task OnViewEventsAsync(object sender, ViewEvent e, CancellationToken token = default) { await base.OnViewEventsAsync(sender, e, token); if (e.IsSaved()) { ClaimsIdentity ci = null; if (VM?.MainObj?.EmailProperty?.Value != null) { PersonInfo userInfo = (await personService.ReadAsync(VM.MainObj.EmailProperty.Value)).Result; ci = SecurityManager.CreateIdentity(CookieAuthenticationDefaults.AuthenticationScheme, userInfo); } var principal = new ClaimsPrincipal(ci); string ticket = signInManager.GetSignInTicket(principal); Navigation.NavigateTo("/SignIn?ticket=" + ticket, true); } }
protected override async Task OnViewEventsAsync(object sender, ViewEvent e, CancellationToken token = default) { await base.OnViewEventsAsync(sender, e, token); if (e.IsSaved()) // authenticated successfully { ClaimsIdentity ci = null; if (VM?.MainObj?.EmailProperty?.Value != null) { var personService = ServiceProvider.GetService <IPersonService>(); PersonInfo userInfo = (await personService.ReadAsync(VM.MainObj.EmailProperty.Value)).Result; ci = SecurityManager.CreateIdentity(CookieAuthenticationDefaults.AuthenticationType, userInfo); } if (ci != null) { HttpContext.Current.GetOwinContext().Authentication.SignIn(ci); string url = HttpContext.Current.Request.QueryString[CookieAuthenticationDefaults.ReturnUrlParameter]; if (url != null) { HttpContext.Current.Response.Redirect(url, false); } } } }