From 6f7f2bbb7c4e7d62ce519adada0cf1458ef913a8 Mon Sep 17 00:00:00 2001 From: jesusalvino <96534278+jesusalvino@users.noreply.github.com> Date: Thu, 4 May 2023 11:27:22 -0500 Subject: [PATCH] Dyn 5444 splash screen keyboard (#13959) * Focus and get the Enter key ready * spacing * Closing on Esc key press --- .../Views/SplashScreen/SplashScreen.xaml.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs b/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs index a5d6274485d..e2bb351f494 100644 --- a/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs +++ b/src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs @@ -4,6 +4,7 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Windows; +using System.Windows.Input; using System.Xml.Serialization; using Dynamo.Configuration; using Dynamo.Controls; @@ -144,8 +145,17 @@ private void WebView_NavigationCompleted(object sender, CoreWebView2NavigationCo webView.NavigationCompleted -= WebView_NavigationCompleted; } OnRequestDynamicSplashScreen(); + + this.webView.Focus(); + System.Windows.Forms.SendKeys.SendWait("{TAB}"); + webView.KeyDown += WebView_KeyDown; } + private void WebView_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) + { + if (e.Key == Key.Escape) + CloseWindow(); + } /// /// Request to close SplashScreen. /// @@ -472,6 +482,7 @@ protected override void OnClosed(EventArgs e) base.OnClosed(e); DynamoModel.RequestUpdateLoadBarStatus -= DynamoModel_RequestUpdateLoadBarStatus; + webView.KeyDown -= WebView_KeyDown; webView.Dispose(); webView = null;