Make Tilt Controls buttons work

This commit is contained in:
Travis Nickles 2019-12-25 14:49:18 -06:00
parent e69816b290
commit b5ff9c65b8
3 changed files with 20 additions and 8 deletions

View File

@ -673,23 +673,23 @@
<StackPanel x:Name="gyroControlsPanel" Visibility="Visible"> <StackPanel x:Name="gyroControlsPanel" Visibility="Visible">
<StackPanel Orientation="Horizontal" Margin="0,0,0,8"> <StackPanel Orientation="Horizontal" Margin="0,0,0,8">
<Button x:Name="gyroZNBtn" Content="Tilt Up" Width="100"/> <Button x:Name="gyroZNBtn" Content="Tilt Up" Width="100" Tag="33" Click="TiltControlsButton_Click" />
<Label x:Name="gyroZNLb" Content="{Binding MappingName,FallbackValue=Unassigned}" /> <Label x:Name="gyroZNLb" Content="{Binding MappingName,FallbackValue=Unassigned}" />
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,8"> <StackPanel Orientation="Horizontal" Margin="0,0,0,8">
<Button x:Name="gyroZPBtn" Content="Tilt Down" Width="100"/> <Button x:Name="gyroZPBtn" Content="Tilt Down" Width="100" Tag="32" Click="TiltControlsButton_Click" />
<Label x:Name="gyroZPLb" Content="{Binding MappingName,FallbackValue=Unassigned}" /> <Label x:Name="gyroZPLb" Content="{Binding MappingName,FallbackValue=Unassigned}" />
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,8"> <StackPanel Orientation="Horizontal" Margin="0,0,0,8">
<Button x:Name="gyroXNBtn" Content="Tilt Left" Width="100"/> <Button x:Name="gyroXPBtn" Content="Tilt Left" Width="100" Tag="30" Click="TiltControlsButton_Click" />
<Label x:Name="gyroXNLb" Content="{Binding MappingName,FallbackValue=Unassigned}" /> <Label x:Name="gyroXLb" Content="{Binding MappingName,FallbackValue=Unassigned}" />
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,8"> <StackPanel Orientation="Horizontal" Margin="0,0,0,8">
<Button x:Name="gyroXPBtn" Content="Tilt Right" Width="100"/> <Button x:Name="gyroXNBtn" Content="Tilt Right" Width="100" Tag="31" Click="TiltControlsButton_Click" />
<Label x:Name="gyroXLb" Content="{Binding MappingName,FallbackValue=Unassigned}" /> <Label x:Name="gyroXNLb" Content="{Binding MappingName,FallbackValue=Unassigned}" />
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,8"> <StackPanel Orientation="Horizontal" Margin="0,0,0,8">

View File

@ -1243,5 +1243,17 @@ namespace DS4WinWPF.DS4Forms
conReadingsUserCon.EnableControl(false); conReadingsUserCon.EnableControl(false);
} }
} }
private void TiltControlsButton_Click(object sender, RoutedEventArgs e)
{
Button btn = sender as Button;
DS4Controls control = (DS4Controls)Convert.ToInt32(btn.Tag);
MappedControl mpControl = mappingListVM.ControlMap[control];
BindingWindow window = new BindingWindow(deviceNum, mpControl.Setting);
window.Owner = App.Current.MainWindow;
window.ShowDialog();
mpControl.UpdateMappingName();
UpdateHighlightLabel(mpControl);
}
} }
} }

View File

@ -67,8 +67,8 @@ namespace DS4WinWPF.DS4Forms.ViewModels
mappings.Add(new MappedControl(devIndex, DS4Controls.GyroZNeg, "Tilt Up", devType)); mappings.Add(new MappedControl(devIndex, DS4Controls.GyroZNeg, "Tilt Up", devType));
mappings.Add(new MappedControl(devIndex, DS4Controls.GyroZPos, "Tilt Down", devType)); mappings.Add(new MappedControl(devIndex, DS4Controls.GyroZPos, "Tilt Down", devType));
mappings.Add(new MappedControl(devIndex, DS4Controls.GyroXNeg, "Tilt Left", devType)); mappings.Add(new MappedControl(devIndex, DS4Controls.GyroXPos, "Tilt Left", devType));
mappings.Add(new MappedControl(devIndex, DS4Controls.GyroXPos, "Tilt Right", devType)); mappings.Add(new MappedControl(devIndex, DS4Controls.GyroXNeg, "Tilt Right", devType));
mappings.Add(new MappedControl(devIndex, DS4Controls.SwipeUp, "Swipe Up", devType)); mappings.Add(new MappedControl(devIndex, DS4Controls.SwipeUp, "Swipe Up", devType));
mappings.Add(new MappedControl(devIndex, DS4Controls.SwipeDown, "Swipe Down", devType)); mappings.Add(new MappedControl(devIndex, DS4Controls.SwipeDown, "Swipe Down", devType));