From d92af8452acdde8595e16c379e8a17cd5d3efdbe Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 15 Dec 2019 17:35:09 +0200 Subject: Added support for chromium touch enabled on PPC. Implemented real Cef Installer. --- .../BoundsObjects/KeyboardHandler.cs | 51 ++++++++++++++++------ .../Tango.PPC.Browser/Views/BrowserView.xaml | 5 ++- .../Tango.PPC.Browser/Views/BrowserView.xaml.cs | 4 ++ 3 files changed, 45 insertions(+), 15 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BoundsObjects/KeyboardHandler.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BoundsObjects/KeyboardHandler.cs index 50df8ae0c..3c608a518 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BoundsObjects/KeyboardHandler.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BoundsObjects/KeyboardHandler.cs @@ -6,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows; using Tango.PPC.Browser.Attributes; +using Tango.PPC.Browser.Views; using Tango.PPC.Common.Helpers; using Tango.Touch.Keyboard; @@ -14,28 +15,52 @@ namespace Tango.PPC.Browser.BoundsObjects [BoundObject("keyboard", "keyboard.js")] public class KeyboardHandler { + private DateTime _lastTime; + + public KeyboardHandler() + { + _lastTime = DateTime.Now; + } + public void openKeyboard(String inputType) { - Application.Current.Dispatcher.BeginInvoke(new Action(() => + if (DateTime.Now > _lastTime.AddMilliseconds(1000)) { - switch (inputType) + _lastTime = DateTime.Now; + + Application.Current.Dispatcher.BeginInvoke(new Action(async () => { - case "search": - KeyboardHelper.OpenKeyboard(KeyboardActionKeyMode.Go); - break; - default: - KeyboardHelper.OpenKeyboard(KeyboardActionKeyMode.Next); - break; - } - })); + switch (inputType) + { + case "search": + KeyboardHelper.OpenKeyboard(KeyboardActionKeyMode.Go); + break; + default: + KeyboardHelper.OpenKeyboard(KeyboardActionKeyMode.Next); + break; + } + + + await Task.Delay(50); + BrowserView.Instance.btnGo.Focus(); + await Task.Delay(50); + BrowserView.Instance.Browser.Focus(); + Debug.WriteLine("Focus"); + })); + } } public void closeKeyboard() { - Application.Current.Dispatcher.BeginInvoke(new Action(() => + if (DateTime.Now > _lastTime.AddMilliseconds(1000)) { - KeyboardHelper.CloseKeyboard(); - })); + _lastTime = DateTime.Now; + + Application.Current.Dispatcher.BeginInvoke(new Action(() => + { + KeyboardHelper.CloseKeyboard(); + })); + } } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml index 6e2076c98..ce28d660e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:vm="clr-namespace:Tango.PPC.Browser.ViewModels" xmlns:wpf="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf" + xmlns:experimental="clr-namespace:CefSharp.Wpf.Experimental;assembly=CefSharp.Wpf" xmlns:global="clr-namespace:Tango.PPC.Browser" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch" @@ -15,7 +16,7 @@ - + @@ -54,7 +55,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml.cs index cdba301ed..e7fe1ca27 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml.cs @@ -34,6 +34,8 @@ namespace Tango.PPC.Browser.Views { public event EventHandler AddressChanged; + public static BrowserView Instance { get; set; } + public BrowserView() { try @@ -51,6 +53,8 @@ namespace Tango.PPC.Browser.Views InitializeComponent(); + Instance = this; + TangoIOC.Default.Register(this); Helpers.BoundObjectsHelper.RegisterAllBoundObjects(Browser, Dispatcher); -- cgit v1.3.1