Example #1
0
        protected override async Task OnFirstAfterRenderAsync()
        {
            dotNetObjectRef ??= JSRunner.CreateDotNetObjectRef(new BreakpointActivatorAdapter(this));

            if (Rendered)
            {
                _ = JSRunner.RegisterBreakpointComponent(dotNetObjectRef, ElementId);

                if (Mode != BarMode.Horizontal)
                {
                    // Check if we need to collapse the Bar based on the current screen width against the breakpoint defined for this component.
                    // This needs to be run to set the inital state, RegisterBreakpointComponent and OnBreakpoint will handle
                    // additional changes to responsive breakpoints from there.
                    isBroken = BreakpointActivatorAdapter.IsBroken(Breakpoint, await JSRunner.GetBreakpoint());

                    if (Visible == isBroken)
                    {
                        Visible = !isBroken;
                        StateHasChanged();
                    }
                }
            }

            await base.OnFirstAfterRenderAsync();
        }
Example #2
0
        protected override async Task OnFirstAfterRenderAsync()
        {
            dotNetObjectRef ??= JSRunner.CreateDotNetObjectRef(new BreakpointActivatorAdapter(this));

            if (Rendered)
            {
                _ = JSRunner.RegisterBreakpointComponent(dotNetObjectRef, ElementId);
            }

            await base.OnFirstAfterRenderAsync();
        }