• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DemoBytom / DemoEngine / 17778636268

16 Sep 2025 08:48PM UTC coverage: 24.615%. Remained the same
17778636268

push

coveralls.net

web-flow
Merge pull request #450 from DemoBytom/dependabot/dotnet_sdk/develop/dotnet-sdk-9.0.305

Bump dotnet-sdk from 9.0.300 to 9.0.305

96 of 390 relevant lines covered (24.62%)

146584.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Demo.Engine.Core/Components/Keyboard/Internal/KeyboardHandler.cs
1
// Copyright © Michał Dembski and contributors.
2
// Distributed under MIT license. See LICENSE file in the root for more information.
3

4
using Demo.Engine.Core.Interfaces.Components;
5
using Demo.Engine.Core.Notifications.Keyboard;
6
using Demo.Engine.Core.Requests.Keyboard;
7
using MediatR;
8

9
namespace Demo.Engine.Core.Components.Keyboard.Internal;
10

11
public sealed class KeyboardHandler :
12
    INotificationHandler<KeyNotification>,
13
    INotificationHandler<CharNotification>,
14
    INotificationHandler<ClearKeysNotification>,
15
    IRequestHandler<KeyboardHandleRequest, KeyboardHandle>,
16
    IRequestHandler<KeyboardCharCacheRequest, KeyboardCharCache>
17
{
18
    private readonly IKeyboardCache _keyboardCache;
19

20
    public KeyboardHandler(IKeyboardCache keyboardCache) => _keyboardCache = keyboardCache;
×
21

22
    /// <summary>
23
    /// OnKeyUp/OnKeyDown
24
    /// </summary>
25
    /// <param name="notification"></param>
26
    /// <param name="cancellationToken"></param>
27
    /// <returns></returns>
28
    Task INotificationHandler<KeyNotification>.Handle(KeyNotification notification, CancellationToken cancellationToken)
29
    {
30
        _keyboardCache.Key(notification.Key, notification.Down);
×
31
        return Task.CompletedTask;
×
32
    }
33

34
    /// <summary>
35
    /// OnChar
36
    /// </summary>
37
    /// <param name="notification"></param>
38
    /// <param name="cancellationToken"></param>
39
    /// <returns></returns>
40
    Task INotificationHandler<CharNotification>.Handle(CharNotification notification, CancellationToken cancellationToken)
41
    {
42
        _keyboardCache.Char(notification.Char);
×
43
        return Task.CompletedTask;
×
44
    }
45

46
    /// <summary>
47
    /// Clean keys cache
48
    /// </summary>
49
    /// <param name="notification"></param>
50
    /// <param name="cancellationToken"></param>
51
    /// <returns></returns>
52
    Task INotificationHandler<ClearKeysNotification>.Handle(ClearKeysNotification notification, CancellationToken cancellationToken)
53
    {
54
        _keyboardCache.ClearState();
×
55
        return Task.CompletedTask;
×
56
    }
57

58
    /// <summary>
59
    /// Get the keyboard handle
60
    /// </summary>
61
    /// <param name="request"></param>
62
    /// <param name="cancellationToken"></param>
63
    /// <returns></returns>
64
    Task<KeyboardHandle> IRequestHandler<KeyboardHandleRequest, KeyboardHandle>.Handle(KeyboardHandleRequest request, CancellationToken cancellationToken)
65
    {
66
        var response = new KeyboardHandle(
×
67
            _keyboardCache);
×
68
        return Task.FromResult(response);
×
69
    }
70

71
    Task<KeyboardCharCache> IRequestHandler<KeyboardCharCacheRequest, KeyboardCharCache>.Handle(KeyboardCharCacheRequest request, CancellationToken cancellationToken)
72
    {
73
        var response = new KeyboardCharCache(_keyboardCache);
×
74
        return Task.FromResult(response);
×
75
    }
76
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc