Beispiel #1
0
 protected override async Task OnAfterRenderAsync()
 {
     // Sets Focus inside model so escape key can work.
     if (JustOpened)
     {
         await new BlazorStrapInterop(JSRuntime).ChangeBody(_isOpen ? "modal-open" : null);
         await new BlazorStrapInterop(JSRuntime).ChangeBodyModal(_isOpen ? "17px" : null);
         if (!IgnoreEscape)
         {
             await new BlazorStrapInterop(JSRuntime).ModalEscapeKey();
             BlazorStrapInterop.OnEscapeEvent += OnEscape;
         }
         JustOpened = false;
     }
     else if (Closed)
     {
         Closed = false;
         await new BlazorStrapInterop(JSRuntime).ChangeBody(_isOpen ? "modal-open" : null);
         await new BlazorStrapInterop(JSRuntime).ChangeBodyModal(_isOpen ? "17px" : null);
     }
     for (int i = 0; i < EventQue.Count; i++)
     {
         await EventQue[i].InvokeAsync(BSModalEvent);
         EventQue.RemoveAt(i);
     }
 }
 protected override Task OnAfterRenderAsync()
 {
     for (int i = 0; i < EventQue.Count; i++)
     {
         EventQue[i].InvokeAsync(BSCollapseEvent);
         EventQue.RemoveAt(i);
     }
     return(base.OnAfterRenderAsync());
 }
Beispiel #3
0
 protected override Task OnAfterRenderAsync(bool firstrun)
 {
     for (var i = 0; i < EventQue.Count; i++)
     {
         EventQue[i].InvokeAsync(BSCollapseEvent);
         EventQue.RemoveAt(i);
     }
     return(base.OnAfterRenderAsync(false));
 }
Beispiel #4
0
 protected override async Task OnAfterRenderAsync(bool firstrun)
 {
     for (var i = 0; i < EventQue.Count; i++)
     {
         await EventQue[i].InvokeAsync(BSCollapseEvent).ConfigureAwait(false);
         EventQue.RemoveAt(i);
     }
     // return base.OnAfterRenderAsync(false);
 }
        protected override Task OnAfterRenderAsync(bool firstrun)
        {
            // This is models like the demo where they are open prior to the page drawing.
            if (firstrun)
            {
                _isInitialized = true;
            }
            for (var i = 0; i < EventQue.Count; i++)
            {
                EventQue[i].InvokeAsync(BSModalEvent);
                EventQue.RemoveAt(i);
            }

            return(base.OnAfterRenderAsync(false));
        }
Beispiel #6
0
 protected override async Task OnAfterRenderAsync(bool firstrun)
 {
     if (Collapsing)
     {
         if (firstrun && Collapsing)
         {
             Collapsing = false;
             await InvokeAsync(StateHasChanged).ConfigureAwait(false);
         }
         else
         {
             await new BlazorStrapInterop(JSRuntime).SetOffsetHeight(MyRef, IsOpen ?? false);
         }
     }
     for (var i = 0; i < EventQue.Count; i++)
     {
         EventQue[i].InvokeAsync(BSCollapseEvent);
         EventQue.RemoveAt(i);
     }
     // return base.OnAfterRenderAsync(false);
 }
Beispiel #7
0
 protected override async Task OnAfterRenderAsync(bool firstrun)
 {
     if (!HasRendered)
     {
         HasRendered = true;
     }
     else
     {
         // This try can be removed after they fix prerendering
         try
         {
             // Sets Focus inside model so escape key can work.
             if (JustOpened)
             {
                 await new BlazorStrapInterop(JSRuntime).ChangeBody(_isOpen ? "modal-open" : null);
                 await new BlazorStrapInterop(JSRuntime).ChangeBodyModal(_isOpen ? "17px" : null);
                 if (!IgnoreEscape)
                 {
                     await new BlazorStrapInterop(JSRuntime).ModalEscapeKey();
                     BlazorStrapInterop.OnEscapeEvent += OnEscape;
                 }
                 JustOpened = false;
             }
             else if (Closed)
             {
                 Closed = false;
                 await new BlazorStrapInterop(JSRuntime).ChangeBody(_isOpen ? "modal-open" : null);
                 await new BlazorStrapInterop(JSRuntime).ChangeBodyModal(_isOpen ? "17px" : null);
             }
             for (int i = 0; i < EventQue.Count; i++)
             {
                 await EventQue[i].InvokeAsync(BSModalEvent);
                 EventQue.RemoveAt(i);
             }
         }
         catch
         {
         }
     }
 }