示例#1
0
        /// <summary>
        /// 显示当前警告消息框。
        /// </summary>
        public async Task Show()
        {
            IsShown = true;
            await OnShown.InvokeAsync(IsShown);

            StateHasChanged();
        }
示例#2
0
        /// <summary>
        /// 显示遮罩层。
        /// </summary>
        public async Task Show()
        {
            IsShown = true;
            await OnShown.InvokeAsync(true);

            StartCountdownForTimeout();

            StateHasChanged();
        }
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                HasRender = true;
                if (Target != null)
                {
                    if (!IsDropdown)
                    {
                        await BlazorStrap.Interop.AddEventAsync(_objectRef, Target, EventType.Click);
                    }
                    if (MouseOver)
                    {
                        await BlazorStrap.Interop.AddEventAsync(_objectRef, Target, EventType.Mouseenter);

                        await BlazorStrap.Interop.AddEventAsync(_objectRef, Target, EventType.Mouseleave);
                    }

                    EventsSet = true;
                }
            }
            else
            {
                if (!_called)
                {
                    return;
                }
                _called = false;
                // Since there is no transition without a we run into a issue where rapid calls break the popover.
                // The delay allows the popover time to clean up
                await Task.Delay(100);

                if (Shown)
                {
                    if (OnShown.HasDelegate)
                    {
                        await OnShown.InvokeAsync(this);
                    }
                }
                else
                {
                    if (OnHidden.HasDelegate)
                    {
                        await OnHidden.InvokeAsync(this);
                    }
                }
            }
        }
示例#4
0
        public override async Task ShowAsync()
        {
            if (OnShow.HasDelegate)
            {
                await OnShow.InvokeAsync(this);
            }
            Shown = true;
            await BlazorStrap.Interop.SetStyleAsync(MyRef, "display", "block");

            if (Target != null)
            {
                await BlazorStrap.Interop.AddPopoverAsync(MyRef, Placement, Target);
            }
            await BlazorStrap.Interop.UpdatePopoverArrowAsync(MyRef, Placement, true);

            await BlazorStrap.Interop.AddClassAsync(MyRef, "show");

            if (OnShown.HasDelegate)
            {
                _ = Task.Run(() => { _ = OnShown.InvokeAsync(this); });
            }
        }