PWA Fundvelo der Caritas.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

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. }