protected override async ValueTask DisposeAsync(bool disposing) { if (disposing && Rendered) { // TODO: switch to IAsyncDisposable await JSClosableModule.Unregister(this); DisposeDotNetObjectRef(dotNetObjectRef); dotNetObjectRef = null; } await base.DisposeAsync(disposing); }
private async Task Expand() { // An element location must be known every time we need to show the dropdown. The reason is mainly // because sometimes input can have different offset based on the changes on the page. For example // when validation is triggered the input can be pushed down by the error messages. elementInfo = await JSUtilitiesModule.GetElementInfo(ElementRef, ElementId); await JSClosableModule.Register(dotNetObjectRef, ElementRef); Expanded = true; // automatically set focus to the dropdown so that we can make it auto-close on blur event ExecuteAfterRender(async() => await DropdownElementRef.FocusAsync()); }
/// <summary> /// Disposes all the used resources. /// </summary> /// <param name="disposing">True if object is disposing.</param> protected override async ValueTask DisposeAsync(bool disposing) { if (disposing && Rendered) { // make sure to unregister listener if (jsRegistered) { jsRegistered = false; var task = JSClosableModule.Unregister(this); try { await task; } catch when(task.IsCanceled) { }
private async Task Collapse() { await JSClosableModule.Unregister(this); Expanded = false; }