added stop button in UI

main
Jonas Arnold 4 years ago
parent 9cbe5bb9b9
commit 77b3fd7ae6
  1. 8
      ADIS_Csharp/RobotClientWpf/Views/MainView.xaml
  2. 5
      ADIS_Csharp/RobotClientWpf/Views/MainView.xaml.cs

@ -12,7 +12,7 @@
<ColumnDefinition Width="200"/> <ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="150"/> <RowDefinition Height="200"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
@ -45,6 +45,7 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="25"/> <RowDefinition Height="25"/>
@ -79,8 +80,9 @@
</Image.Source> </Image.Source>
</Image> </Image>
</Button> </Button>
<Label Grid.Row="2" Grid.ColumnSpan="3" FontWeight="Bold" FontSize="12" Margin="5 0">Control with Arrow keys</Label> <Button Grid.Row="2" Grid.ColumnSpan="3" x:Name="btnStopMove" Content="Stop" Margin="5" Click="btnStopMove_Click"/>
<Label Grid.Row="3" Grid.ColumnSpan="3" FontWeight="Bold" FontSize="12" Margin="5 0">Stop with End key</Label> <Label Grid.Row="3" Grid.ColumnSpan="3" FontWeight="Bold" FontSize="12" Margin="5 0">Control with Arrow keys</Label>
<Label Grid.Row="4" Grid.ColumnSpan="3" FontWeight="Bold" FontSize="12" Margin="5 0">Stop with End key</Label>
</Grid> </Grid>
</GroupBox> </GroupBox>
</DockPanel> </DockPanel>

@ -68,6 +68,11 @@ namespace RobotClientWpf.Views
this.challenge?.RobotMobile.Movement.Turn(-TURN_ANGLE_PER_CLICK); this.challenge?.RobotMobile.Movement.Turn(-TURN_ANGLE_PER_CLICK);
} }
private void btnStopMove_Click(object sender, System.Windows.RoutedEventArgs e)
{
this.challenge?.RobotMobile.Movement.Stop();
}
public void HandleKeyDownEvent(object sender, KeyEventArgs e) public void HandleKeyDownEvent(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Up) if (e.Key == Key.Up)

Loading…
Cancel
Save