Allow setting lightbar mode in GUI

Now Witcher 3 lightbar functionality is usable
This commit is contained in:
Travis Nickles 2020-02-22 19:58:34 -06:00
parent 653b7424ee
commit 967c919086
2 changed files with 136 additions and 70 deletions

View File

@ -600,6 +600,15 @@
<TabItem Header="Lightbar">
<StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="Mode:" />
<ComboBox x:Name="lightbarModeCombo" Width="160" SelectedIndex="{Binding LightbarModeIndex, FallbackValue=0}"
VerticalContentAlignment="Center" Margin="10,0,0,0">
<ComboBoxItem Content="Normal" />
<ComboBoxItem Content="Passthru" />
</ComboBox>
</StackPanel>
<StackPanel Visibility="{Binding DS4WinLightVisible,Mode=OneWay}">
<StackPanel Orientation="Horizontal">
<GroupBox x:Name="colorGB" Header="{lex:Loc Color}" Padding="4">
<StackPanel>
@ -681,6 +690,7 @@
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
</TabItem>
<TabItem Header="Gyro">

View File

@ -23,6 +23,58 @@ namespace DS4WinWPF.DS4Forms.ViewModels
private ImageBrush lightbarImgBrush = new ImageBrush();
private SolidColorBrush lightbarColBrush = new SolidColorBrush();
public int LightbarModeIndex
{
get
{
int index = 0;
switch(Global.LightbarSettingsInfo[device].Mode)
{
case LightbarMode.DS4Win:
index = 0; break;
case LightbarMode.Passthru:
index = 1; break;
default: break;
}
return index;
}
set
{
LightbarMode temp = LightbarMode.DS4Win;
switch(value)
{
case 0:
temp = LightbarMode.DS4Win; break;
case 1:
temp = LightbarMode.Passthru; break;
default: break;
}
Global.LightbarSettingsInfo[device].Mode = temp;
LightbarModeIndexChanged?.Invoke(this, EventArgs.Empty);
}
}
public event EventHandler LightbarModeIndexChanged;
public Visibility DS4WinLightVisible
{
get
{
Visibility temp = Visibility.Visible;
switch(Global.LightbarSettingsInfo[device].Mode)
{
case LightbarMode.DS4Win:
temp = Visibility.Visible; break;
case LightbarMode.Passthru:
temp = Visibility.Collapsed; break;
}
return temp;
}
}
public event EventHandler DS4WinLightVisibleChanged;
public System.Windows.Media.Brush LightbarBrush
{
get
@ -602,7 +654,6 @@ namespace DS4WinWPF.DS4Forms.ViewModels
}
}
public OutContType ContType
{
get => Global.OutContType[device];
@ -1495,6 +1546,11 @@ namespace DS4WinWPF.DS4Forms.ViewModels
{
OutputMouseSpeed = CalculateOutputMouseSpeed(ButtonMouseSensitivity);
};
LightbarModeIndexChanged += (sender, args) =>
{
DS4WinLightVisibleChanged?.Invoke(this, EventArgs.Empty);
};
}
private void ProfileSettingsViewModel_MainColorChanged(object sender, EventArgs e)