PWA Fundvelo der Caritas.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

InputCursorHandler.cs 851B

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