private async Task CalculateTileCompletion(DemoChecklistContext context)
        {
            IDictionary <string, bool> contextPointStates = await JSInteropService.GetContextPointStates(context);

            CompletedPointCount = contextPointStates.Count(_ => _.Value);
            PointCount          = contextPointStates.Count;
        }
Beispiel #2
0
 public async ValueTask <IDictionary <string, bool> > GetContextPointStates(DemoChecklistContext context)
 => await jSRuntime.InvokeAsync <IDictionary <string, bool> >($"{jsNamespace}.getContextPointStates", new {
     context.Name,
     Points = context.Points.Select(p
                                    => new {
         p.Name,
         p.IsDone,
     })
 });
        private static DemoChecklistPointContext UpdatePointStateFromLocalStore(
            IJSInteropService jSInteropService,
            IDictionary <string, bool> pointStates,
            DemoChecklistContext Context,
            DemoChecklistPointContext contextPoint)
        {
            string key = jSInteropService.GetContextPointKeyName(Context, contextPoint);

            if (pointStates.ContainsKey(key))
            {
                contextPoint.IsDone = pointStates[key];
            }

            return(contextPoint);
        }
        public static async Task <DemoChecklistContext> UpdatePointStatesFromLocalStore(this DemoChecklistContext context, IJSInteropService jSInteropService)
        {
            IDictionary <string, bool> pointStates = await jSInteropService.GetContextPointStates(context);

            context.Points = new Collection <DemoChecklistPointContext>(
                context.Points.Select(p => UpdatePointStateFromLocalStore(jSInteropService, pointStates, context, p))
                .ToList());

            return(context);
        }
Beispiel #5
0
 public void OpenSideNav(DemoChecklistContext context) => InvokeAsync(() =>
 {
     demoChecklist = context;
     NavigationService.OpenSideNav();
     StateHasChanged();
 });
 public async ValueTask SetSplitterPosition(DemoChecklistContext context, (double, double) splitterPosition)
        public async Task CloseTile(DemoChecklistContext context)
        {
            await CalculateTileCompletion(context);

            await TileClosed.InvokeAsync();
        }
Beispiel #8
0
 public string GetContextPointKeyName(DemoChecklistContext context, DemoChecklistPointContext contextPoint)
 => $"{context.Name}_{contextPoint.Name}";
Beispiel #9
0
 public async ValueTask SetContextPointState(DemoChecklistContext context, DemoChecklistPointContext contextPoint)
 => await jSRuntime.InvokeVoidAsync($"{jsNamespace}.setContextPointState", GetContextPointKeyName(context, contextPoint), contextPoint.IsDone);
Beispiel #10
0
 public void OpenSideNav(DemoChecklistContext context) => checkboxSideNavLayout?.OpenSideNav(context);