private void AddDefaultCallbackHandlers(ICallbackHandler <IActionResult> callbackHandlers) { callbackHandlers.OnExecuteEvent = async(eventName, screenModel) => { await _store.RemoveAsync(LastProcessedTokenKey); return(await OnEvent(eventName, screenModel)); }; callbackHandlers.OnExecuteRedirection = (redirectTo) => Task.FromResult((IActionResult)RedirectToAction(redirectTo.ActionName, redirectTo.ControllerName)); callbackHandlers.OnExecuteUnauthorized = unauthorizedModel => Task.FromResult((IActionResult)Unauthorized()); callbackHandlers.OnRedirectToRoot = async(type, handler) => RedirectToAction(nameof(Current), type, await new CurrentViewRequest { FlowHandler = handler }.ToValidRouteValueAsync(ControllerContext.HttpContext)); callbackHandlers.OnRedirectToCurrent = async(type, handler) => RedirectToAction(nameof(Current), type, (object)await Request.Query.ToExpandoObject().MergeObjects(new { FlowHandler = handler }) .ToEncryptedRouteValueAsync(ControllerContext.HttpContext)); callbackHandlers.OnNewContainedScreen = (containerHandler, containerType, flowType, startInfo) => { var requestData = startInfo.MergeObjects(new GetNewContainedViewRequest { FlowHandler = containerHandler, NewContainedFlowType = flowType, }); return(RedirectToAction(nameof(NewContainedView), containerType, requestData)); }; callbackHandlers.OnStartNewFlow = async(flowType, startInfo) => RedirectToAction(nameof(Init), flowType, await startInfo.ToValidRouteValueAsync(HttpContext)); callbackHandlers.OnAddModelError = (memberName, errorMessage) => ModelState.AddModelError(memberName, errorMessage); }
public async Task Remove(string flowHandler) { await _store.RemoveAsync(flowHandler); Logger.Debug(() => $"Removed {flowHandler}"); }