internal async Task ScanFileAsync() { var input = Input.Dom(JSRuntime); var files = await input.ScanFilesAsync(); ScanFiles(files); _ = UploadFilesAsync(input); RequireRender = true; SetFieldValue(Files.ToArray(), true); }
protected override async Task OnAfterRenderAsync(bool firstRender) { if (string.IsNullOrWhiteSpace(ShowTo.Id)) { if (!rendered) { await Task.Delay(100); } return; } if (rendered) { return; } rendered = true; var showToRect = await ShowTo.Dom(JSRuntime).GetBoundingClientRectAsync(); var containerRect = await container.Dom(JSRuntime).GetBoundingClientRectAsync(); popupLayerOption = new PopupLayerOption(); popupLayerOption.Content = ChildContent; switch (Position) { case ShowToPosition.Bottom: popupLayerOption.Position = new System.Drawing.PointF() { X = (showToRect.X + showToRect.Width - containerRect.Width) / 2, Y = showToRect.Y + showToRect.Height }; break; case ShowToPosition.Top: popupLayerOption.Position = new System.Drawing.PointF() { X = (showToRect.X + showToRect.Width - containerRect.Width) / 2, Y = showToRect.Y - 32 /*按钮高度*/ }; break; } ChildContent = null; MarkAsRequireRender(); StateHasChanged(); popupService.PopupLayerOptions.Add(popupLayerOption); }
private async Task AnimationElementLoadAsync() { if (paths == null || !paths.Any()) { return; } if (AutoAdjustPosition) { var rect = await animationElement.Dom(JSRuntime).GetBoundingClientRectAsync(); var screenWidth = await Document.GetClientWidthAsync(); var left = screenWidth / 2 - rect.Width / 2; styleBuilder.Add($"left:{left}px"); } currentPath = paths.Dequeue(); await Task.Delay(currentPath.Delay); ExecuteAnimation(currentPath.Style, currentPath.Increment); }