Skip to content

Commit

Permalink
Added the possibility to add a website by pressing Enter (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Dec 28, 2023
1 parent 79296ad commit 24c4d80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion InternetTest/InternetTest/Pages/DownDetectorPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
Background="Transparent"
BorderThickness="0"
FontWeight="Bold"
Foreground="{Binding Source={StaticResource DarkGray}}" />
Foreground="{Binding Source={StaticResource DarkGray}}"
Keyboard.KeyUp="WebsiteTxt_KeyUp" />
<Button
x:Name="ClearBtn"
Grid.Column="1"
Expand Down
8 changes: 8 additions & 0 deletions InternetTest/InternetTest/Pages/DownDetectorPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,13 @@ private void IntervalTxt_PreviewTextInput(object sender, TextCompositionEventArg
Regex regex = new("[^0-9]+");
e.Handled = regex.IsMatch(e.Text);
}

private void WebsiteTxt_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
AddBtn_Click(sender, e);
}
}
}
}

0 comments on commit 24c4d80

Please sign in to comment.