From 217fcb79fa32f858a06d8200697ddee7c5da625a Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 12 Dec 2019 01:32:37 +0200 Subject: Added IsAfterReset to ConnectionResponse PMR. Started working on PPC.Browser Module !!! --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes .../PMR/Messages/Connection/ConnectResponse.proto | 1 + .../PPC/Modules/Tango.PPC.Browser/App.xaml | 11 ++ .../Tango.PPC.Browser/BoundsObjects/MainBound.cs | 39 +++++ .../PPC/Modules/Tango.PPC.Browser/BrowserModule.cs | 92 ++++++++++ .../Modules/Tango.PPC.Browser/CefSharpOutput.zip | Bin 0 -> 143444091 bytes .../Modules/Tango.PPC.Browser/Images/browser.png | Bin 0 -> 2539 bytes .../Tango.PPC.Browser/Properties/AssemblyInfo.cs | 20 +++ .../Properties/Resources.Designer.cs | 63 +++++++ .../Tango.PPC.Browser/Properties/Resources.resx | 117 +++++++++++++ .../Properties/Settings.Designer.cs | 26 +++ .../Tango.PPC.Browser/Properties/Settings.settings | 7 + .../PPC/Modules/Tango.PPC.Browser/Scripts/main.js | 21 +++ .../Tango.PPC.Browser/Tango.PPC.Browser.csproj | 187 +++++++++++++++++++++ .../Modules/Tango.PPC.Browser/ViewModelLocator.cs | 32 ++++ .../Tango.PPC.Browser/ViewModels/MainViewVM.cs | 56 ++++++ .../Modules/Tango.PPC.Browser/Views/MainView.xaml | 15 ++ .../Tango.PPC.Browser/Views/MainView.xaml.cs | 79 +++++++++ .../PPC/Modules/Tango.PPC.Browser/app.config | 90 ++++++++++ .../PPC/Modules/Tango.PPC.Browser/packages.config | 11 ++ Software/Visual_Studio/PPC/Tango.PPC.UI/App.config | 3 + .../Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs | 6 + .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 10 +- .../Tango.Emulations/Emulators/MachineEmulator.cs | 2 +- .../Tango.Touch/Keyboard/KeyboardOutputMode.cs | 14 ++ .../Tango.Touch/Keyboard/KeyboardView.cs | 56 ++++-- .../Tango.Touch/Keyboard/KeyboardView.xaml | 2 +- .../Tango.Touch/Keyboard/TouchKeyboard.cs | 10 +- .../Visual_Studio/Tango.Touch/Tango.Touch.csproj | 3 +- Software/Visual_Studio/Tango.sln | 55 +++++- 31 files changed, 1003 insertions(+), 25 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/App.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BoundsObjects/MainBound.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BrowserModule.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/CefSharpOutput.zip create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Images/browser.png create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Resources.resx create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Settings.settings create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Scripts/main.js create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Tango.PPC.Browser.csproj create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModelLocator.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModels/MainViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/MainView.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/MainView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/app.config create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/packages.config create mode 100644 Software/Visual_Studio/Tango.Touch/Keyboard/KeyboardOutputMode.cs (limited to 'Software') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 41f7704e8..9ec032e48 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index efb976613..3e5056420 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Connection/ConnectResponse.proto b/Software/PMR/Messages/Connection/ConnectResponse.proto index e6c178083..177add9a5 100644 --- a/Software/PMR/Messages/Connection/ConnectResponse.proto +++ b/Software/PMR/Messages/Connection/ConnectResponse.proto @@ -8,4 +8,5 @@ option java_package = "com.twine.tango.pmr.connection"; message ConnectResponse { DeviceInformation DeviceInformation = 1; + bool IsAfterReset = 2; } \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/App.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/App.xaml new file mode 100644 index 000000000..576597134 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/App.xaml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BoundsObjects/MainBound.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BoundsObjects/MainBound.cs new file mode 100644 index 000000000..8743fa054 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BoundsObjects/MainBound.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Tango.Touch.Keyboard; + +namespace Tango.PPC.Browser.BoundsObjects +{ + public class MainBound + { + public void openKeyboard(String inputType) + { + Application.Current.Dispatcher.BeginInvoke(new Action(() => + { + switch (inputType) + { + case "search": + KeyboardView.Keyboard.ActionKeyMode = KeyboardActionKeyMode.Go; + break; + default: + KeyboardView.Keyboard.ActionKeyMode = KeyboardActionKeyMode.Next; + break; + } + KeyboardView.Default.IsOpened = true; + })); + } + + public void closeKeyboard() + { + Application.Current.Dispatcher.BeginInvoke(new Action(() => + { + KeyboardView.Default.IsOpened = false; + })); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BrowserModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BrowserModule.cs new file mode 100644 index 000000000..51384ae54 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/BrowserModule.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.PPC.Common; +using Tango.PPC.Browser.Views; +using Tango.SharedUI.Helpers; + +namespace Tango.PPC.Browser +{ + /// + /// Represents a PPC . + /// + /// + [PPCModule(10)] + public class BrowserModule : PPCModuleBase + { + /// + /// Initializes a new instance of the class. + /// + public BrowserModule() + { + IsVisibleInMenu = true; + } + + /// + /// Gets the module name. + /// + public override string Name + { + get + { + return "Browser"; + } + } + + /// + /// Gets the module description. + /// + public override string Description + { + get + { + return "Browser module"; + } + } + + /// + /// Gets the module cover image. + /// + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/browser.png"); + } + } + + /// + /// Gets the module entry point view type. + /// + public override Type MainViewType + { + get + { + return typeof(MainView); + } + } + + /// + /// Gets the permission required to see and load this module. + /// + public override Permissions Permission + { + get + { + return Permissions.RunPPC; + } + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public override void Dispose() + { + //Dispose module here... + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/CefSharpOutput.zip b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/CefSharpOutput.zip new file mode 100644 index 000000000..8c68cedb7 Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/CefSharpOutput.zip differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Images/browser.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Images/browser.png new file mode 100644 index 000000000..ebb975b6f Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Images/browser.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..70edee491 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango Web Browser Module")] +[assembly: AssemblyVersion("2.0.1.1407")] + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Resources.Designer.cs new file mode 100644 index 000000000..01c0a8851 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.PPC.Browser.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.PPC.Browser.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Resources.resx b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Settings.Designer.cs new file mode 100644 index 000000000..f464e258d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.PPC.Browser.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Settings.settings b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Scripts/main.js b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Scripts/main.js new file mode 100644 index 000000000..c43e0e272 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Scripts/main.js @@ -0,0 +1,21 @@ +(async function () { + await CefSharp.BindObjectAsync("boundAsync", "bound"); + + var inputs = document.getElementsByTagName('input'); + var i = 0; + + do { + + var type = inputs[i].type; + + if (type == 'text' || type == 'email' || type == 'password' || type == 'search' || type == 'date' || type == 'url' || type == 'time' || type == 'tel' || type == 'number') { + inputs[i].onfocus = function () { + boundAsync.openKeyboard(type); + } + inputs[i].onblur = function () { + boundAsync.closeKeyboard(); + } + } + } + while (inputs[++i]) +})(); \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Tango.PPC.Browser.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Tango.PPC.Browser.csproj new file mode 100644 index 000000000..eb85fefa5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Tango.PPC.Browser.csproj @@ -0,0 +1,187 @@ + + + + + + + + + true + Debug + AnyCPU + {F02EAA84-AD59-465B-99A2-4422C13BFB72} + library + Tango.PPC.Browser + Tango.PPC.Browser + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + + + + true + full + false + ..\..\..\Build\PPC\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + True + + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll + + + ..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll + + + + + + ..\..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + + + GlobalVersionInfo.cs + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + MainView.xaml + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {b112d89a-a106-41ae-a0c1-4abc84c477f5} + Tango.DragAndDrop + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {fd86424c-6e84-491b-8df9-3d0f5c236a2a} + Tango.Touch + + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + + + {0be74eee-22cb-4dba-b896-793b9e1a3ac0} + Tango.PPC.Common + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModelLocator.cs new file mode 100644 index 000000000..30f936433 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModelLocator.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.Browser.ViewModels; + +namespace Tango.PPC.Browser +{ + public static class ViewModelLocator + { + /// + /// Initializes a new instance of the ViewModelLocator class. + /// + static ViewModelLocator() + { + TangoIOC.Default.Register(); + } + + /// + /// Gets the main view VM. + /// + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..afea97f73 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/ViewModels/MainViewVM.cs @@ -0,0 +1,56 @@ +using CefSharp; +using CefSharp.Wpf; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; +using Tango.Touch.Keyboard; + +namespace Tango.PPC.Browser.ViewModels +{ + /// + /// Represents the main view VM and entry point for . + /// + /// + public class MainViewVM : PPCViewModel + { + public MainViewVM() + { + try + { + var settings = new CefSettings(); + settings.BrowserSubprocessPath = @"x86\CefSharp.BrowserSubprocess.exe"; + settings.UserAgent = "Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"; + + Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null); + } + catch (Exception ex) + { + //Log Here Not Throw! + throw; + } + } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + KeyboardView.Default.OutputMode = KeyboardOutputMode.Windows; + } + + public override void OnNavigatedFrom() + { + base.OnNavigatedFrom(); + KeyboardView.Default.OutputMode = KeyboardOutputMode.Wpf; + } + + /// + /// Called when the application has been started + /// + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/MainView.xaml new file mode 100644 index 000000000..903e21cce --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/MainView.xaml @@ -0,0 +1,15 @@ + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/MainView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/MainView.xaml.cs new file mode 100644 index 000000000..917d16e49 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Views/MainView.xaml.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using System.Windows.Threading; +using CefSharp; +using CefSharp.Wpf; +using Tango.Core.Helpers; +using Tango.PPC.Browser.BoundsObjects; +using Tango.Touch.Keyboard; + +namespace Tango.PPC.Browser.Views +{ + /// + /// Interaction logic for MainView.xaml + /// + public partial class MainView : UserControl + { + private DispatcherTimer _timer; + + public MainView() + { + InitializeComponent(); + + _timer = new DispatcherTimer(); + _timer.Tick += _timer_Tick; + _timer.Interval = TimeSpan.FromSeconds(2); + _timer.Stop(); + + Browser.JavascriptObjectRepository.Register("boundAsync", new MainBound(), true); + Browser.FrameLoadEnd += Browser_FrameLoadEnd; + + KeyboardView.Default.KeyboardOpened += Default_KeyboardOpened; + KeyboardView.Default.KeyboardClosed += Default_KeyboardClosed; + } + + private void Default_KeyboardClosed(object sender, EventArgs e) + { + Debug.WriteLine("Closed"); + Browser.VerticalAlignment = VerticalAlignment.Stretch; + Browser.Height = double.NaN; + } + + private void Default_KeyboardOpened(object sender, EventArgs e) + { + Debug.WriteLine("Opened"); + Browser.VerticalAlignment = VerticalAlignment.Top; + Browser.Height = 780; + } + + private void _timer_Tick(object sender, EventArgs e) + { + _timer.Stop(); + + Dispatcher.BeginInvoke(new Action(() => + { + var script = EmbeddedResourceHelper.GetEmbeddedResourceText("Tango.PPC.Browser.Scripts.main.js"); + Browser.ExecuteScriptAsync(script); + })); + } + + private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e) + { + _timer.Stop(); + _timer.Start(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/app.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/app.config new file mode 100644 index 000000000..cf33970a7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/app.config @@ -0,0 +1,90 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/packages.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/packages.config new file mode 100644 index 000000000..f7fe1b9a2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config index 77255b814..a55b50e5b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config @@ -10,6 +10,9 @@ + + +