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

            CompletedPointCount = contextPointStates.Count(_ => _.Value);
            PointCount          = contextPointStates.Count;
        }
예제 #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);
        }
예제 #5
0
 public void OpenSideNav(DemoChecklistContext context) => InvokeAsync(() =>
 {
     demoChecklist = context;
     NavigationService.OpenSideNav();
     StateHasChanged();
 });
 public async ValueTask SetSplitterPosition(DemoChecklistContext context, (double, double) splitterPosition)
예제 #7
0
        public async Task CloseTile(DemoChecklistContext context)
        {
            await CalculateTileCompletion(context);

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