You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
7.4 KiB
113 lines
7.4 KiB
<UserControl x:Class="MultiTerm.Wpf.View.SettingsView.UsbHidSettingsView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:local="clr-namespace:MultiTerm.Wpf.View.SettingsView"
|
|
xmlns:XamlBehavioursWpf="http://schemas.microsoft.com/xaml/behaviors"
|
|
mc:Ignorable="d"
|
|
d:DesignHeight="50" d:DesignWidth="800">
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Left" Command="{Binding ConnectDisconnectCommand}" Content="{Binding ConnectDisconnectButtonText}" Width="80"/>
|
|
|
|
<StackPanel Orientation="Horizontal" IsEnabled="{Binding AreEditable}">
|
|
<StackPanel.Resources>
|
|
<!-- Template for Combobox Item -->
|
|
<ControlTemplate x:Key="NotDroppedTemplate">
|
|
<StackPanel Orientation="Horizontal">
|
|
<Label Content="VID:" FontSize="11" VerticalAlignment="Center" Padding="0 0 5 0"/>
|
|
<TextBlock Text="0x"/>
|
|
<TextBlock Text="{Binding VendorId}" FontWeight="DemiBold"/>
|
|
<Label Content="PID:" FontSize="11" VerticalAlignment="Center" Padding="15 0 5 0"/>
|
|
<TextBlock Text="0x"/>
|
|
<TextBlock Text="{Binding ProductId}" FontWeight="DemiBold"/>
|
|
</StackPanel>
|
|
</ControlTemplate>
|
|
<ControlTemplate x:Key="DroppedTemplate">
|
|
<StackPanel Orientation="Vertical">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="60"/>
|
|
<ColumnDefinition Width="60"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*"/>
|
|
<RowDefinition Height="*"/>
|
|
<RowDefinition Height="*"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
<!-- VID and PID -->
|
|
<Label Content="Vendor ID:" FontSize="11" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="1"
|
|
HorizontalAlignment="Left" Padding="0"/>
|
|
<Label Content="Product ID:" FontSize="11" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="1"
|
|
HorizontalAlignment="Left" Padding="0"/>
|
|
<TextBlock Text="{Binding VendorId}" FontSize="15" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="1"
|
|
HorizontalAlignment="Left" FontWeight="DemiBold"/>
|
|
<TextBlock Text="{Binding ProductId}" FontSize="15" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="1"
|
|
HorizontalAlignment="Left" FontWeight="DemiBold"/>
|
|
</Grid>
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="80"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
<!-- Manufacturer -->
|
|
<Label Content="Manufacturer:" FontSize="11" Grid.Row="0" Grid.Column="0"
|
|
Padding="0 0 10 0" VerticalAlignment="Center"/>
|
|
<TextBlock Text="{Binding Manufacturer}" FontSize="12" Grid.Row="0" Grid.Column="1"
|
|
VerticalAlignment="Center" FontWeight="DemiBold"/>
|
|
<!-- Serial Number-->
|
|
<Label Content="Serial Num:" FontSize="11" Grid.Row="1" Grid.Column="0"
|
|
Padding="0 0 10 0" VerticalAlignment="Center"/>
|
|
<TextBlock Text="{Binding SerialNumber}" FontSize="12" Grid.Row="1" Grid.Column="1"
|
|
VerticalAlignment="Center"/>
|
|
</Grid>
|
|
</StackPanel>
|
|
</ControlTemplate>
|
|
<DataTemplate x:Key="HidDeviceComboBoxTemplate">
|
|
<Control x:Name="control" Focusable="False" Template="{StaticResource DroppedTemplate}"/>
|
|
<DataTemplate.Triggers>
|
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ComboBoxItem}}, Path=IsSelected}" Value="{x:Null}">
|
|
<Setter TargetName="control" Property="Template" Value="{StaticResource NotDroppedTemplate}" />
|
|
</DataTrigger>
|
|
</DataTemplate.Triggers>
|
|
</DataTemplate>
|
|
|
|
</StackPanel.Resources>
|
|
|
|
<Label Margin="10 0" VerticalAlignment="Center">Devices:</Label>
|
|
<ComboBox Width="190" x:Name="comboBoxHidDevices"
|
|
ItemsSource="{Binding Path=Devices}" SelectedItem="{Binding Path=SelectedDevice, Mode=TwoWay}"
|
|
VerticalContentAlignment="Center"
|
|
ItemTemplate="{StaticResource HidDeviceComboBoxTemplate}">
|
|
<!-- Auto reload hid devices when opening combobox -->
|
|
<XamlBehavioursWpf:Interaction.Triggers>
|
|
<XamlBehavioursWpf:EventTrigger EventName="DropDownOpened" SourceObject="{Binding ElementName=comboBoxHidDevices}">
|
|
<XamlBehavioursWpf:InvokeCommandAction Command="{Binding ReloadDevicesCommand}" />
|
|
</XamlBehavioursWpf:EventTrigger>
|
|
</XamlBehavioursWpf:Interaction.Triggers>
|
|
</ComboBox>
|
|
<Button Margin="5 0" Content="R" VerticalContentAlignment="Center"
|
|
Command="{Binding ReloadDevicesCommand}" Width="25"/>
|
|
|
|
<Label Margin="20 0 10 0" VerticalAlignment="Center" HorizontalAlignment="Center">Vendor ID:</Label>
|
|
<TextBox Width="50" VerticalContentAlignment="Center" Text="{Binding Path=VendorIdHex, Mode=TwoWay}" />
|
|
|
|
<Label Margin="20 0 10 0" VerticalAlignment="Center" HorizontalAlignment="Center">Product ID:</Label>
|
|
<TextBox Width="50" VerticalContentAlignment="Center" Text="{Binding Path=ProductIdHex, Mode=TwoWay}" />
|
|
|
|
<StackPanel Orientation="Horizontal">
|
|
<Label Margin="20 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="0">Serial Number:</Label>
|
|
<Label Margin="5 0 10 0" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="DarkGray" FontSize="12" Padding="0 0">(optional)</Label>
|
|
</StackPanel>
|
|
<TextBox Width="Auto" MinWidth="100" VerticalContentAlignment="Center" Text="{Binding Path=SerialNumber, Mode=TwoWay}" />
|
|
|
|
</StackPanel>
|
|
|
|
</DockPanel>
|
|
</UserControl>
|
|
|