diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser')
3 files changed, 45 insertions, 15 deletions
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 @@ <DockPanel> <Border DockPanel.Dock="Top" Padding="10" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0 0 0 1" Visibility="{Binding DisplayAddressBar,Converter={StaticResource BooleanToVisibilityConverter}}"> <DockPanel> - <touch:TouchButton Command="{Binding GoCommand}" DockPanel.Dock="Right" Padding="10" Width="150" CornerRadius="20" Margin="20 0 0 0"> + <touch:TouchButton x:Name="btnGo" Command="{Binding GoCommand}" DockPanel.Dock="Right" Padding="10" Width="150" CornerRadius="20" Margin="20 0 0 0"> <touch:TouchIcon Icon="ArrowRightBold" Height="20" /> </touch:TouchButton> <Grid> @@ -54,7 +55,7 @@ </Border> <Grid> - <wpf:ChromiumWebBrowser x:Name="Browser" /> + <experimental:ChromiumWebBrowserWithTouchSupport x:Name="Browser" /> <Grid Background="White" IsHitTestVisible="False" Visibility="Hidden" x:Name="gridError"> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <touch:TouchIcon Icon="Alert" Foreground="{StaticResource TangoGrayTextBrush}" Width="100" Height="100" /> 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<string> 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<IBrowserView>(this); Helpers.BoundObjectsHelper.RegisterAllBoundObjects(Browser, Dispatcher); |
