PWA Fundvelo der Caritas.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

InputCursorHandler.cs 836B

1234567891011121314151617181920212223
  1. using Microsoft.AspNetCore.Components.Web;
  2. using Microsoft.JSInterop;
  3. using System.Threading.Tasks;
  4. namespace cwebplusApp.Shared.Services {
  5. public class InputCursorHandler {
  6. private readonly IJSRuntime jsRuntime;
  7. public InputCursorHandler(IJSRuntime _jsRuntime) {
  8. this.jsRuntime = _jsRuntime;
  9. }
  10. public async Task OnKeyDownHandlerAsync(KeyboardEventArgs e) {
  11. var reference = DotNetObjectReference.Create(this);
  12. if (e.Key.Equals("Enter") || e.Key.Equals("ArrowRight")) {
  13. await jsRuntime.InvokeVoidAsync("MoveCursorToNextInput", reference, e.Key);
  14. } else if (e.Key.Equals("ArrowLeft")) {
  15. await jsRuntime.InvokeVoidAsync("MoveCursorToPreviousInput", reference);
  16. }
  17. }
  18. }
  19. }