示例#1
0
        /// <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);
        }
示例#2
0
        /// <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();
        }
示例#3
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);
        }
示例#4
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);
        }
示例#5
0
        protected override void OnInitialized()
        {
            // notify dropdown that the button is inside of it
            ParentDropdown?.Register(this);

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

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

            base.OnInitialized();
        }
示例#6
0
        /// <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)
                    {
                    }