コード例 #1
0
ファイル: Button.cs プロジェクト: weiplanet/Blazorise
        /// <inheritdoc/>
        protected override void OnInitialized()
        {
            // notify dropdown that the button is inside of it
            ParentDropdown?.NotifyButtonInitialized(this);

            // notify addons that the button is inside of it
            ParentAddons?.NotifyButtonInitialized(this);

            ExecuteAfterRender(async() =>
            {
                await JSModule.Initialize(ElementRef, ElementId, new
                {
                    PreventDefaultOnSubmit
                });
            });

            LoadingTemplate ??= ProvideDefaultLoadingTemplate();

            if (Theme != null)
            {
                Theme.Changed += OnThemeChanged;
            }

            base.OnInitialized();
        }
コード例 #2
0
ファイル: BaseButton.cs プロジェクト: qcjxberin/Blazorise
        protected override void OnInit()
        {
            // notify dropdown that the button is inside of it
            ParentDropdown?.Register(this);

            base.OnInit();
        }
コード例 #3
0
ファイル: Button.cs プロジェクト: weiplanet/Blazorise
        /// <inheritdoc/>
        protected override async ValueTask DisposeAsync(bool disposing)
        {
            if (disposing)
            {
                // remove button from parents
                ParentDropdown?.NotifyButtonRemoved(this);
                ParentAddons?.NotifyButtonRemoved(this);

                if (Rendered)
                {
                    await JSModule.SafeDestroy(ElementRef, ElementId);
                }

                if (command != null)
                {
                    command.CanExecuteChanged -= OnCanExecuteChanged;
                }

                if (Theme != null)
                {
                    Theme.Changed -= OnThemeChanged;
                }
            }

            await base.DisposeAsync(disposing);
        }
コード例 #4
0
        /// <inheritdoc/>
        protected override async ValueTask DisposeAsync(bool disposing)
        {
            if (disposing)
            {
                // remove button from parents
                ParentDropdown?.NotifyButtonRemoved(this);
                ParentAddons?.NotifyButtonRemoved(this);

                if (Rendered)
                {
                    var task = JSRunner.DestroyButton(ElementId);

                    try
                    {
                        await task;
                    }
                    catch when(task.IsCanceled)
                    {
                    }
                }

                if (command != null)
                {
                    command.CanExecuteChanged -= OnCanExecuteChanged;
                }

                if (Theme != null)
                {
                    Theme.Changed -= OnThemeChanged;
                }
            }

            await base.DisposeAsync(disposing);
        }
コード例 #5
0
        /// <inheritdoc/>
        protected override void OnInitialized()
        {
            if (ParentDropdown is not null)
            {
                ParentDropdown.AddDropdownMenu(this);
            }

            base.OnInitialized();
        }
コード例 #6
0
        /// <summary>
        /// Handles the item onclick event.
        /// </summary>
        /// <returns>A task that represents the asynchronous operation.</returns>
        protected Task ClickHandler()
        {
            if (!Disabled)
            {
                ParentDropdown?.Toggle();
            }

            return(Clicked.InvokeAsync(null));
        }
コード例 #7
0
        /// <summary>
        /// Handles the item onclick event.
        /// </summary>
        /// <returns>A task that represents the asynchronous operation.</returns>
        protected Task ClickHandler()
        {
            if (!Disabled)
            {
                ParentDropdown?.Toggle();
            }

            return(Task.CompletedTask);
        }
コード例 #8
0
        /// <inheritdoc/>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (ParentDropdown is not null)
                {
                    ParentDropdown.RemoveDropdownMenu(this);
                }
            }

            base.Dispose(disposing);
        }
コード例 #9
0
ファイル: Button.razor.cs プロジェクト: komirineni/Blazorise
        protected override void OnInitialized()
        {
            // notify dropdown that the button is inside of it
            ParentDropdown?.Register(this);

            ExecuteAfterRender(async() =>
            {
                await JSRunner.InitializeButton(ElementId, ElementRef, PreventDefaultOnSubmit);
            });

            base.OnInitialized();
        }
コード例 #10
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                // remove button from parents
                ParentDropdown?.UnRegister(this);
                ParentAddons?.UnRegister(this);

                JSRunner.DestroyButton(ElementId);
            }

            base.Dispose(disposing);
        }
コード例 #11
0
 /// <summary>
 /// Handles the onclick event, if not disabled.
 /// </summary>
 /// <returns></returns>
 protected async Task ClickHandler()
 {
     if (!Disabled)
     {
         if (ParentDropdown is not null)
         {
             if (!ParentDropdown.WasJustToggled)
             {
                 await ParentDropdown.Hide(true);
             }
         }
         await Clicked.InvokeAsync(Value);
     }
 }
コード例 #12
0
        /// <inheritdoc/>
        protected override void OnInitialized()
        {
            if (ParentDropdown is not null)
            {
                ParentDropdown.NotifyDropdownToggleInitialized(this);
            }

            if (Theme != null)
            {
                Theme.Changed += OnThemeChanged;
            }

            base.OnInitialized();
        }
コード例 #13
0
ファイル: Button.cs プロジェクト: intronik/Blazorise
        /// <inheritdoc/>
        protected override async ValueTask DisposeAsync(bool disposing)
        {
            if (disposing)
            {
                // remove button from parents
                ParentDropdown?.NotifyButtonRemoved(this);
                ParentAddons?.UnRegister(this);

                if (Rendered)
                {
                    var task = JSRunner.DestroyButton(ElementId);

                    try
                    {
                        await task;
                    }
                    catch when(task.IsCanceled)
                    {
                    }
コード例 #14
0
ファイル: Button.cs プロジェクト: intronik/Blazorise
        /// <inheritdoc/>
        protected override void OnInitialized()
        {
            // notify dropdown that the button is inside of it
            ParentDropdown?.NotifyButtonInitialized(this);

            // notify addons that the button is inside of it
            ParentAddons?.Register(this);

            ExecuteAfterRender(async() =>
            {
                await JSRunner.InitializeButton(ElementRef, ElementId, PreventDefaultOnSubmit);
            });

            if (LoadingTemplate == null)
            {
                LoadingTemplate = ProvideDefaultLoadingTemplate();
            }

            base.OnInitialized();
        }
コード例 #15
0
        public Task Close(CloseReason closeReason)
        {
            ParentDropdown?.Hide();

            return(Task.CompletedTask);
        }
コード例 #16
0
        protected Task ClickHandler()
        {
            ParentDropdown?.Toggle();

            return(Task.CompletedTask);
        }
コード例 #17
0
 protected void ClickHandler()
 {
     ParentDropdown?.Toggle();
 }