Пример #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;
     }
 }
Пример #2
0
 /// <summary>
 /// Creates view model filter delegate that runs before it is requested/updated.
 /// </summary>
 /// <param name="hubContext">DotNetify hub context.</param>
 /// <param name="hubPipeline">Middleware/VM filter pipeline.</param>
 /// <returns>View model filter delegate.</returns>
 private VMController.FilterDelegate CreateVMFilter(DotNetifyHubContext hubContext, IHubPipeline hubPipeline)
 {
     return(async(vmId, vm, data, vmAction) =>
     {
         try
         {
             hubContext.Data = data;
             await hubPipeline.RunVMFiltersAsync(hubContext, vm, async ctx =>
             {
                 await vmAction(ctx.HubContext.Data);
             });
         }
         catch (TargetInvocationException ex)
         {
             throw ex.InnerException;
         }
     });
 }