aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-12-15 17:35:09 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-12-15 17:35:09 +0200
commitd92af8452acdde8595e16c379e8a17cd5d3efdbe (patch)
tree367ca670ea6234d4bbf0ba45ca4bb4e572b0fb68
parent24292197223caf2ffa1a771c38b2e2f7418ad03e (diff)
downloadTango-d92af8452acdde8595e16c379e8a17cd5d3efdbe.tar.gz
Tango-d92af8452acdde8595e16c379e8a17cd5d3efdbe.zip
Added support for chromium touch enabled on PPC.
Implemented real Cef Installer.
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BoundsObjects/KeyboardHandler.cs51
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml5
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/BrowserView.xaml.cs4
-rw-r--r--Software/Visual_Studio/PPC/Packages/Tango.PPC.Packages.CefInstaller/CefInstaller.cs25
-rw-r--r--Software/Visual_Studio/PPC/Packages/Tango.PPC.Packages.CefInstaller/Tango.PPC.Packages.CefInstaller.csproj2
-rw-r--r--Software/Visual_Studio/Tango.Touch/Keyboard/KeyboardView.cs2
6 files changed, 58 insertions, 31 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);
diff --git a/Software/Visual_Studio/PPC/Packages/Tango.PPC.Packages.CefInstaller/CefInstaller.cs b/Software/Visual_Studio/PPC/Packages/Tango.PPC.Packages.CefInstaller/CefInstaller.cs
index 61a4077fe..62a1d5717 100644
--- a/Software/Visual_Studio/PPC/Packages/Tango.PPC.Packages.CefInstaller/CefInstaller.cs
+++ b/Software/Visual_Studio/PPC/Packages/Tango.PPC.Packages.CefInstaller/CefInstaller.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -21,35 +22,29 @@ namespace Tango.PPC.Packages.CefInstaller
{
LogManager.Log("Downloading cef binaries...");
- var tempFolder = TemporaryManager.CreateFolder();
var zipFile = TemporaryManager.CreateImaginaryFile();
try
{
- for (int i = 0; i < 100; i++)
+ using (AutoFileDownloader downloader = new AutoFileDownloader("https://tangostorage.blob.core.windows.net/resources/CefSharpOutput.zip", "https://tango.azureedge.net/resources/CefSharpOutput.zip", zipFile))
{
- context.ReportProgress("Downloading cef binaries...", false, i, 100);
- Thread.Sleep(100);
- }
+ downloader.Progress += (x, e) =>
+ {
+ context.ReportProgress("Downloading cef binaries...", false, e.Current, e.Total);
+ };
- //using (AutoFileDownloader downloader = new AutoFileDownloader("", "", zipFile))
- //{
- // downloader.Progress += (x, e) =>
- // {
- // context.ReportProgress("Downloading cef binaries...", false, e.Current, e.Total);
- // };
+ downloader.Download().GetAwaiter().GetResult();
+ }
- // downloader.Download().GetAwaiter().GetResult();
- //}
+ ZipFile.ExtractToDirectory(zipFile, context.ApplicationManager.StartPath);
}
catch (Exception ex)
{
- LogManager.Log(ex, "Error downloading cef.");
+ LogManager.Log(ex, "Error installing cef binaries.");
throw;
}
finally
{
- tempFolder.Delete();
zipFile.Delete();
}
diff --git a/Software/Visual_Studio/PPC/Packages/Tango.PPC.Packages.CefInstaller/Tango.PPC.Packages.CefInstaller.csproj b/Software/Visual_Studio/PPC/Packages/Tango.PPC.Packages.CefInstaller/Tango.PPC.Packages.CefInstaller.csproj
index 42f996079..4cab8bab9 100644
--- a/Software/Visual_Studio/PPC/Packages/Tango.PPC.Packages.CefInstaller/Tango.PPC.Packages.CefInstaller.csproj
+++ b/Software/Visual_Studio/PPC/Packages/Tango.PPC.Packages.CefInstaller/Tango.PPC.Packages.CefInstaller.csproj
@@ -33,6 +33,8 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
+ <Reference Include="System.IO.Compression" />
+ <Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
diff --git a/Software/Visual_Studio/Tango.Touch/Keyboard/KeyboardView.cs b/Software/Visual_Studio/Tango.Touch/Keyboard/KeyboardView.cs
index 67203b669..3f9106089 100644
--- a/Software/Visual_Studio/Tango.Touch/Keyboard/KeyboardView.cs
+++ b/Software/Visual_Studio/Tango.Touch/Keyboard/KeyboardView.cs
@@ -350,7 +350,7 @@ namespace Tango.Touch.Keyboard
private void OnMouseDown(object sender, MouseOrTouchEventArgs e)
{
- if (e.OriginalSource.GetType().Name != "TextBoxView" && e.Source == _content_presenter && IsOpened)
+ if (e.OriginalSource.GetType().Name != "TextBoxView" && e.Source == _content_presenter && IsOpened && OutputMode == KeyboardOutputMode.Wpf)
{
IsOpened = false;
}