Skip to content

Commit

Permalink
Added enter key handling in text boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
Yen committed Mar 13, 2016
1 parent 315e31e commit f4b3d45
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Client/Client/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="osuInstallationInput" Margin="4" TextWrapping="Wrap" TextChanged="osuInstallationInput_TextChanged" Text="text for update event" VerticalAlignment="Center"/>
<TextBox x:Name="osuInstallationInput" Margin="4" TextWrapping="Wrap" TextChanged="osuInstallationInput_TextChanged" Text="text for update event" VerticalAlignment="Center" KeyDown="osuInstallationInput_KeyDown"/>
<Button x:Name="osuInstallationConfirm" Content="Confirm" Grid.Column="1" Margin="4" Click="osuInstallationConfirm_Click" IsEnabled="False" Width="120" VerticalAlignment="Center"/>
</Grid>
<Label x:Name="osuInstallationStatus" Content="osu installation status" Margin="4" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Top"/>
Expand Down Expand Up @@ -100,9 +100,9 @@
<CheckBox x:Name="checkCTB" Content="CTB" Grid.Row="3" VerticalAlignment="Center" Grid.Column="2" Margin="0" HorizontalAlignment="Left"/>
<CheckBox x:Name="checkMania" Content="Mania" Grid.Row="3" VerticalAlignment="Center" Grid.Column="3" Margin="0" HorizontalAlignment="Left"/>
<Label Content="Search terms" Margin="0" VerticalAlignment="Top" Grid.ColumnSpan="4" Grid.Row="4" HorizontalAlignment="Center"/>
<TextBox x:Name="searchTermsBox" Grid.ColumnSpan="4" Margin="0" Grid.Row="5" TextWrapping="Wrap" VerticalAlignment="Center"/>
<TextBox x:Name="searchTermsBox" Grid.ColumnSpan="4" Margin="0" Grid.Row="5" TextWrapping="Wrap" VerticalAlignment="Center" KeyDown="searchTermsBox_KeyDown"/>
</Grid>
<Button x:Name="startStopButton" Content="Start" Margin="4" Grid.Row="3" VerticalAlignment="Bottom" Click="startStopButton_Click"/>
<Button x:Name="startStopButton" Content="Start" Margin="4" Grid.Row="3" VerticalAlignment="Bottom" Click="startStopButton_Click" />
<ListView x:Name="processingSongsListBox" Margin="4" Grid.Row="1">
<ListView.View>
<GridView>
Expand Down
15 changes: 15 additions & 0 deletions Client/Client/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml;
using System.Xml.Linq;
Expand Down Expand Up @@ -610,5 +611,19 @@ private void clearCompletedButton_Click(object sender, RoutedEventArgs e)
_processingSongs.Remove(s);
}
}

private void searchTermsBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
if (startStopButton.IsEnabled)
startStopButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
}

private void osuInstallationInput_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
if (osuInstallationConfirm.IsEnabled)
osuInstallationConfirm.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
}
}
}
4 changes: 2 additions & 2 deletions Client/Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.2.0")]
[assembly: AssemblyFileVersion("1.6.2.0")]
[assembly: AssemblyVersion("1.6.3.0")]
[assembly: AssemblyFileVersion("1.6.3.0")]

0 comments on commit f4b3d45

Please sign in to comment.