Exemplo n.º 1
0
 /// <summary>
 /// Runs the view model filter.
 /// </summary>
 /// <param name="vmId">Identifies the view model.</param>
 /// <param name="vm">View model instance.</param>
 /// <param name="data">View model data.</param>
 /// <param name="vmAction">Filter action.</param>
 private async Task RunVMFilters(BaseVM vm, object data, VMController.VMActionDelegate vmAction)
 {
     try
     {
         _hubContext.Data = data;
         await _hubPipeline.RunVMFiltersAsync(_hubContext, vm, async ctx =>
         {
             await vmAction(ctx.HubContext.Data);
         });
     }
     catch (TargetInvocationException ex)
     {
         throw ex.InnerException;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Runs the filter before the view model respond to something.
        /// </summary>
        private async Task RunRespondingVMFilters(string vmId, BaseVM vm, object vmData, VMController.VMActionDelegate vmAction)
        {
            try
            {
                _hubContext = new DotNetifyHubContext(_callerContext, nameof(IDotNetifyHubMethod.Response_VM), vmId, vmData, null, Principal);
                await _hubPipeline.RunMiddlewaresAsync(_hubContext, async ctx =>
                {
                    Principal = ctx.Principal;
                    await RunVMFilters(vm, ctx.Data, vmAction);
                });
            }
            catch (Exception ex)
            {
                var finalEx = await _hubPipeline.RunExceptionMiddlewareAsync(_callerContext, ex);

                if (finalEx is OperationCanceledException == false && _callerContext != null)
                {
                    await ResponseVMAsync(_callerContext.ConnectionId, vmId, SerializeException(finalEx));
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Runs the filter before the view model is updated.
 /// </summary>
 private Task RunUpdatingVMFilters(string vmId, BaseVM vm, object vmData, VMController.VMActionDelegate vmAction) => RunVMFilters(vm, vmData, vmAction);
Exemplo n.º 4
0
 /// <summary>
 /// Runs the filter before the view model is requested.
 /// </summary>
 private Task RunRequestingVMFilters(string vmId, BaseVM vm, object vmArg, VMController.VMActionDelegate vmAction) => RunVMFilters(vm, vmArg, vmAction);