Beispiel #1
0
        public async Task <UiFlowScreenModel> RefreshStepDataAsync(IUiFlowContextData contextData,
                                                                   UiFlowScreenModel originalScreenModel, IDictionary <string, object> stepViewCustomizations = null)
        {
            TraceBegin(nameof(RefreshStepDataAsync), contextData);

            var result = originalScreenModel;

            if (!_stepDataLoaded)
            {
                await _syncLock.AsyncCriticalSection(async() =>
                {
                    if (!_stepDataLoaded)
                    {
                        LifecycleStage  = ScreenLifecycleStage.RefreshingStepData;
                        _stepDataLoaded = true;

                        var onRefreshStepDataAsync =
                            await OnRefreshModelAsync(contextData, originalScreenModel, stepViewCustomizations);
                        await OnScreenLoadCompletedAsync(contextData);
                        result         = onRefreshStepDataAsync;
                        LifecycleStage = ScreenLifecycleStage.RefreshStepDataCompleted;
                    }
                }
                                                     );
            }
            TraceEnd(nameof(RefreshStepDataAsync), contextData);

            return(result);
        }
Beispiel #2
0
 public static async Task AsyncCriticalSection(this SemaphoreSlim src, Func <Task> payload)
 {
     await src.AsyncCriticalSection(async() =>
     {
         await payload();
         return(true);
     });
 }