Merge branch 'develop' of https://bitbucket.org/ncarminati/cms_step into develop

This commit is contained in:
Paolo Possanzini
2017-12-07 10:06:37 +01:00
27 changed files with 1121 additions and 656 deletions
+2
View File
@@ -34,6 +34,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -48,6 +49,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SubModels\Client.cs" />
<Compile Include="SubModels\Connection.cs" />
<Compile Include="SubModels\Software.cs" />
<Compile Include="SubModels\VendorHmi.cs" />
</ItemGroup>
<ItemGroup>
+17 -1
View File
@@ -15,6 +15,7 @@
<xs:all>
<xs:element name="Id" minOccurs='1' maxOccurs='1'/>
<xs:element name="Url" minOccurs='1' maxOccurs='1'/>
<xs:element name="DeleteCahceFolderOnStartup" minOccurs='1' maxOccurs='1'/>
</xs:all>
</xs:complexType>
</xs:element>
@@ -25,7 +26,22 @@
<xs:element name="Type" minOccurs='1' maxOccurs='1'/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:element>
<xs:element name="ExtSoftware">
<xs:complexType>
<xs:sequence>
<xs:element name="Software" minOccurs='0' maxOccurs='15'>
<xs:complexType>
<xs:all>
<xs:element name="Path" minOccurs='1' maxOccurs='1'/>
<xs:element name="LongName" minOccurs='1' maxOccurs='1'/>
<xs:element name="ShortName" minOccurs='1' maxOccurs='1'/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
+2
View File
@@ -6,12 +6,14 @@ using System.Threading.Tasks;
namespace Client.Config
{
public static class Config
{
public static SubModels.Client ClientConfig;
public static SubModels.Connection ConnectionConfig;
public static SubModels.VendorHmi VendorHmiConfig;
public static SubModels.Software[] ExtSoftwaresConfig { get; set; }
}
}
+19 -1
View File
@@ -6,9 +6,27 @@
<Connection>
<Url>http://localhost:9000/index.html</Url>
<Id>1</Id>
<DeleteCahceFolderOnStartup>false</DeleteCahceFolderOnStartup>
</Connection>
<VendorHmi>
<Enabled>true</Enabled>
<Enabled>false</Enabled>
<Type>1</Type>
</VendorHmi>
<ExtSoftware>
<Software>
<LongName>Calculator</LongName>
<ShortName>CAL</ShortName>
<Path>C:\Windows\System32\calc.exe</Path>
</Software>
<Software>
<LongName>NotePad</LongName>
<ShortName>NP</ShortName>
<Path>C:\Windows\System32\notepad.exe</Path>
</Software>
<Software>
<LongName>MsPaint</LongName>
<ShortName>PA</ShortName>
<Path>C:\Windows\System32\mspaint.exe</Path>
</Software>
</ExtSoftware>
</Config>
+78 -5
View File
@@ -2,6 +2,8 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -16,16 +18,15 @@ namespace Client.Config
public static void ReadStartupConfig()
{
//Read Exe Folder
String XmlConfigPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
// Read validation file
XmlSchemaSet readerSettings = new XmlSchemaSet();
// Add Schema
readerSettings.Add(null, XmlConfigPath + "\\" + Constants.STARTUP_CONFIG_SCHEMA_PATH);
readerSettings.Add(null, Constants.STARTUP_CONFIG_SCHEMA_PATH);
// Open file reader
XDocument xmlConfigFile = XDocument.Load(XmlConfigPath + "\\" + Constants.STARTUP_CONFIG_PATH);
XDocument xmlConfigFile = XDocument.Load(Constants.STARTUP_CONFIG_PATH);
// Validate file
xmlConfigFile.Validate(readerSettings, ValidationHandler);
@@ -42,7 +43,8 @@ namespace Client.Config
.Select(x => new SubModels.Connection()
{
Url = ValidateUrl(x.Element("Url").Value),
Id = ValidateClientID(x.Element("Id").Value)
Id = ValidateClientID(x.Element("Id").Value),
DeleteCahceFolderOnStartup = ValidateDelCache(x.Element("DeleteCahceFolderOnStartup").Value),
}).FirstOrDefault();
Config.VendorHmiConfig = xmlConfigFile
@@ -53,6 +55,18 @@ namespace Client.Config
Type = ValidateNcType(x.Element("Type").Value)
}).FirstOrDefault();
Config.ExtSoftwaresConfig = xmlConfigFile
.Descendants(Constants.EXTSFT_CONFIG_KEY)
.Elements("Software")
.Select(x => new SubModels.Software()
{
Path = ValidateSFTPath(x.Element("Path").Value),
LongName = ValidateSFTLName(x.Element("LongName").Value),
ShortName = ValidateSFTSName(x.Element("ShortName").Value),
IconBase64 = ExtractBase64Icon(x.Element("Path").Value)
}).ToArray();
// Read ARGS Config
if (!String.IsNullOrWhiteSpace(Arguments.Url))
@@ -141,6 +155,65 @@ namespace Client.Config
throw new Exception(@"Configuration Error: ""Connection - Id"" is not a valid Id of CMS-Client");
}
private static Boolean ValidateDelCache(String value)
{
Boolean DelCache;
if (Boolean.TryParse(value, out DelCache))
return DelCache;
else
throw new Exception(@"Configuration Error: ""Connection - DeleteCahceFolderOnStartup"" is not a valid Boolean Type");
}
private static String ValidateSFTPath(String value)
{
if(File.Exists(value))
return value;
else
throw new Exception(@"Configuration Error: File """+ value + @""" not found");
}
private static String ValidateSFTSName(String value)
{
if (!String.IsNullOrEmpty(value))
{
if (value.Count() <= 3)
return value;
else
throw new Exception(@"Configuration Error: Short Name """ + value + @""" cannot be over 3 Letters");
}
else
throw new Exception(@"Configuration Error: Software Short Name Must be setted");
}
private static String ValidateSFTLName(String value)
{
if (!String.IsNullOrEmpty(value))
return value;
else
throw new Exception(@"Configuration Error: Software Long Name Must be setted");
}
private static String ExtractBase64Icon(String value)
{
Image im = Icon.ExtractAssociatedIcon(value).ToBitmap();
MemoryStream m = new MemoryStream();
im.Save(m, ImageFormat.Png);
return "data:image/png;base64," + Convert.ToBase64String(m.ToArray());
}
#endregion
+2
View File
@@ -10,5 +10,7 @@ namespace Client.Config.SubModels
{
public string Url { get; set; }
public ushort Id { get; set; }
public Boolean DeleteCahceFolderOnStartup { get; set; }
}
}
+24
View File
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Client.Config.SubModels
{
[DataContract]
public class Software
{
[DataMember]
public string Path { get; set; }
[DataMember]
public string LongName { get; set; }
[DataMember]
public string ShortName { get; set; }
[DataMember]
public string IconBase64 { get; set; }
}
}
+14 -3
View File
@@ -9,15 +9,26 @@ namespace Client.Utils
public static class Constants
{
//Folders
public static String BASE_PATH = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\";
public static String BROWSER_CACHE_FOLDER = BASE_PATH + "LocalStorage";
public static String STARTUP_CONFIG_SCHEMA_PATH = BASE_PATH + "ClientValidator.xsd";
public static String STARTUP_CONFIG_PATH = BASE_PATH + "Config.xml";
//Config Names and Paths
public const string CONFIG_KEY = "Config";
public const string CLIENT_CONFIG_KEY = "Client";
public const string CONNECTION_CONFIG_KEY = "Connection";
public const string VENDORHMI_CONFIG_KEY = "VendorHmi";
public const string EXTSFT_CONFIG_KEY = "ExtSoftware";
public const string SFT_CONFIG_KEY = "Software";
//BROWSER OBJECT NAME -> The first letter must be Lower-Case (CEF Settings)
public const String BROWSER_JS_OBJ_NAME = "cmsClient";
// Filenames
public const string STARTUP_CONFIG_SCHEMA_PATH = "ClientValidator.xsd";
public const string STARTUP_CONFIG_PATH = "Config.xml";
}
}
+19
View File
@@ -1,8 +1,14 @@
using CefSharp;
using Client.Config;
using Client.Config.SubModels;
using CMS_Client.View;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -120,11 +126,24 @@ namespace CMS_Client.Browser_Tools
public void forceStepFocus()
{
Debug.WriteLine("Forced");
NcWindow.ForceStepFocus();
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PROCESSES_METHODS
public String getAvailableProcess()
{
return JsonConvert.SerializeObject(Config.ExtSoftwaresConfig);
}
public void startProcess(String Path)
{
if(File.Exists(Path))
Process.Start(Path);
}
#endregion
}
}
+4
View File
@@ -111,10 +111,14 @@
<Reference Include="Microsoft.WindowsAPICodePack.ShellExtensions, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.ShellExtensions.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<StartArguments>http://localhost:9000/Testjavascript/index.html</StartArguments>
</PropertyGroup>
</Project>
+41 -11
View File
@@ -12,13 +12,15 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Client.Utils;
using System.IO;
using CefSharp;
namespace CMS_Client.View
{
public partial class LoadingForm : Form
{
public const int TimerTest = 2000;
public const int TimerTest = 2000;
private HttpWebRequest ConnTestRequest;
private HttpWebResponse ConnTestResponse;
private String ConnTestError;
@@ -109,7 +111,7 @@ namespace CMS_Client.View
//Read the Configuration
if (!readConfiguration())
return;
//try to Request
setStatus("Connecting to " + Config.ConnectionConfig.Url + "...", "");
do { } while (!testConnection(new Uri(Config.ConnectionConfig.Url))) ;
@@ -119,14 +121,42 @@ namespace CMS_Client.View
if (Config.VendorHmiConfig.Enabled)
if (!OpenNcWindow())
return;
return;
//Setup The Browser
if (!SetupBrowser())
return;
//Close the Window
closeWindow();
closeWindow();
}
//Sub-Method used to SetupThe Browser Environment
private bool SetupBrowser()
{
//Delete Browser Cache
try
{
if (Config.ConnectionConfig.DeleteCahceFolderOnStartup && Directory.Exists(Constants.BROWSER_CACHE_FOLDER))
{
setStatus("Deleting Browser Chache Folder...", "");
Directory.Delete(Constants.BROWSER_CACHE_FOLDER, true);
}
}
catch (Exception E)
{
setStatus("Close the application!", E.Message);
return false;
}
return true;
}
//Sub-Method used to read the configuration
private bool readConfiguration()
{
@@ -153,13 +183,13 @@ namespace CMS_Client.View
private bool testConnection(Uri url)
{
Boolean Connected = false;
//Try to connect
ConnTestRequest = (HttpWebRequest)WebRequest.Create(url);
ConnTestRequest.Timeout = (int)(TimerTest);
ConnTestRequest.KeepAlive = false;
try
{
ConnTestRequest = (HttpWebRequest)WebRequest.Create(url);
ConnTestRequest.Timeout = (int)(TimerTest);
ConnTestRequest.KeepAlive = false;
ConnTestResponse = (HttpWebResponse)ConnTestRequest.GetResponse();
ConnTestError = ConnTestResponse.StatusCode.ToString();
Connected = (ConnTestResponse.StatusCode == HttpStatusCode.OK) ? true : false;
+36 -28
View File
@@ -1,6 +1,7 @@
using CefSharp;
using CefSharp.WinForms;
using Client.Config;
using Client.Utils;
using CMS_Client.Browser_Tools;
using Microsoft.WindowsAPICodePack.Taskbar;
using System;
@@ -10,6 +11,7 @@ using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
@@ -29,9 +31,6 @@ namespace CMS_Client.View
public String ErrorInfo;
}
//The first letter must be Lower-Case (CEF Settings)
private const String JSCmsObjName = "cmsClient";
private const String CacheFolder = "LocalStorage";
//Internal Variables
private ChromiumWebBrowser CefBrowser;
@@ -65,8 +64,7 @@ namespace CMS_Client.View
//Initialize the Nc-Form
if (Config.VendorHmiConfig.Enabled)
InitializeNcForm();
InitializeNcForm();
//Setup Wait Cursor
Cursor.Current = Cursors.WaitCursor;
@@ -114,25 +112,29 @@ namespace CMS_Client.View
//Invoke method if is needed or call the method in STD mode
if (this.InvokeRequired)
this.Invoke((MethodInvoker)delegate () {
if(!this.IsDisposed)
{
if (this.InvokeRequired)
this.Invoke((MethodInvoker)delegate () {
if (!CefBrowser.IsDisposed)
this.Controls.Remove(CefBrowser);
});
else
{
if (!CefBrowser.IsDisposed)
this.Controls.Remove(CefBrowser);
});
}
else
{
if (!CefBrowser.IsDisposed)
this.Controls.Remove(CefBrowser);
}
//Close the NC HMI && Stop Following Nc
if (Config.VendorHmiConfig.Enabled)
{
NcWindow.ShowTaskBar();
NcWindow.StopNcFollowing();
NcWindow.CloseNcWindow();
//Close the NC HMI && Stop Following Nc
if (Config.VendorHmiConfig.Enabled)
{
NcWindow.ShowTaskBar();
NcWindow.StopNcFollowing();
NcWindow.CloseNcWindow();
}
}
}
@@ -154,14 +156,17 @@ namespace CMS_Client.View
private void InitializeNcForm()
{
//Create the Nc-Form
NcFrm = new NcForm();
NcFrm.Show();
this.Owner = NcFrm;
this.TopLevel = true;
if (Config.VendorHmiConfig.Enabled)
{
NcFrm = new NcForm();
NcFrm.Show();
this.Owner = NcFrm;
this.TopLevel = true;
NcHandle = NcFrm.Handle;
}
//Steup the Static variables
//Steup the Step variables
MainHandle = this.Handle;
NcHandle = NcFrm.Handle;
}
@@ -173,7 +178,8 @@ namespace CMS_Client.View
//Create the Instance
CefBrowserSettings = new CefSettings();
CefBrowserSettings.CachePath = CacheFolder;
//Setup the Browser Cache
CefBrowserSettings.CachePath = Constants.BROWSER_CACHE_FOLDER;
//Setup best rendering performances | Must DISABLE GPU for transparent method! -> inside SetOffScreenRenderingBestPerformanceArgs method
CefBrowserSettings.SetOffScreenRenderingBestPerformanceArgs();
@@ -208,7 +214,7 @@ namespace CMS_Client.View
CefBrowser.MenuHandler = new CefBrowserMenuHandler();
//Register JS Object
CefBrowser.RegisterJsObject(JSCmsObjName, new BrowserJSObject(this));
CefBrowser.RegisterJsObject(Constants.BROWSER_JS_OBJ_NAME, new BrowserJSObject(this));
//Insert into Form
this.Controls.Add(CefBrowser);
@@ -249,6 +255,8 @@ namespace CMS_Client.View
//Start following NC Window
if (Config.VendorHmiConfig.Enabled)
NcWindow.StartNcFollowing(MainHandle, NcHandle, NcFrm.Width, NcFrm.Height);
else
NcWindow.StartStepFollowing(MainHandle);
//If is an Error Show the Error page
if (LoadingError.Error && !LoadingError.ErrorInfo.Contains("ERR_ABORTED"))
+7
View File
@@ -352,6 +352,13 @@ namespace CMS_Client.View
}
//Start Step Managing
public static void StartStepFollowing(IntPtr Handle)
{
//Setup the Handle-variable
MainViewHandle = Handle;
}
//Start following Nc Window (bring-to-font the main window)
public static void StartNcFollowing(IntPtr Handle, IntPtr NcHandle, int Width, int Height)
+1
View File
@@ -6,4 +6,5 @@
<package id="CefSharp.WinForms" version="57.0.0" targetFramework="net461" />
<package id="Microsoft.WindowsAPICodePack-Core" version="1.1.0.2" targetFramework="net462" />
<package id="Microsoft.WindowsAPICodePack-Shell" version="1.1.0.0" targetFramework="net462" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net462" />
</packages>
+20 -4
View File
@@ -35,6 +35,7 @@
this.StepNotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.NotifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.StopServerItem = new System.Windows.Forms.ToolStripMenuItem();
this.TestJSButton = new System.Windows.Forms.Button();
this.NotifyIconMenu.SuspendLayout();
this.SuspendLayout();
//
@@ -42,7 +43,7 @@
//
this.stopServerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.stopServerButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.stopServerButton.Location = new System.Drawing.Point(122, 18);
this.stopServerButton.Location = new System.Drawing.Point(228, 8);
this.stopServerButton.Margin = new System.Windows.Forms.Padding(2);
this.stopServerButton.Name = "stopServerButton";
this.stopServerButton.Size = new System.Drawing.Size(107, 43);
@@ -55,12 +56,12 @@
//
this.openUiButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.openUiButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.openUiButton.Location = new System.Drawing.Point(11, 18);
this.openUiButton.Location = new System.Drawing.Point(6, 8);
this.openUiButton.Margin = new System.Windows.Forms.Padding(2);
this.openUiButton.Name = "openUiButton";
this.openUiButton.Size = new System.Drawing.Size(107, 43);
this.openUiButton.TabIndex = 1;
this.openUiButton.Text = "Open CMS Client";
this.openUiButton.Text = "Open Home Page";
this.openUiButton.UseVisualStyleBackColor = true;
this.openUiButton.Click += new System.EventHandler(this.OpenUiButton_Click);
//
@@ -88,11 +89,25 @@
this.StopServerItem.Text = "Close CMS Server";
this.StopServerItem.Click += new System.EventHandler(this.StopServerItem_Click);
//
// TestJSButton
//
this.TestJSButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.TestJSButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.TestJSButton.Location = new System.Drawing.Point(117, 8);
this.TestJSButton.Margin = new System.Windows.Forms.Padding(2);
this.TestJSButton.Name = "TestJSButton";
this.TestJSButton.Size = new System.Drawing.Size(107, 43);
this.TestJSButton.TabIndex = 2;
this.TestJSButton.Text = "Open Test Javascript Page";
this.TestJSButton.UseVisualStyleBackColor = true;
this.TestJSButton.Click += new System.EventHandler(this.TestJSButton_Click);
//
// ServerControlWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(239, 72);
this.ClientSize = new System.Drawing.Size(345, 62);
this.Controls.Add(this.TestJSButton);
this.Controls.Add(this.openUiButton);
this.Controls.Add(this.stopServerButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
@@ -116,5 +131,6 @@
private System.Windows.Forms.NotifyIcon StepNotifyIcon;
private System.Windows.Forms.ContextMenuStrip NotifyIconMenu;
private System.Windows.Forms.ToolStripMenuItem StopServerItem;
private System.Windows.Forms.Button TestJSButton;
}
}
+11 -4
View File
@@ -16,13 +16,14 @@ namespace Step.UI
public partial class ServerControlWindow : Form
{
String HomePageUI;
String TestJSPageUI;
public ServerControlWindow()
{
InitializeComponent();
HomePageUI = "http://localhost:" + ServerConfig.ServerPort.ToString() + "/index.html";
TestJSPageUI = "http://localhost:" + ServerConfig.ServerPort.ToString() + "/Testjavascript//index.html";
MessageServices.Current.Subscribe(SEND_MESSAGE, (a, b) =>
{
// Cast object to ErrorMessageModel
@@ -79,7 +80,7 @@ namespace Step.UI
private void OpenUiButton_Click(object sender, EventArgs e)
{
//Open CMS Client
StartCMSClient();
StartCMSClient(HomePageUI);
}
private void StopServerButton_Click(object sender, EventArgs e)
@@ -101,7 +102,7 @@ namespace Step.UI
}
private void StartCMSClient()
private void StartCMSClient(string url)
{
//Setup the Path Variable
String CMSClientPath = "";
@@ -114,10 +115,16 @@ namespace Step.UI
CMSClientPath = Environment.CurrentDirectory + @"\Client\x86\CMS_Client.exe";
if(!String.IsNullOrEmpty(CMSClientPath))
Process.Start(CMSClientPath, HomePageUI);
Process.Start(CMSClientPath, url);
else
MessageBox.Show("CMS_Client.Exe not found");
}
private void TestJSButton_Click(object sender, EventArgs e)
{
StartCMSClient(TestJSPageUI);
}
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+133
View File
@@ -0,0 +1,133 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Test HTML Javascript</title>
<script src="jquery-3.2.1.slim.min.js" ></script>
<script src="popper.min.js"></script>
<link rel="stylesheet" href="bootstrap.min.css" >
<script src="bootstrap.min.js" ></script>
<style>
.card:hover{
background-color: #e6f0ff;
cursor: pointer;
}
.btn:hover{
cursor: pointer;
}
</style>
<script lang="javascript">
$( document ).ready(function() {
//Paolo lo so che è fatto da schifo, ma è solo un esempio per vedere se funzionava tutto...
if(typeof cmsClient !== 'undefined')
{
$(".supp").show();
//Processi da lanciare sul client, con le relative icone in Base64
var obj = JSON.parse(cmsClient.getAvailableProcess());
TestHtml = "";
obj.forEach(function(element) {
TestHtml += "<div class=\"card col\" style=\"margin: 5px;\" >";
TestHtml += "<div class=\"card-body\">"
TestHtml += "<h4 class=\"card-title\"> <img class=\"card-img-top\" style=\"width: 32px; margin-right: 0.5em\" src=\""+element.IconBase64+"\">" + element.ShortName + "</h4>"
TestHtml += "<p class=\"card-text\">" + element.LongName + "</p>"
TestHtml += "<div class=\"path\" style=\"display: none;\">" + element.Path + "</div>"
TestHtml += "</div>";
TestHtml += "</div>";
});
$('#cards').html(TestHtml);
$( '.card' ).on('click',function() {
cmsClient.startProcess($( this ).find(".path").html());
});
//Pulsanti gestione finestra
$( '#hideBTN' ).on('click',function() {
cmsClient.minimizeForm();
});
$( '#closeBTN' ).on('click',function() {
cmsClient.closeForm();
});
$( '#focusBTN' ).on('click',function() {
setTimeout(() => {
cmsClient.forceStepFocus();
}, 5000);
});
$('#Vers').val(cmsClient.getChromiumVersion());
$('#CliId').val(cmsClient.getClientID());
}
else
$(".unsopp").show();
});
</script>
</head>
<body>
<div class="container"> <br>
<div class="unsopp" style="display: none;"><h1>Unsupported Browser</h1></div>
<div class="supp" style="display: none;">
<div class="row">
<div class="col-sm-12"><h1>Javascript Test: CMS-Browser</h1></div>
</div>
<br><br>
<h6>Info Browser</h6>
<div class="row">
<div class="col-sm-12">
<form>
<div class="form-group row">
<label for="Vers" class="col-sm-2 col-form-label">Chromium Version: </label>
<div class="col-sm-10">
<input type="text" readonly class="form-control" id="Vers" value="">
</div>
</div>
<div class="form-group row">
<label for="CliId" class="col-sm-2 col-form-label">Client Id: </label>
<div class="col-sm-10">
<input type="text" readonly class="form-control" id="CliId" value="">
</div>
</div>
</form>
</div>
</div><br><br>
<hr>
<h6>Hotkey</h6>
<div class="row">
<div class="col-sm-12">
<ul>
<li><b>ALT+F4:</b> Chiudi applicazione</li>
<li><b>ALT+F5:</b> Ricarica Pagina</li>
<li><b>ALT+F12:</b> Tool Sviluppo</li>
</ul>
</div>
</div><br><br>
<hr>
<h6>Gestione Finestra Browser</h6>
<div class="row">
<div class="col-sm-12">
<button type="button" id="hideBTN" class="btn btn-primary">Riduci ad Icona</button>
<button type="button" id="closeBTN" class="btn btn-primary">Chiudi Browser</button>
<button type="button" id="focusBTN" class="btn btn-primary">Forza Fuoco Browser dopo 5 secondi</button>
</div>
</div><br><br>
<hr>
<h6>Gestione Processi sul PC <small>(Clicca sul Pannello per lanciare l'applicativo)</small></h6>
<div class="row" id="cards">
</div>
</div>
<br />
</div>
</body>
</html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+41 -88
View File
File diff suppressed because one or more lines are too long
+8 -50
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -12,7 +12,7 @@ eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true }
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _baseComponents = __webpack_require__(139);\n\nexports.default = {\n components: { loader: _baseComponents.Loader }\n\n}; //\n//\n//\n//\n////# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDA0LmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vL3Rlc3QtbG9hZGVyLnZ1ZT8yOGU1Il0sInNvdXJjZXNDb250ZW50IjpbIjx0ZW1wbGF0ZT5cbiAgPGRpdj5cbiAgICA8bG9hZGVyIHRpdGxlPVwiQXR0ZW5kZXJlIHByZWdvXCIgbWVzc2FnZT1cIkF6emVyYW1lbnRvIGFzc2kgLi4uLlwiIDpwZXJjZW50PVwiNTBcIiA6aXNWaXNpYmxlPVwidHJ1ZVwiPjwvbG9hZGVyPlxuICA8L2Rpdj5cbjwvdGVtcGxhdGU+XG48c2NyaXB0PlxuaW1wb3J0IHsgTG9hZGVyIH0gZnJvbSBcIi4uL21vZHVsZXMvYmFzZS1jb21wb25lbnRzXCI7XG5leHBvcnQgZGVmYXVsdCB7XG4gIGNvbXBvbmVudHM6eyBsb2FkZXI6IExvYWRlcn1cblxufVxuPC9zY3JpcHQ+XG5cblxuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHRlc3QtbG9hZGVyLnZ1ZT82ZDdhNjYwNiJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBTUE7QUFDQTs7QUFHQTtBQUNBO0FBSEE7Ozs7QSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///404\n");
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _baseComponents = __webpack_require__(139);\n\nexports.default = {\n components: { loader: _baseComponents.Loader }\n\n}; //\n//\n//\n//\n////# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDA0LmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vL3Rlc3QtbG9hZGVyLnZ1ZT8xY2RhIl0sInNvdXJjZXNDb250ZW50IjpbIjx0ZW1wbGF0ZT5cclxuICA8ZGl2PlxyXG4gICAgPGxvYWRlciB0aXRsZT1cIkF0dGVuZGVyZSBwcmVnb1wiIG1lc3NhZ2U9XCJBenplcmFtZW50byBhc3NpIC4uLi5cIiA6cGVyY2VudD1cIjUwXCIgOmlzVmlzaWJsZT1cInRydWVcIj48L2xvYWRlcj5cclxuICA8L2Rpdj5cclxuPC90ZW1wbGF0ZT5cclxuPHNjcmlwdD5cclxuaW1wb3J0IHsgTG9hZGVyIH0gZnJvbSBcIi4uL21vZHVsZXMvYmFzZS1jb21wb25lbnRzXCI7XHJcbmV4cG9ydCBkZWZhdWx0IHtcclxuICBjb21wb25lbnRzOnsgbG9hZGVyOiBMb2FkZXJ9XHJcblxyXG59XHJcbjwvc2NyaXB0PlxyXG5cclxuXHJcblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyB0ZXN0LWxvYWRlci52dWU/MjQ1ZGQ1MjMiXSwibWFwcGluZ3MiOiI7Ozs7OztBQU1BO0FBQ0E7O0FBR0E7QUFDQTtBQUhBOzs7O0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///404\n");
/***/ }),
+1 -1
View File
@@ -12,7 +12,7 @@ eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true }
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n//\n//\n//\n//\n//\n\nexports.default = {};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDA2LmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vL3Rlc3QtZW1wdHkudnVlPzNkM2UiXSwic291cmNlc0NvbnRlbnQiOlsiPHRlbXBsYXRlPlxuICA8ZGl2PlxuXG4gIDwvZGl2PlxuPC90ZW1wbGF0ZT5cbjxzY3JpcHQ+XG5leHBvcnQgZGVmYXVsdCB7XG5cbn1cbjwvc2NyaXB0PlxuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHRlc3QtZW1wdHkudnVlPzFlMTY5MTg0Il0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFNQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///406\n");
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n//\n//\n//\n//\n//\n\nexports.default = {};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDA2LmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vL3Rlc3QtZW1wdHkudnVlP2UzODUiXSwic291cmNlc0NvbnRlbnQiOlsiPHRlbXBsYXRlPlxyXG4gIDxkaXY+XHJcblxyXG4gIDwvZGl2PlxyXG48L3RlbXBsYXRlPlxyXG48c2NyaXB0PlxyXG5leHBvcnQgZGVmYXVsdCB7XHJcblxyXG59XHJcbjwvc2NyaXB0PlxyXG5cblxuXG4vLyBXRUJQQUNLIEZPT1RFUiAvL1xuLy8gdGVzdC1lbXB0eS52dWU/YWYyOTdlZDgiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQU1BO0FBQ0E7QUFDQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///406\n");
/***/ }),
+611 -459
View File
File diff suppressed because one or more lines are too long