Example #1
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && Rendered)
            {
                // TODO: implement IAsyncDisposable once it is supported by Blazor!
                //
                // Sometimes user can navigates to another page based on the action runned on modal. The problem is
                // that for providers like Bootstrap, some classnames can be left behind. So to cover those situation
                // we need to close modal and dispose of any claassnames in case there is any left.
                _ = JSRunner.CloseModal(ElementRef, ElementId);
            }

            base.Dispose(disposing);
        }
Example #2
0
        private void HandleVisibilityStyles(bool visible)
        {
            if (visible)
            {
                ExecuteAfterRender(async() =>
                {
                    await JSRunner.OpenModal(ElementRef, ElementId);
                });
            }
            else
            {
                ExecuteAfterRender(async() =>
                {
                    await JSRunner.CloseModal(ElementRef, ElementId);
                });
            }

            DirtyClasses();
            DirtyStyles();
        }
Example #3
0
        private void HandleOpenState(bool opened)
        {
            // TODO: find a way to remove javascript
            if (opened)
            {
                ExecuteAfterRender(async() =>
                {
                    await JSRunner.OpenModal(ElementRef, ElementId);
                });
            }
            else
            {
                ExecuteAfterRender(async() =>
                {
                    await JSRunner.CloseModal(ElementRef, ElementId);
                });
            }

            StateChanged?.Invoke(this, new ModalStateEventArgs(opened));

            DirtyClasses();
            DirtyStyles();
        }