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

luttje / Key2Joy / 6598306412

21 Oct 2023 03:54PM UTC coverage: 45.09% (-7.4%) from 52.519%
6598306412

Pull #50

github

web-flow
Merge bff596568 into 14b7ce9a7
Pull Request #50: Add XInput in preparation for gamepad triggers + add xmldoc

751 of 2289 branches covered (0.0%)

Branch coverage included in aggregate %.

2384 of 2384 new or added lines in 80 files covered. (100.0%)

3845 of 7904 relevant lines covered (48.65%)

15964.61 hits per line

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

0.0
/Key2Joy.Gui/DeviceListControl.cs
1
using System.Windows.Forms;
2
using CommonServiceLocator;
3
using Key2Joy.LowLevelInput.SimulatedGamePad;
4
using Key2Joy.LowLevelInput.XInput;
5

6
namespace Key2Joy.Gui;
7

8
public partial class DeviceListControl : UserControl
9
{
10
    public DeviceListControl()
×
11
    {
12
        this.InitializeComponent();
×
13

14
        if (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv")
×
15
        {
16
            return; // The designer can't handle the code below.
×
17
        }
18

19
        this.RefreshDevices();
×
20
    }
×
21

22
    public void RefreshDevices()
23
    {
24
        this.pnlDevices.Controls.Clear();
×
25

26
        this.RefreshSimulatedDevices();
×
27
        this.RefreshPhysicalDevices();
×
28
    }
×
29

30
    private void AddDeviceControl(DeviceControl control)
31
    {
32
        control.Dock = DockStyle.Top;
×
33
        this.pnlDevices.Controls.Add(control);
×
34
    }
×
35

36
    private void RefreshPhysicalDevices()
37
    {
38
        var xInputService = ServiceLocator.Current.GetInstance<IXInputService>();
×
39
        xInputService.RecognizePhysicalDevices();
×
40
        var deviceIndexes = xInputService.GetActiveDevicesInfo();
×
41

42
        foreach (var device in deviceIndexes)
×
43
        {
44
            this.AddDeviceControl(new DeviceControl(device));
×
45
        }
46
    }
×
47

48
    private void RefreshSimulatedDevices()
49
    {
50
        var gamePadService = ServiceLocator.Current.GetInstance<ISimulatedGamePadService>();
×
51
        var simulatedGamePads = gamePadService.GetActiveDevicesInfo();
×
52

53
        foreach (var gamePad in simulatedGamePads)
×
54
        {
55
            this.AddDeviceControl(new DeviceControl(gamePad));
×
56
        }
57
    }
×
58

59
    private void BtnRefresh_Click(object sender, System.EventArgs e) => this.RefreshDevices();
×
60
}
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