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

luttje / Key2Joy / 6602669847

22 Oct 2023 08:23AM UTC coverage: 44.094% (-8.4%) from 52.519%
6602669847

push

github

web-flow
Add XInput in preparation for gamepad triggers + add xmldoc (#50)

* Add XInput in preparation for gamepad triggers + add xmldoc

* add parent-child relation between mapped options

* add remove child mappings option + remove debug context menu

* x86 > AnyCPU (gives more sensible errors in WinForms Designer) - Fixed Designer failing on MappingForm

* Fix polling gamepad

* Add gamepad input trigger and config control + Fix mapping list not updating correctly

* remove broken and quite useless test

* update readme with warning regarding #46 + update readme special thanks

* add warning on same gamepad id trigger and action

* attempt to give github actions more time before timeout (tests sometimes fail)

* use current default mapping profile from app (so we dont have to copy it to tests everytime manually)

* Add gamepad button trigger

* Add multi-property edit mode

* Show physical gamepad connection warning

* give even more time for tests so they dont fail

* Block arming mappings if simulated gamepad index collides with physical gamepad

* Cleanup + add GamePad Trigger Trigger

* Fix combined trigger remove not working

* Separate stick action and allow custom scaling

* improve stick feeling

* fix parent picker

* update default mappings

* add trigger and try work out conflicts between physical and simulated devices (no luck yet)

* Fix simulated gamepad recognized as physical

* Show gamepad devices in UI

* fix mapping form + add more multi-edit type support

* make reverse mapping tool more useful

* easily setup/update reverse mappings while creating/updating a mapping

* update readme screenshots + prefer 'Arm' terminology for enabling profile

* support more nullable types in mapping profile

* simplify groups

* add configurable grouping

* prevent wonky sorting across groups

* Add easy switch group option

* Fix being able to create corrupt profile

* fail loading ... (continued)

762 of 2383 branches covered (0.0%)

Branch coverage included in aggregate %.

3060 of 3060 new or added lines in 106 files covered. (100.0%)

3897 of 8183 relevant lines covered (47.62%)

12635.93 hits per line

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

0.0
/Key2Joy.Gui/NotificationBannerControl.cs
1
using System;
2
using System.Drawing;
3
using System.Windows.Forms;
4

5
namespace Key2Joy.Gui;
6

7
public enum NotificationBannerStyle
8
{
9
    Information = 0,
10
    Warning = 1,
11
    Error = 2,
12
}
13

14
public partial class NotificationBannerControl : UserControl
15
{
16
    private const int BORDER_WIDTH = 2;
17
    private const int BORDER_MARGIN = 2;
18

19
    private readonly string message;
20
    private readonly NotificationBannerStyle style;
21
    private readonly Timer timeLeftTimer;
22

23
    public NotificationBannerControl(
×
24
        string message,
×
25
        NotificationBannerStyle style = NotificationBannerStyle.Information,
×
26
        TimeSpan? duration = null
×
27
    )
×
28
    {
29
        this.InitializeComponent();
×
30

31
        this.message = message;
×
32
        this.style = style;
×
33

34
        this.lblMessage.Text = message;
×
35

36
        duration ??= TimeSpan.FromSeconds(10);
×
37

38
        this.timeLeftTimer = new Timer
×
39
        {
×
40
            Interval = (int)Math.Min(1000, duration.Value.TotalMilliseconds)
×
41
        };
×
42
        this.timeLeftTimer.Tick += (s, e) =>
×
43
        {
×
44
            // Show the remaining time in the btnClose every second, close when times up
×
45
            duration -= TimeSpan.FromSeconds(1);
×
46
            this.btnClose.Text = $"✖ {duration.Value.TotalSeconds:0}s";
×
47

×
48
            if (duration.Value.TotalSeconds <= 0)
×
49
            {
×
50
                this.Close();
×
51
            }
×
52
        };
×
53
        this.timeLeftTimer.Start();
×
54

55
        switch (this.style)
×
56
        {
57
            case NotificationBannerStyle.Information:
58
                this.lblMessage.ForeColor = Color.White;
×
59
                this.BackColor = Color.DarkBlue;
×
60
                break;
×
61

62
            case NotificationBannerStyle.Warning:
63
                this.lblMessage.ForeColor = Color.Black;
×
64
                this.BackColor = Color.Gold;
×
65
                break;
×
66

67
            case NotificationBannerStyle.Error:
68
                this.lblMessage.ForeColor = Color.White;
×
69
                this.BackColor = Color.Crimson;
×
70
                break;
71
        }
72
    }
×
73

74
    private void Close()
75
    {
76
        this.timeLeftTimer.Stop();
×
77
        this.timeLeftTimer.Dispose();
×
78
        this.Parent?.Controls.Remove(this);
×
79
    }
×
80

81
    private void BtnClose_Click(object sender, System.EventArgs e)
82
        => this.Close();
×
83

84
    private void NotificationBannerControl_Paint(object sender, PaintEventArgs e)
85
    {
86
        const ButtonBorderStyle borderStyle = ButtonBorderStyle.Dashed;
87
        var borderColor = Color.WhiteSmoke;
×
88

89
        if (this.style == NotificationBannerStyle.Warning)
×
90
        {
91
            borderColor = Color.Black;
×
92
        }
93

94
        ControlPaint.DrawBorder(
×
95
            e.Graphics,
×
96
            new Rectangle(
×
97
                this.ClientRectangle.X + BORDER_MARGIN,
×
98
                this.ClientRectangle.Y + BORDER_MARGIN,
×
99
                this.ClientRectangle.Width - (BORDER_MARGIN * 2),
×
100
                this.ClientRectangle.Height - (BORDER_MARGIN * 2)
×
101
            ),
×
102
            borderColor,
×
103
            BORDER_WIDTH,
×
104
            borderStyle,
×
105
            borderColor,
×
106
            BORDER_WIDTH,
×
107
            borderStyle,
×
108
            borderColor,
×
109
            BORDER_WIDTH,
×
110
            borderStyle,
×
111
            borderColor,
×
112
            BORDER_WIDTH,
×
113
            borderStyle
×
114
        );
×
115
    }
×
116
}
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

© 2026 Coveralls, Inc