Skip to content

Commit

Permalink
Add basic device icons to device configuration menu
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNathannator committed Oct 6, 2023
1 parent b944374 commit ba9c7b7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Program/RB4InstrumentMapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
<ItemGroup>
<Resource Include="..\Docs\Images\ProgramScreenshot.png" />
<Resource Include="..\Docs\Images\vJoyConfiguration.png" />
<Resource Include="UsbDeviceListWindow\Icons\USB.png" />
<Resource Include="UsbDeviceListWindow\Icons\Xbox.png" />
<None Include="..\.gitignore" />
<None Include="..\README.md" />
</ItemGroup>
Expand Down
Binary file added Program/UsbDeviceListWindow/Icons/USB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Program/UsbDeviceListWindow/Icons/Xbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion Program/UsbDeviceListWindow/XboxUsbDeviceControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}">
<Grid Margin="9,9,9,9">
<Border Width="80" BorderThickness="1" VerticalAlignment="Stretch" HorizontalAlignment="Left" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}">
<Image x:Name="deviceTypeImage" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
<!-- This is a bit of a hack, but all the other alternatives are
much too complicated for just switching between two images lol -->
<Grid>
<Image x:Name="xboxIconImage" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Source="Icons/Xbox.png"/>
<Image x:Name="usbIconImage" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Source="Icons/USB.png"/>
</Grid>
</Border>
<Label x:Name="manufacturerLabel" Content="Manufacturer" Margin="85,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
<Label x:Name="nameLabel" Content="Name" Margin="85,20,0,0" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
Expand Down
4 changes: 4 additions & 0 deletions Program/UsbDeviceListWindow/XboxUsbDeviceControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ public XboxUsbDeviceControl(string devicePath, UsbPnPDevice device, bool winusb)
manufacturerLabel.Content = usbDevice.Descriptor.Manufacturer;
nameLabel.Content = usbDevice.Descriptor.Product;
switchDriverButton.Content = "Revert Driver";
xboxIconImage.Visibility = Visibility.Hidden;
usbIconImage.Visibility = Visibility.Visible;
}
else
{
manufacturerLabel.Content = PnpDevice.GetProperty<string>(DevicePropertyKey.Device_Manufacturer);
nameLabel.Content = PnpDevice.GetProperty<string>(DevicePropertyKey.NAME);
switchDriverButton.Content = "Switch Driver";
xboxIconImage.Visibility = Visibility.Visible;
usbIconImage.Visibility = Visibility.Hidden;
}
}

Expand Down

0 comments on commit ba9c7b7

Please sign in to comment.