diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ab848d9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,330 @@
+# ---> VisualStudio
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+build/
+bld/
+[Bb]in/
+[Oo]bj/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+
+# Windows Azure Build Output
+csx/
+*.build.csdef
+
+# Windows Store app package directory
+AppPackages/
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+[Ss]tyle[Cc]op.*
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# ---> C Sharp
+# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
+[Bb]in/
+[Oo]bj/
+
+# mstest test results
+TestResults
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Rr]elease/
+x64/
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.log
+*.vspscc
+*.vssscc
+.builds
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*
+
+# NCrunch
+*.ncrunch*
+.*crunch*.local.xml
+
+# Installshield output folder
+[Ee]xpress
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish
+
+# Publish Web Output
+*.Publish.xml
+
+# NuGet Packages Directory
+packages
+
+# Windows Azure Build Output
+csx
+*.build.csdef
+
+# Windows Store app package directory
+AppPackages/
+
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+[Tt]est[Rr]esult*
+*.Cache
+ClientBin
+[Ss]tyle[Cc]op.*
+~$*
+*.dbmdl
+Generated_Code #added for RIA/Silverlight projects
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+
+.ionide/symbolCache.db
diff --git a/Effector.Plugin.FiveLakes.Naked.sln b/Effector.Plugin.FiveLakes.Naked.sln
new file mode 100644
index 0000000..c48a607
--- /dev/null
+++ b/Effector.Plugin.FiveLakes.Naked.sln
@@ -0,0 +1,51 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.8.34309.116
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Effector.Plugin.Interface", "..\Effector\Effector.Plugin.Interface\Effector.Plugin.Interface.vbproj", "{7D14D864-2BDC-4785-80F4-320164C2D5E4}"
+EndProject
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Effector.Plugin.FiveLakes", "Effector.Plugin.FiveLakes\Effector.Plugin.FiveLakes.vbproj", "{7C77F537-8235-40AB-B24A-4E71CFB96D2C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x64.Build.0 = Debug|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x86.Build.0 = Debug|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x64.ActiveCfg = Release|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x64.Build.0 = Release|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x86.ActiveCfg = Release|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x86.Build.0 = Release|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x64.Build.0 = Debug|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x86.Build.0 = Debug|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x64.ActiveCfg = Release|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x64.Build.0 = Release|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x86.ActiveCfg = Release|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {F9D87F62-BDA1-4B0C-BE15-C43A682829E8}
+ EndGlobalSection
+EndGlobal
diff --git a/Effector.Plugin.FiveLakes.sln b/Effector.Plugin.FiveLakes.sln
new file mode 100644
index 0000000..781f5b1
--- /dev/null
+++ b/Effector.Plugin.FiveLakes.sln
@@ -0,0 +1,65 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.8.34309.116
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Effector.Main", "..\Effector.Main\Effector.Main\Effector.Main.vbproj", "{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}"
+EndProject
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Effector.Plugin.Interface", "..\Effector.Main\Effector.Plugin.Interface\Effector.Plugin.Interface.vbproj", "{7D14D864-2BDC-4785-80F4-320164C2D5E4}"
+EndProject
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Effector.Plugin.FiveLakes", "Effector.Plugin.FiveLakes\Effector.Plugin.FiveLakes.vbproj", "{7C77F537-8235-40AB-B24A-4E71CFB96D2C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|Any CPU.Build.0 = Debug|x86
+ {38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|x64.ActiveCfg = Debug|x64
+ {38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|x64.Build.0 = Debug|x64
+ {38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|x86.ActiveCfg = Debug|x86
+ {38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|x86.Build.0 = Debug|x86
+ {38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|Any CPU.ActiveCfg = Release|x64
+ {38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|Any CPU.Build.0 = Release|x64
+ {38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|x64.ActiveCfg = Release|x64
+ {38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|x64.Build.0 = Release|x64
+ {38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|x86.ActiveCfg = Release|x86
+ {38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|x86.Build.0 = Release|x86
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x64.Build.0 = Debug|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x86.Build.0 = Debug|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x64.ActiveCfg = Release|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x64.Build.0 = Release|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x86.ActiveCfg = Release|Any CPU
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x86.Build.0 = Release|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x64.Build.0 = Debug|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x86.Build.0 = Debug|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x64.ActiveCfg = Release|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x64.Build.0 = Release|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x86.ActiveCfg = Release|Any CPU
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {F9D87F62-BDA1-4B0C-BE15-C43A682829E8}
+ EndGlobalSection
+EndGlobal
diff --git a/Effector.Plugin.FiveLakes/Constants/ConstGen.vb b/Effector.Plugin.FiveLakes/Constants/ConstGen.vb
new file mode 100644
index 0000000..7cc6083
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Constants/ConstGen.vb
@@ -0,0 +1,66 @@
+'----------------------------------------------------------------------------
+' EgalTech 2015-2017
+'----------------------------------------------------------------------------
+' File : ConstGen.vb Data : 08.05.24 Versione : 2.6e1
+' Contenuto : Modulo costanti generali.
+'
+'
+'
+' Modifiche : 08.05.24 ES Creazione modulo.
+'
+'
+'----------------------------------------------------------------------------
+
+Public Module ConstGen
+
+ ' File con direttorio radice dei dati
+ Public Const DAT_FILE_NAME As String = "DataRoot.Ini"
+ Public Const S_DATA As String = "Data"
+ Public Const K_DATAROOT As String = "DataRoot"
+
+ '' File con dati di licenza
+ 'Public Const LIC_FILE_NAME As String = "EgtBEAMWALL.lic"
+ 'Public Const S_LICENCE As String = "Licence"
+ 'Public Const K_LOCKID As String = "LockId"
+ 'Public Const K_KEY As String = "Key"
+
+
+ ' Abilitazioni licenza
+ Public Enum KEY_OPT As UInteger
+ SUPERVISOR = 1
+ End Enum
+
+ ' Sottodirettorio di configurazione
+ Public Const CONF_DIR As String = "Config"
+ ' Sottodirettorio delle risorse
+ Public Const RES_DIR As String = "Resources"
+ ' Sottodirettorio script
+ Public Const SCRIPT_DIR As String = "Script"
+ ' Sottodirettorio temporaneo
+ Public Const TEMP_DIR As String = "Temp"
+ '' Sottodirettorio per Cam automatico
+ 'Public Const PROJS_DIR As String = "Projs"
+ '' Sottodirettorio per Csv automatico
+ 'Public Const PRODS_DIR As String = "Prods"
+ '' Sottodirettorio per Macro
+ 'Public Const MACRO_DIR As String = "Macro"
+ '' Sottodirettorio per Magazzino
+ 'Public Const WAREHOUSE_DIR As String = "Warehouse"
+ '' Sottodirettorio per lavorazioni travi
+ 'Public Const BEAM_DIR As String = "Beam"
+ '' Sottodirettorio per lavorazioni pareti
+ 'Public Const WALL_DIR As String = "Wall"
+ '' Sottodirettorio di default per il salvataggio con nome
+ 'Public Const SAVE_DFL_NAMEDIR As String = "MyProjects"
+ '' Sottodirettorio di default per le macchine
+ 'Public Const MACHINES_DFL_DIR As String = "Machines"
+ '' Sottodirettorio di default per toolmakers
+ 'Public Const TOOLMAKERS_DFL_DIR As String = "ToolMakers"
+ '' Nome file Lua con le funzioni di attrezzaggio
+ 'Public Const SETUP_LUA As String = "SetUp.lua"
+ '' Nome eseguibile per stampa
+ 'Public Const ZEBRAPRINTER_EXE As String = "ZebraPrinterUtilitiesD32.exe"
+ '' Sottodirettorio di default per macro
+ 'Public Const MACRO_DFL_DIR As String = "Macro"
+
+End Module
diff --git a/Effector.Plugin.FiveLakes/Constants/ConstIni.vb b/Effector.Plugin.FiveLakes/Constants/ConstIni.vb
new file mode 100644
index 0000000..fab97d5
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Constants/ConstIni.vb
@@ -0,0 +1,42 @@
+'----------------------------------------------------------------------------
+' EgalTech 2015-2024
+'----------------------------------------------------------------------------
+' File : ConstIni.vb Data : 08.05.24 Versione : 2.6e1
+' Contenuto : Modulo costanti sezione e chiavi per file Ini.
+'
+'
+'
+' Modifiche : 08.05.24 ES Creazione modulo.
+'
+'
+'----------------------------------------------------------------------------
+Module ConstIni
+
+ Public Const INI_FILE_NAME As String = "Effector.Plugin.FiveLakes.ini"
+
+ Public Const S_GENERAL As String = "General"
+ Public Const K_BACKUPDIR As String = "BackupDir"
+ Public Const K_RESOURCESDIR As String = "ResourcesDir"
+ Public Const K_DDFDIR As String = "DDFDir"
+ Public Const K_GENDDFDIR As String = "GenDDFDir"
+
+ Public Const S_CSV As String = "CSV"
+ Public Const K_DDFNAME As String = "DDFName"
+ Public Const K_QUANTITY As String = "Quantity"
+ Public Const K_HEIGHT As String = "Height"
+ Public Const K_WIDTH As String = "Width"
+ Public Const K_THICKNESS As String = "Thickness"
+ Public Const K_DELIMITER As String = "Delimiter"
+
+ Public Const S_DEBUG As String = "Debug"
+ Public Const K_VARIABLELIST As String = "VariableList"
+ Public Const K_VARIABLEONDRAW As String = "VariableOnDraw"
+ Public Const K_MACHINECOMMANDS As String = "MachineCommands"
+ Public Const K_DOORCIRCLIST As String = "DoorCircList"
+ Public Const K_DOORPRESENCE As String = "DoorPresence"
+ Public Const K_DOORINDEX As String = "DoorIndex"
+
+ Public Const S_NC As String = "NC"
+ Public Const K_NC_SIMULATE As String = "NcSimulate"
+
+End Module
diff --git a/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml b/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml
new file mode 100644
index 0000000..8382235
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml.vb b/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml.vb
new file mode 100644
index 0000000..57f3c4e
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class DoorListPageV
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageVM.vb b/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageVM.vb
new file mode 100644
index 0000000..5f5e3f7
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/DoorListPage/DoorListPageVM.vb
@@ -0,0 +1,939 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports Newtonsoft.Json
+Imports System.Windows.Threading
+Imports System.Text.RegularExpressions
+
+Public Class DoorListPageVM
+ Inherits VMBase
+
+ Private m_BackupTimer As New DispatcherTimer
+ Private m_RefreshGraphicsTimer As New DispatcherTimer
+ Private m_ExecProcessManager As ExecProcessManager
+
+ Private m_DoorList As New ObservableCollection(Of Door)
+ Public ReadOnly Property DoorList As ObservableCollection(Of Door)
+ Get
+ Return m_DoorList
+ End Get
+ End Property
+ Private m_SelDoor As Door
+ Public Property SelDoor As Door
+ Get
+ Return m_SelDoor
+ End Get
+ Set(value As Door)
+ m_SelDoor = value
+ End Set
+ End Property
+
+ Private m_bExecButton_IsEnabled As Boolean = True
+ Public ReadOnly Property bExecButton_IsEnabled As Boolean
+ Get
+ Return m_bExecButton_IsEnabled
+ End Get
+ End Property
+ Private Sub SetExecButtonIsEnabled(bValue As Boolean)
+ m_bExecButton_IsEnabled = bValue
+ NotifyPropertyChanged(NameOf(bExecButton_IsEnabled))
+ End Sub
+ Private m_nModifyIndex As Integer = 0
+ Private m_nBackupindex As Integer = 0
+ Private m_bWritingBackup As Boolean = False
+
+ ' Definizione comandi
+ Private m_cmdOpenCSV As ICommand
+ Private m_cmdSkipDoor As ICommand
+ Private m_cmdMoveUp As ICommand
+ Private m_cmdMoveDown As ICommand
+ Private m_cmdDelete As ICommand
+ Private m_cmdDeleteAll As ICommand
+ Private m_cmdProduce As ICommand
+ Private m_cmdProduceAll As ICommand
+ Private m_cmdResetProductionQueue As ICommand
+ Private m_cmdVerify As ICommand
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' imposto riferimento in Map
+ Map.SetRefDoorListPageVM(Me)
+ Dim sBackupDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "BackupDir", "", sBackupDirPath)
+ Dim sBackupFilePath As String = sBackupDirPath & "\Backup.json"
+ Read(sBackupFilePath)
+ m_BackupTimer.Interval = New TimeSpan(0, 0, 1)
+ AddHandler m_BackupTimer.Tick, AddressOf BackupTimer_Tick
+ m_RefreshGraphicsTimer.Interval = New TimeSpan(0, 0, 1)
+ AddHandler m_RefreshGraphicsTimer.Tick, AddressOf RefreshGraphicsTimer_Tick
+ m_BackupTimer.Start()
+ m_RefreshGraphicsTimer.Start()
+ End Sub
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Friend Function ExecCAMProcess(sDDFName As String) As Boolean
+ ' lancio esecuzione programma
+ Dim sCamExePath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "CAMExePath", "", sCamExePath)
+ Dim sMainLuaPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "MainLUA", "", sMainLuaPath)
+ Dim sGenDDFDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
+ Dim sDDFFilePath As String = sGenDDFDirPath & "\" & sDDFName
+ Return Map.refSupervisorFunction.PlgExecProcess(sCamExePath, sMainLuaPath, sDDFFilePath)
+ End Function
+
+ Friend Function ExecCAMProcessAsync(sDDFName As String) As Boolean
+ ' lancio esecuzione programma
+ Dim sCamExePath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "CAMExePath", "", sCamExePath)
+ Dim sMainLuaPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "MainLUA", "", sMainLuaPath)
+ Dim sGenDDFDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
+ Dim sDDFFilePath As String = sGenDDFDirPath & "\" & sDDFName
+ Return Map.refSupervisorFunction.PlgExecProcessAsync(sCamExePath, sMainLuaPath, sDDFFilePath)
+ End Function
+
+ Public Sub Read(FilePath As String)
+ If Not File.Exists(FilePath) Then Return
+ Dim sReadedFile As String = File.ReadAllText(FilePath)
+ Dim JsonDoorList As List(Of JsonDoor) = JsonConvert.DeserializeObject(Of List(Of JsonDoor))(sReadedFile)
+ JsonDoorList = JsonDoorList.OrderBy(Of Integer)(Function(x) x.nListIndex).ToList()
+
+ m_DoorList = New ObservableCollection(Of Door)((From JsonDoor In JsonDoorList
+ Select New Door(JsonDoor)).ToList())
+ End Sub
+
+ Public Sub Write(FilePath As String)
+ Dim JsonDoorList As New List(Of JsonDoor)
+ For nDoorIndex As Integer = 0 To m_DoorList.Count - 1
+ JsonDoorList.Add(New JsonDoor(nDoorIndex + 1, m_DoorList(nDoorIndex)))
+ Next
+ Dim JsonFromWindow As String = JsonConvert.SerializeObject(JsonDoorList, Formatting.Indented)
+ If File.Exists(FilePath) Then
+ Dim sBackupFilePath As String = Path.ChangeExtension(FilePath, ".bck")
+ If File.Exists(sBackupFilePath) Then
+ Try
+ File.Delete(sBackupFilePath)
+ Catch ex As Exception
+ Map.refSupervisorFunction.PlgOutLog("Error! Impossible deleting backup file!")
+ End Try
+ End If
+ Try
+ File.Move(FilePath, sBackupFilePath)
+ Catch ex As Exception
+ Map.refSupervisorFunction.PlgOutLog("Error! Impossible renaming backup file!")
+ End Try
+ End If
+ File.WriteAllText(FilePath, JsonFromWindow)
+ End Sub
+
+ Private Sub WriteBackupCmd()
+ If m_bWritingBackup Then Return
+ m_bWritingBackup = True
+ m_nBackupindex = m_nModifyIndex
+ Dim sBackupDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, K_BACKUPDIR, "", sBackupDirPath)
+ Dim sBackupFilePath As String = sBackupDirPath & "\Backup.json"
+ Write(sBackupFilePath)
+ m_bWritingBackup = False
+ End Sub
+
+ Friend Sub WriteBackup()
+ m_nModifyIndex += 1
+ End Sub
+
+ Private Sub BackupTimer_Tick(sender As Object, e As EventArgs)
+ If m_nBackupindex < m_nModifyIndex Then
+ WriteBackupCmd()
+ End If
+ End Sub
+
+ Private Sub RefreshGraphicsTimer_Tick(sender As Object, e As EventArgs)
+ If IsNothing(m_ExecProcessManager) Then Return
+ ' ciclo su coda risultati
+ Dim ArgumentsResult As ProcessArgsResult = m_ExecProcessManager.ArgumentsResultDequeue
+ While Not IsNothing(ArgumentsResult)
+ ' aggiorno risultato sulla porta
+ Dim CurrRequestDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = ArgumentsResult.ProcessArgs.nId)
+ If Not IsNothing(CurrRequestDoor) Then
+ CurrRequestDoor.SetState(If(ArgumentsResult.nResult = 0, Door.DoorStates.VERIFIED, Door.DoorStates.VERIFICATION_FAILED))
+ ' elimino file generati
+ Dim sGenDDFDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
+ Dim sDoorFileName As String = CurrRequestDoor.sDDFName & "_" & CurrRequestDoor.nId
+ Try
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".tok")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.tok")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".cnc")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_a.cnc")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_b.cnc")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.cnc")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2_a.cnc")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".html")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.html")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".log")
+ File.Delete(sGenDDFDirPath & "\" & CurrRequestDoor.sDDFName & ".nge")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".nge")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".sest")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.sest")
+ File.Delete(sGenDDFDirPath & "\" & CurrRequestDoor.sDDFName & ".txt")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".txt")
+ File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.txt")
+ Catch ex As Exception
+
+ End Try
+ End If
+ WriteBackup()
+ ArgumentsResult = m_ExecProcessManager.ArgumentsResultDequeue
+ End While
+ If Not bExecButton_IsEnabled AndAlso m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then
+ SetExecButtonIsEnabled(True)
+ End If
+ End Sub
+
+ Friend Function GetNextDoor() As Door
+ Dim NextDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nState = Door.DoorStates.READY_FOR_PRODUCTION)
+ If Not IsNothing(NextDoor) Then
+ Map.refSupervisorFunction.PlgOutLog("GetNextDoor: door " & NextDoor.nId & " set at ON_LOAD_STATION")
+ NextDoor.SetState(Door.DoorStates.ON_LOAD_STATION)
+ WriteBackup()
+ End If
+ Return NextDoor
+ End Function
+
+ Public Sub ResetProductionQueue()
+ For Each Door In m_DoorList
+ If Door.nState = Door.DoorStates.READY_FOR_PRODUCTION Then
+ Door.SetState(Door.DoorStates.VERIFIED, False)
+ End If
+ Next
+ End Sub
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+#Region "OpenCSV"
+
+ Public ReadOnly Property OpenCSV_Command As ICommand
+ Get
+ If m_cmdOpenCSV Is Nothing Then
+ m_cmdOpenCSV = New Command(AddressOf OpenCSV)
+ End If
+ Return m_cmdOpenCSV
+ End Get
+ End Property
+
+ Public Sub OpenCSV()
+ Dim sDir As String = String.Empty
+ 'GetMainPrivateProfileString(S_GENERAL, K_LASTIMPDIR, "", sDir)
+ Dim OpenFileDialog As New Microsoft.Win32.OpenFileDialog() With {
+ .DefaultExt = ".csv",
+ .Filter = "CSV (*.csv)|*.csv",
+ .InitialDirectory = If(Directory.Exists(sDir), sDir, ""),
+ .CheckFileExists = True,
+ .ValidateNames = True}
+ If OpenFileDialog.ShowDialog() Then
+ Dim sCSVPath As String = OpenFileDialog.FileName
+ Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(sCSVPath)
+ MyReader.TextFieldType = FileIO.FieldType.Delimited
+ Dim sDelimiter As String = ""
+ GetPluginPrivateProfileString(S_CSV, K_DELIMITER, ";", sDelimiter)
+ MyReader.SetDelimiters(sDelimiter)
+ ' leggo intestazione
+ Dim Headers As String() = MyReader.ReadFields()
+ Dim sDDFName As String = ""
+ Dim sQuantityName As String = ""
+ Dim sHeightName As String = ""
+ Dim sWidthName As String = ""
+ Dim sThicknessName As String = ""
+ GetPluginPrivateProfileString(S_CSV, K_DDFNAME, K_DDFNAME, sDDFName)
+ GetPluginPrivateProfileString(S_CSV, K_QUANTITY, "", sQuantityName)
+ GetPluginPrivateProfileString(S_CSV, K_HEIGHT, "", sHeightName)
+ GetPluginPrivateProfileString(S_CSV, K_WIDTH, "", sWidthName)
+ GetPluginPrivateProfileString(S_CSV, K_THICKNESS, "", sThicknessName)
+ Dim nDDFNameIndex As Integer = Array.IndexOf(Headers, sDDFName)
+ Dim nQuantityNameIndex As Integer = Array.IndexOf(Headers, sQuantityName)
+ Dim nHeightNameIndex As Integer = Array.IndexOf(Headers, sHeightName)
+ Dim nWidthNameIndex As Integer = Array.IndexOf(Headers, sWidthName)
+ Dim nThicknessNameIndex As Integer = Array.IndexOf(Headers, sThicknessName)
+ If nDDFNameIndex = -1 Then
+ Dim sMessage As String = "Error! DDFName column not found! Csv file will not be read!"
+ ' egtoutlog(sMessage)
+ MessageBox.Show(sMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error)
+ Return
+ End If
+ Dim Values As String()
+ Dim nLineIndex As Integer = 1
+ Dim sLineErrorList As String = ""
+ While Not MyReader.EndOfData
+ Try
+ Values = MyReader.ReadFields()
+ Dim nQuantity As Integer = 1
+ If nQuantityNameIndex >= 0 AndAlso nQuantityNameIndex < Values.Count Then
+ If Not Integer.TryParse(Values(nQuantityNameIndex), nQuantity) OrElse nQuantity < 1 Then
+ nQuantity = 1
+ Dim sLine As String = ""
+ For nValueIndex = 0 To Values.Count - 1
+ sLine &= Values(nValueIndex) & If(nValueIndex < Values.Count, ";", "")
+ Next
+ sLineErrorList &= "Quantity not readable in line " & sLine & ". This line will be skipped"
+ Continue While
+ End If
+ End If
+ Dim dWidth As Double = 0
+ If nWidthNameIndex >= 0 AndAlso nWidthNameIndex < Values.Count Then
+ If Not StringToDouble(Values(nWidthNameIndex), dWidth) OrElse dWidth < 0 Then
+ dWidth = 0
+ End If
+ End If
+ Dim dHeight As Double = 0
+ If nHeightNameIndex >= 0 AndAlso nHeightNameIndex < Values.Count Then
+ If Not StringToDouble(Values(nHeightNameIndex), dHeight) OrElse dHeight < 0 Then
+ dHeight = 0
+ End If
+ End If
+ Dim dThickness As Double = 0
+ If nThicknessNameIndex >= 0 AndAlso nThicknessNameIndex < Values.Count Then
+ If Not StringToDouble(Values(nThicknessNameIndex), dThickness) OrElse dThickness < 0 Then
+ dThickness = 0
+ End If
+ End If
+ For nQuantityIndex = 1 To nQuantity
+ Dim nId As Integer = 1
+ If m_DoorList.Count > 0 Then
+ Dim nMaxId As Integer = m_DoorList.Max(Of Integer)(Function(x) x.nId)
+ 'If nMaxId < 100 Then
+ nId = nMaxId + 1
+ 'End If
+ End If
+ Dim NewDoor As New Door(nId, nLineIndex, Values(nDDFNameIndex), Path.GetFileName(sCSVPath),
+ 1, dWidth, dHeight, dThickness, Headers, Values)
+ m_DoorList.Add(NewDoor)
+ Next
+ nLineIndex += 1
+ Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
+ Dim sMessage As String = "Line " & ex.Message & "is not valid and will be skipped."
+ ' egtoutlog(sMessage)
+ sLineErrorList &= Environment.NewLine & ex.Message
+ End Try
+ End While
+ If Not String.IsNullOrWhiteSpace(sLineErrorList) Then
+ MessageBox.Show("The following lines are not valid and have been skipped:" & sLineErrorList, "Error", MessageBoxButton.OK, MessageBoxImage.Error)
+ End If
+ End Using
+ Dim sCamExePath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "CAMExePath", "", sCamExePath)
+ Dim sMainLuaPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "MainPipeLUA", "", sMainLuaPath)
+ Dim bStartExecProcessManager As Boolean = False
+ If IsNothing(m_ExecProcessManager) Then
+ bStartExecProcessManager = True
+ m_ExecProcessManager = New ExecProcessManager(sCamExePath, """" & sMainLuaPath & """")
+ AddHandler m_ExecProcessManager.m_AllArgsProcessed, AddressOf ExecProcessManager_AllArgsProcessed
+ m_ExecProcessManager.SetMaxCamInstances(3)
+ End If
+ Dim sDDFDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, K_DDFDIR, "", sDDFDirPath)
+ Dim sGenDDFDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
+ For Each Door In m_DoorList
+ If Door.nState = Door.DoorStates.LOADED_FROM_CSV Then
+ Dim sDDFFilePath As String = sDDFDirPath & "\" & Door.sDDFName & ".ddf"
+ Dim sGenDDFFilePath As String = sGenDDFDirPath & "\" & Door.sDDFName & "_" & Door.nId & ".ddf"
+ Try
+ File.Copy(sDDFFilePath, sGenDDFFilePath, True)
+ Catch ex As Exception
+ Map.refSupervisorFunction.PlgOutLog("Error: Copy file from " & sDDFFilePath & " to " & sGenDDFFilePath & " failed!")
+ End Try
+ m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sGenDDFFilePath))
+ End If
+ Next
+ If bStartExecProcessManager OrElse m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then
+ m_ExecProcessManager.StartExecutionThread()
+ SetExecButtonIsEnabled(False)
+ End If
+ End If
+ WriteBackup()
+ End Sub
+
+ Public Sub ExecProcessManager_AllArgsProcessed()
+ m_ExecProcessManager.StopExecutionThread()
+ End Sub
+
+ Public Sub ExecProcessManager_PostProcess(ProcessArgsResult As ProcessArgsResult)
+ ' verifico file di risultati
+ Dim sDDFDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "DDFDir", "", sDDFDirPath)
+ Dim sDDFFilePath As String = sDDFDirPath & "\" & ProcessArgsResult.ProcessArgs.sArgs
+ Dim sTxtFilePath As String = Path.ChangeExtension(sDDFDirPath, ".txt")
+ If Not File.Exists(sTxtFilePath) Then
+ ProcessArgsResult.SetResult(-1)
+ Return
+ End If
+ Dim TxtFileLines As String() = File.ReadAllLines(sTxtFilePath)
+ For nLineIndex As Integer = 0 To TxtFileLines.Count - 1
+ Dim Match As Match = Regex.Match(TxtFileLines(nLineIndex), "\s*Err\s*=\s*(\d*)\s*")
+ If Not IsNothing(Match) AndAlso Not IsNothing(Match.Groups(1)) Then
+ Dim sResult As String = Match.Groups(1).Value
+ Dim nResult As Integer = -2
+ If Integer.TryParse(sResult, nResult) Then
+ ProcessArgsResult.SetResult(nResult)
+ Else
+ ProcessArgsResult.SetResult(-2)
+ End If
+ End If
+ Next
+ End Sub
+
+#End Region ' OpenCSV
+
+#Region "SkipDoor"
+
+ Public ReadOnly Property SkipDoor_Command As ICommand
+ Get
+ If m_cmdSkipDoor Is Nothing Then
+ m_cmdSkipDoor = New Command(AddressOf SkipDoor)
+ End If
+ Return m_cmdSkipDoor
+ End Get
+ End Property
+
+ Public Sub SkipDoor()
+ If IsNothing(SelDoor) OrElse (SelDoor.nState <> Door.DoorStates.VERIFIED AndAlso SelDoor.nState <> Door.DoorStates.SKIPPED) Then Return
+ SelDoor.SetState(If(SelDoor.nState = Door.DoorStates.VERIFIED, Door.DoorStates.SKIPPED, Door.DoorStates.VERIFIED))
+ WriteBackup()
+ End Sub
+
+#End Region ' SkipDoor
+
+#Region "MoveUp"
+
+ Public ReadOnly Property MoveUp_Command As ICommand
+ Get
+ If m_cmdMoveUp Is Nothing Then
+ m_cmdMoveUp = New Command(AddressOf MoveUp)
+ End If
+ Return m_cmdMoveUp
+ End Get
+ End Property
+
+ Public Sub MoveUp()
+ If IsNothing(SelDoor) Then Return
+ Dim nOldIndex As Integer = m_DoorList.IndexOf(SelDoor)
+ If nOldIndex = 0 Then Return
+ If m_DoorList(nOldIndex - 1).nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Return
+ m_DoorList.Move(nOldIndex, nOldIndex - 1)
+ WriteBackup()
+ End Sub
+
+#End Region ' MoveUp
+
+#Region "MoveDown"
+
+ Public ReadOnly Property MoveDown_Command As ICommand
+ Get
+ If m_cmdMoveDown Is Nothing Then
+ m_cmdMoveDown = New Command(AddressOf MoveDown)
+ End If
+ Return m_cmdMoveDown
+ End Get
+ End Property
+
+ Public Sub MoveDown()
+ If IsNothing(SelDoor) OrElse SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Return
+ Dim nOldIndex As Integer = m_DoorList.IndexOf(SelDoor)
+ If nOldIndex = m_DoorList.Count - 1 Then Return
+ m_DoorList.Move(nOldIndex, nOldIndex + 1)
+ WriteBackup()
+ End Sub
+
+#End Region ' MoveDown
+
+#Region "Delete"
+
+ Public ReadOnly Property Delete_Command As ICommand
+ Get
+ If m_cmdDelete Is Nothing Then
+ m_cmdDelete = New Command(AddressOf Delete)
+ End If
+ Return m_cmdDelete
+ End Get
+ End Property
+
+ Public Sub Delete()
+ If IsNothing(SelDoor) OrElse SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Return
+ If MessageBox.Show("Are you sure you want to delete the selected door?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
+ m_DoorList.Remove(SelDoor)
+ WriteBackup()
+ End If
+ End Sub
+
+#End Region ' Delete
+
+#Region "DeleteAll"
+
+ Public ReadOnly Property DeleteAll_Command As ICommand
+ Get
+ If m_cmdDeleteAll Is Nothing Then
+ m_cmdDeleteAll = New Command(AddressOf DeleteAll)
+ End If
+ Return m_cmdDeleteAll
+ End Get
+ End Property
+
+ Public Sub DeleteAll()
+ If m_DoorList.Count = 0 Then Return
+ If MessageBox.Show("Are you sure you want to delete all the doors?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
+ For nDoorIndex = m_DoorList.Count - 1 To 0 Step -1
+ Dim Door As Door = m_DoorList(nDoorIndex)
+ If Door.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Continue For
+ m_DoorList.Remove(Door)
+ Next
+ WriteBackup()
+ End If
+ End Sub
+
+#End Region ' DeleteAll
+
+#Region "Produce"
+
+ Public ReadOnly Property Produce_Command As ICommand
+ Get
+ If m_cmdProduce Is Nothing Then
+ m_cmdProduce = New Command(AddressOf Produce)
+ End If
+ Return m_cmdProduce
+ End Get
+ End Property
+
+ Public Sub Produce()
+ ProduceDoor(m_SelDoor)
+ WriteBackup()
+ End Sub
+
+ Public Sub ProduceDoor(DoorToProduce As Door, Optional bWriteBackup As Boolean = True)
+ If IsNothing(DoorToProduce) OrElse DoorToProduce.nState = Door.DoorStates.SKIPPED OrElse
+ DoorToProduce.nState = Door.DoorStates.VERIFICATION_FAILED OrElse
+ DoorToProduce.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Return
+ ' la sposto dopo l'ultima da produrre
+ Dim nNewIndex As Integer = m_DoorList.IndexOf(m_DoorList.FirstOrDefault(Function(x) x.nState < Door.DoorStates.READY_FOR_PRODUCTION))
+ Dim nOldIndex As Integer = m_DoorList.IndexOf(DoorToProduce)
+ m_DoorList.Move(nOldIndex, nNewIndex)
+ DoorToProduce.SetState(Door.DoorStates.READY_FOR_PRODUCTION, bWriteBackup)
+ End Sub
+
+#End Region ' Produce
+
+#Region "ProduceAll"
+
+ Public ReadOnly Property ProduceAll_Command As ICommand
+ Get
+ If m_cmdProduceAll Is Nothing Then
+ m_cmdProduceAll = New Command(AddressOf ProduceAll)
+ End If
+ Return m_cmdProduceAll
+ End Get
+ End Property
+
+ Public Sub ProduceAll()
+ If m_DoorList.Count = 0 Then Return
+ For nDoorIndex = 0 To m_DoorList.Count - 1
+ Dim CurrDoor As Door = m_DoorList(nDoorIndex)
+ ProduceDoor(CurrDoor, False)
+ Next
+ WriteBackup()
+ End Sub
+
+#End Region ' ProduceAll
+
+#Region "ResetProductionQueue"
+
+ Public ReadOnly Property ResetProductionQueue_Command As ICommand
+ Get
+ If m_cmdResetProductionQueue Is Nothing Then
+ m_cmdResetProductionQueue = New Command(AddressOf ResetProductionQueueCmd)
+ End If
+ Return m_cmdResetProductionQueue
+ End Get
+ End Property
+
+ Public Sub ResetProductionQueueCmd()
+ ResetProductionQueue()
+ WriteBackup()
+ End Sub
+
+#End Region ' ResetProductionQueue
+
+#Region "Verify"
+
+ Public ReadOnly Property Verify_Command As ICommand
+ Get
+ If m_cmdVerify Is Nothing Then
+ m_cmdVerify = New Command(AddressOf Verify)
+ End If
+ Return m_cmdVerify
+ End Get
+ End Property
+
+ Public Sub Verify()
+ Dim sCamExePath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "CAMExePath", "", sCamExePath)
+ Dim sMainLuaPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "MainPipeLUA", "", sMainLuaPath)
+ Dim bStartExecProcessManager As Boolean = False
+ If IsNothing(m_ExecProcessManager) Then
+ bStartExecProcessManager = True
+ m_ExecProcessManager = New ExecProcessManager(sCamExePath, """" & sMainLuaPath & """")
+ 'm_ExecProcessManager.SetPostProcess(AddressOf ExecProcessManager_PostProcess)
+ AddHandler m_ExecProcessManager.m_AllArgsProcessed, AddressOf ExecProcessManager_AllArgsProcessed
+ m_ExecProcessManager.SetMaxCamInstances(3)
+ End If
+ Dim sDDFDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "DDFDir", "", sDDFDirPath)
+ For Each Door In m_DoorList
+ If Door.nState = Door.DoorStates.LOADED_FROM_CSV Or Door.nState = Door.DoorStates.VERIFICATION_FAILED Then
+ Dim sDDFFilePath As String = sDDFDirPath & "\" & Door.sDDFName & ".ddf"
+ m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sDDFFilePath))
+ End If
+ Next
+ If bStartExecProcessManager OrElse m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then
+ m_ExecProcessManager.StartExecutionThread()
+ SetExecButtonIsEnabled(False)
+ End If
+ WriteBackup()
+ End Sub
+
+#End Region ' Verify
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class Door
+ Inherits VMBase
+
+ Public Enum DoorStates As Integer
+ NULL = 0
+ LOADED_FROM_CSV = 1
+ VERIFIED = 10
+ VERIFICATION_FAILED = 11
+ SKIPPED = 20
+ READY_FOR_PRODUCTION = 30
+ ON_LOAD_STATION = 31
+ MACHINE_1_START = 33
+ MACHINE_1_END = 34
+ MACHINE_2_START = 35
+ MACHINE_2_END = 36
+ PRODUCED = 37
+ SCRAP = 40
+ End Enum
+
+ Public Enum DoorProdStates As Integer
+ NOT_INIT = 0
+ IMPORTED = 1
+ SENT_1 = 2
+ START_MACHINING_1 = 3
+ MACHINED_1 = 4
+ SENT_2 = 5
+ START_MACHINING_2 = 6
+ MACHINED_2 = 7
+ UNLOADED = 8
+ End Enum
+
+ Private m_nId As Integer
+ Public ReadOnly Property nId As Integer
+ Get
+ Return m_nId
+ End Get
+ End Property
+
+ Private m_nCSVLine As Integer
+ Public ReadOnly Property nCSVLine As Integer
+ Get
+ Return m_nCSVLine
+ End Get
+ End Property
+
+ Private m_sDDFName As String
+ Public ReadOnly Property sDDFName As String
+ Get
+ Return m_sDDFName
+ End Get
+ End Property
+
+ Private m_nQuantity As Integer
+ Public ReadOnly Property nQuantity As Integer
+ Get
+ Return m_nQuantity
+ End Get
+ End Property
+
+ Private m_dWidth As Double
+ Public ReadOnly Property dWidth As Double
+ Get
+ Return m_dWidth
+ End Get
+ End Property
+
+ Private m_dHeight As Double
+ Public ReadOnly Property dHeight As Double
+ Get
+ Return m_dHeight
+ End Get
+ End Property
+
+ Private m_dThickness As Double
+ Public ReadOnly Property dThickness As Double
+ Get
+ Return m_dThickness
+ End Get
+ End Property
+
+ Private m_sCSVName As String
+ Public ReadOnly Property sCSVName As String
+ Get
+ Return m_sCSVName
+ End Get
+ End Property
+
+ Private m_CustomerParameters As New List(Of CustomerParameter)
+ Public ReadOnly Property CustomerParameters As List(Of CustomerParameter)
+ Get
+ Return m_CustomerParameters
+ End Get
+ End Property
+
+ Private m_nState As DoorStates = DoorStates.LOADED_FROM_CSV
+ Public ReadOnly Property nState As DoorStates
+ Get
+ Return m_nState
+ End Get
+ End Property
+ Friend Sub SetState(value As DoorStates, Optional bWriteBackup As Boolean = True, Optional bUpdate As Boolean = True)
+ m_nState = value
+ If bWriteBackup Then Map.refDoorListPageVM.WriteBackup()
+ If bUpdate Then
+ NotifyPropertyChanged(NameOf(nState))
+ NotifyPropertyChanged(NameOf(Background))
+ End If
+ End Sub
+
+#Region "Statistics"
+
+ Private m_nProdState As DoorProdStates = DoorProdStates.NOT_INIT
+ Public ReadOnly Property nProdState As DoorProdStates
+ Get
+ Return m_nProdState
+ End Get
+ End Property
+ Friend Sub SetProdState(value As DoorProdStates)
+ m_nProdState = value
+ Select Case value
+ Case DoorProdStates.SENT_1
+ SetState(DoorStates.ON_LOAD_STATION)
+ Case DoorProdStates.START_MACHINING_1
+ SetState(DoorStates.MACHINE_1_START)
+ Case DoorProdStates.MACHINED_1
+ SetState(DoorStates.MACHINE_1_END)
+ Case DoorProdStates.START_MACHINING_2
+ SetState(DoorStates.MACHINE_2_START)
+ Case DoorProdStates.MACHINED_2
+ SetState(DoorStates.MACHINE_2_END)
+ Case DoorProdStates.UNLOADED
+ SetState(DoorStates.PRODUCED)
+ End Select
+ NotifyPropertyChanged(NameOf(nProdState))
+ End Sub
+
+ Private m_dtLoadTime As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtLoadTime As DateTime
+ Get
+ Return m_dtLoadTime
+ End Get
+ End Property
+ Public ReadOnly Property sLoadTime As String
+ Get
+ Return If(m_dtLoadTime <> DateTime.MinValue, m_dtLoadTime.ToString("yy/MM/dd hh:mm:ss"), "")
+ End Get
+ End Property
+ Friend Sub SetLoadTime(LoadTime As Long)
+ m_dtLoadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(LoadTime).ToLocalTime()
+ NotifyPropertyChanged(NameOf(sLoadTime))
+ End Sub
+
+ Private m_dtMachining1Start As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtMachining1Start As DateTime
+ Get
+ Return m_dtMachining1Start
+ End Get
+ End Property
+ Public ReadOnly Property sMachining1Start As String
+ Get
+ Return If(m_dtMachining1Start <> DateTime.MinValue, m_dtMachining1Start.ToString("yy/MM/dd hh:mm:ss"), "")
+ End Get
+ End Property
+ Friend Sub SetMachining1Start(Machining1Start As Long)
+ m_dtMachining1Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining1Start).ToLocalTime()
+ NotifyPropertyChanged(NameOf(sMachining1Start))
+ End Sub
+
+ Private m_dtMachining1End As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtMachining1End As DateTime
+ Get
+ Return m_dtMachining1End
+ End Get
+ End Property
+ Public ReadOnly Property sMachining1End As String
+ Get
+ Return If(m_dtMachining1End <> DateTime.MinValue, m_dtMachining1End.ToString("yy/MM/dd hh:mm:ss"), "")
+ End Get
+ End Property
+ Friend Sub SetMachining1End(Machining1End As Long)
+ m_dtMachining1End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining1End).ToLocalTime()
+ NotifyPropertyChanged(NameOf(sMachining1End))
+ End Sub
+
+ Private m_dtMachining2Start As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtMachining2Start As DateTime
+ Get
+ Return m_dtMachining2Start
+ End Get
+ End Property
+ Public ReadOnly Property sMachining2Start As String
+ Get
+ Return If(m_dtMachining2Start <> DateTime.MinValue, m_dtMachining2Start.ToString("yy/MM/dd hh:mm:ss"), "")
+ End Get
+ End Property
+ Friend Sub SetMachining2Start(Machining2Start As Long)
+ m_dtMachining2Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining2Start).ToLocalTime()
+ NotifyPropertyChanged(NameOf(sMachining2Start))
+ End Sub
+
+ Private m_dtMachining2End As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtMachining2End As DateTime
+ Get
+ Return m_dtMachining2End
+ End Get
+ End Property
+ Public ReadOnly Property sMachining2End As String
+ Get
+ Return If(m_dtMachining2End <> DateTime.MinValue, m_dtMachining2End.ToString("yy/MM/dd hh:mm:ss"), "")
+ End Get
+ End Property
+ Friend Sub SetMachining2End(Machining2End As Long)
+ m_dtMachining2End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining2End).ToLocalTime()
+ NotifyPropertyChanged(NameOf(sMachining2End))
+ End Sub
+
+ Private m_dtUnloadTime As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtUnloadTime As DateTime
+ Get
+ Return m_dtUnloadTime
+ End Get
+ End Property
+ Public ReadOnly Property sUnloadTime As String
+ Get
+ Return If(m_dtUnloadTime <> DateTime.MinValue, m_dtUnloadTime.ToString("yy/MM/dd hh:mm:ss"), "")
+ End Get
+ End Property
+ Friend Sub SetUnloadTime(UnloadTime As Long)
+ m_dtUnloadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(UnloadTime).ToLocalTime()
+ NotifyPropertyChanged(NameOf(sUnloadTime))
+ End Sub
+
+#End Region ' Statistics
+
+ Public ReadOnly Property Background As SolidColorBrush
+ Get
+ Select Case m_nState
+ Case DoorStates.LOADED_FROM_CSV
+ Return Brushes.White
+ Case DoorStates.VERIFICATION_FAILED
+ Return Brushes.Red
+ Case DoorStates.SKIPPED
+ Return Brushes.Orange
+ Case DoorStates.READY_FOR_PRODUCTION
+ Return Brushes.LightSkyBlue
+ Case DoorStates.ON_LOAD_STATION
+ Return Brushes.SkyBlue
+ Case DoorStates.MACHINE_1_START
+ Return Brushes.DodgerBlue
+ Case DoorStates.MACHINE_1_END
+ Return Brushes.Yellow
+ Case DoorStates.MACHINE_2_START
+ Return Brushes.DodgerBlue
+ Case DoorStates.MACHINE_2_END, DoorStates.PRODUCED
+ Return Brushes.LightGray
+ Case DoorStates.SCRAP
+ Return Brushes.MediumPurple
+ Case Else
+ Return Brushes.White
+ End Select
+ End Get
+ End Property
+
+ Sub New(nId As Integer, nCSVLine As Integer, sDDFName As String, sCSVName As String, nQuantity As Integer, dWidth As Double, dHeight As Double, dThickness As Double, HeaderList As String(), ValueList As String())
+ m_nId = nId
+ m_nCSVLine = nCSVLine
+ m_sDDFName = sDDFName
+ m_sCSVName = sCSVName
+ m_nQuantity = nQuantity
+ m_dHeight = dHeight
+ m_dWidth = dWidth
+ m_dThickness = dThickness
+ If Not IsNothing(HeaderList) AndAlso HeaderList.Count > 0 AndAlso Not IsNothing(ValueList) AndAlso ValueList.Count > 0 Then
+ For nParamIndex = 0 To Math.Max(HeaderList.Count, ValueList.Count) - 1
+ m_CustomerParameters.Add(New CustomerParameter(If(HeaderList.Count > nParamIndex, HeaderList(nParamIndex), ""), If(ValueList.Count > nParamIndex, ValueList(nParamIndex), "")))
+ Next
+ End If
+ End Sub
+
+ Sub New(JsonDoor As JsonDoor)
+ m_nId = JsonDoor.nId
+ m_nCSVLine = JsonDoor.nCSVLine
+ m_sDDFName = JsonDoor.sDDFName
+ m_sCSVName = JsonDoor.sCSVName
+ m_nQuantity = JsonDoor.nQuantity
+ m_dHeight = JsonDoor.dHeight
+ m_dWidth = JsonDoor.dWidth
+ m_dThickness = JsonDoor.dThickness
+ m_nState = JsonDoor.nState
+ m_CustomerParameters = JsonDoor.CustomerParameters
+ m_nProdState = JsonDoor.nProdState
+ m_dtLoadTime = JsonDoor.dtLoadTime
+ m_dtMachining1Start = JsonDoor.dtMachining1Start
+ m_dtMachining1End = JsonDoor.dtMachining1End
+ m_dtMachining2Start = JsonDoor.dtMachining2Start
+ m_dtMachining2End = JsonDoor.dtMachining2End
+ m_dtUnloadTime = JsonDoor.dtUnloadTime
+ End Sub
+
+End Class
+
+Public Class CustomerParameter
+
+ Private m_sHeader As String
+ Public ReadOnly Property sHeader As String
+ Get
+ Return m_sHeader
+ End Get
+ End Property
+
+ Private m_sValue As String
+ Public ReadOnly Property sValue As String
+ Get
+ Return m_sValue
+ End Get
+ End Property
+
+ Sub New(sHeader As String, sValue As String)
+ m_sHeader = sHeader
+ m_sValue = sValue
+ End Sub
+
+End Class
\ No newline at end of file
diff --git a/Effector.Plugin.FiveLakes/Effector.Plugin.FiveLakes.vbproj b/Effector.Plugin.FiveLakes/Effector.Plugin.FiveLakes.vbproj
new file mode 100644
index 0000000..fec2214
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Effector.Plugin.FiveLakes.vbproj
@@ -0,0 +1,213 @@
+
+
+
+ Debug
+ AnyCPU
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}
+ Effector.Plugin.FiveLakes
+ Effector.Plugin.FiveLakes
+ Library
+ v4.7.2
+ Custom
+ true
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}
+
+
+
+
+ true
+ full
+ true
+ true
+ true
+ bin\Debug\
+ Effector.Plugin.FiveLakes.xml
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+
+
+ pdbonly
+ false
+ false
+ true
+ false
+ true
+ bin\Release\
+ Effector.Plugin.FiveLakes.xml
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+
+
+ On
+
+
+ Binary
+
+
+ Off
+
+
+ On
+
+
+
+ ..\..\Effector.Main\Effector.Plugin.Interface\bin\Debug\Effector.Plugin.Interface.dll
+
+
+ ..\packages\KeraLua.1.4.1\lib\net46\KeraLua.dll
+
+
+ ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DoorListPageV.xaml
+
+
+
+ ProcessManagerV.xaml
+
+
+ FiveLakesUI.xaml
+
+
+
+
+
+
+ MachinePageV.xaml
+
+
+
+ MainMenuV.xaml
+
+
+
+
+ RestartWndV.xaml
+
+
+
+ StatisticsPageV.xaml
+
+
+
+ Dictionary.xaml
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
+
+
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.vb
+
+
+
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+
+
+ powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\pre-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)
+
+
+ copy $(TargetPath) c:\EgtData\Effector\Plugin\Effector.Plugin.FiveLakes\Effector.Plugin.FiveLakes.dll
+
+
+
+
+
+ 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/Effector.Plugin.FiveLakes/FiveLakesUI.xaml b/Effector.Plugin.FiveLakes/FiveLakesUI.xaml
new file mode 100644
index 0000000..8367c04
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/FiveLakesUI.xaml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Effector.Plugin.FiveLakes/FiveLakesUI.xaml.vb b/Effector.Plugin.FiveLakes/FiveLakesUI.xaml.vb
new file mode 100644
index 0000000..7af1406
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/FiveLakesUI.xaml.vb
@@ -0,0 +1,31 @@
+Imports System.ComponentModel.Composition
+Imports Effector.Plugin.Interface
+
+
+
+Public Class FiveLakesUI
+ Implements IPluginControl
+
+
+ Private m_FiveLakesUIVM As FiveLakesUIVM
+
+
+ Sub New(Host As IHost)
+ ' This call is required by the designer.
+ InitializeComponent()
+ '' Add any initialization after the InitializeComponent() call.
+ m_FiveLakesUIVM = Me.DataContext
+ 'Me.DataContext = m_FiveLakesUIVM
+ AddHandler Me.Loaded, AddressOf FiveLakesUIV_Loaded
+ Map.SetRefSupervisorFunction(Host)
+ End Sub
+
+ 'Private Sub Button1_Click(sender As Object, e As RoutedEventArgs) Handles Button1.Click
+ ' 'TextBlockTest.Text = Host.PluginTestInfo
+ 'End Sub
+
+ Private Sub FiveLakesUIV_Loaded(sender As Object, e As RoutedEventArgs)
+ m_FiveLakesUIVM.SetTextTest("Prova 1!!")
+ End Sub
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/FiveLakesUIVM.vb b/Effector.Plugin.FiveLakes/FiveLakesUIVM.vb
new file mode 100644
index 0000000..4621e1b
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/FiveLakesUIVM.vb
@@ -0,0 +1,60 @@
+Imports System.ComponentModel.Composition
+Imports Effector.Plugin.Interface
+
+Public Class FiveLakesUIVM
+ Inherits VMBase
+
+ Public Enum Pages As Integer
+ DOOR_LIST = 0
+ MACHINE_STATUS = 1
+ STATISTICS = 2
+ End Enum
+
+ Private m_sDataRoot As String
+ Private m_sConfigDir As String
+ Private m_sIniFile As String
+ Private m_sResourcesRoot As String
+
+ Private m_SelPage As Pages
+ Public Property SelPage As Integer
+ Get
+ Return m_SelPage
+ End Get
+ Set(value As Integer)
+ m_SelPage = value
+ End Set
+ End Property
+ Friend Sub SetSelPage(nPage As Pages)
+ m_SelPage = nPage
+ NotifyPropertyChanged(NameOf(SelPage))
+ End Sub
+
+ Private m_TextTest As String
+ Public ReadOnly Property TextTest As String
+ Get
+ Return m_TextTest
+ End Get
+ End Property
+ Friend Sub SetTextTest(sValue As String)
+ m_TextTest = sValue
+ NotifyPropertyChanged(NameOf(TextTest))
+ End Sub
+
+ Sub New()
+ ' Creo riferimento a questa classe in Map
+ Map.BeginInit(Me)
+ ' Impostazione path radice per i dati
+ m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
+ If GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then
+ m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
+ End If
+ m_sDataRoot &= "\" & "Plugin\Effector.Plugin.FiveLakes"
+ ' Impostazione direttorio di configurazione
+ m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
+ ' Impostazione path Ini file
+ IniFile.SetIniFile(m_sConfigDir & "\" & INI_FILE_NAME)
+ ' Impostazione path resources dir
+ m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR
+ End Sub
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/LUA/LuaManager.vb b/Effector.Plugin.FiveLakes/LUA/LuaManager.vb
new file mode 100644
index 0000000..32eff9c
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/LUA/LuaManager.vb
@@ -0,0 +1,17 @@
+Imports System.ComponentModel.Composition
+Imports Effector.Plugin.Interface
+Imports KeraLua
+
+
+
+Public Class LuaManager
+ Implements IPluginLuaManager
+
+ Private state As Lua
+
+ Public Function PlgInit(state As Object) As Boolean Implements IPluginLuaManager.PlgInit
+ SetState(state)
+ Return LuaInstallGeneral(state)
+ End Function
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/LUA/Lua_Aux.vb b/Effector.Plugin.FiveLakes/LUA/Lua_Aux.vb
new file mode 100644
index 0000000..bd2e7b5
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/LUA/Lua_Aux.vb
@@ -0,0 +1,686 @@
+Imports KeraLua
+
+Public Module Lua_Aux
+
+ Private m_State As Lua
+ Friend Sub SetState(state As Lua)
+ m_State = state
+ End Sub
+
+ Friend Function LuaClearStack(state As Lua)
+ Dim nIndex As Integer = state.GetTop()
+ If nIndex > 0 Then
+ state.Pop(nIndex)
+ End If
+ Return True
+ End Function
+
+ Friend Function LuaCheckParam(state As Lua, nIndex As Integer, ByRef bValue As Boolean)
+ If Not LuaGetParam(state, nIndex, bValue) Then
+ Return state.Error(" Invalid Parameter # " & nIndex)
+ End If
+ Return True
+ End Function
+
+ Friend Function LuaCheckParam(state As Lua, nIndex As Integer, ByRef nValue As Integer)
+ If Not LuaGetParam(state, nIndex, nValue) Then
+ Return state.Error(" Invalid Parameter # " & nIndex)
+ End If
+ Return True
+ End Function
+
+ Friend Function LuaCheckParam(state As Lua, nIndex As Integer, ByRef lValue As Long)
+ If Not LuaGetParam(state, nIndex, lValue) Then
+ Return state.Error(" Invalid Parameter # " & nIndex)
+ End If
+ Return True
+ End Function
+
+ Friend Function LuaCheckParam(state As Lua, nIndex As Integer, ByRef dValue As Double)
+ If Not LuaGetParam(state, nIndex, dValue) Then
+ Return state.Error(" Invalid Parameter # " & nIndex)
+ End If
+ Return True
+ End Function
+
+ Friend Function LuaCheckParam(state As Lua, nIndex As Integer, ByRef sValue As String)
+ If Not LuaGetParam(state, nIndex, sValue) Then
+ Return state.Error(" Invalid Parameter # " & nIndex)
+ End If
+ Return True
+ End Function
+
+ Friend Function LuaGetParam(state As Lua, nIndex As Integer, ByRef bValue As Boolean) As Boolean
+ If Not state.IsBoolean(nIndex) Then Return False
+ bValue = state.ToBoolean(nIndex)
+ Return True
+ End Function
+
+ Friend Function LuaGetParam(state As Lua, nIndex As Integer, ByRef nValue As Integer) As Boolean
+ If Not state.IsNumber(nIndex) Then Return False
+ nValue = Math.Round(state.ToNumber(nIndex))
+ Return True
+ End Function
+
+ Friend Function LuaGetParam(state As Lua, nIndex As Integer, ByRef lValue As Long) As Boolean
+ If Not state.IsNumber(nIndex) Then Return False
+ lValue = state.ToInteger(nIndex)
+ Return True
+ End Function
+
+ Friend Function LuaGetParam(state As Lua, nIndex As Integer, ByRef dValue As Double) As Boolean
+ If Not state.IsNumber(nIndex) Then Return False
+ dValue = state.ToNumber(nIndex)
+ Return True
+ End Function
+
+ Friend Function LuaGetParam(state As Lua, nIndex As Integer, ByRef sValue As String) As Boolean
+ If Not state.IsString(nIndex) Then Return False
+ sValue = state.ToString(nIndex)
+ Return True
+ End Function
+
+ Friend Function LuaSetParam(state As Lua) As Boolean
+ Try
+ state.PushNil()
+ Catch ex As Exception
+ Return False
+ End Try
+ Return True
+ End Function
+
+ Friend Function LuaSetParam(state As Lua, ByRef bValue As Boolean) As Boolean
+ Try
+ state.PushBoolean(bValue)
+ Catch ex As Exception
+ Return False
+ End Try
+ Return True
+ End Function
+
+ Friend Function LuaSetParam(state As Lua, ByRef nValue As Integer) As Boolean
+ Try
+ state.PushInteger(nValue)
+ Catch ex As Exception
+ Return False
+ End Try
+ Return True
+ End Function
+
+ Friend Function LuaSetParam(state As Lua, ByRef lValue As Long) As Boolean
+ Try
+ state.PushInteger(lValue)
+ Catch ex As Exception
+ Return False
+ End Try
+ Return True
+ End Function
+
+ Friend Function LuaSetParam(state As Lua, ByRef dValue As Double) As Boolean
+ Try
+ state.PushNumber(dValue)
+ Catch ex As Exception
+ Return False
+ End Try
+ Return True
+ End Function
+
+ Friend Function LuaSetParam(state As Lua, ByRef sValue As String) As Boolean
+ Try
+ state.PushString(sValue)
+ Catch ex As Exception
+ Return False
+ End Try
+ Return True
+ End Function
+
+ Friend Function LuaGetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef bValue As Boolean) As Boolean
+ If Not state.IsTable(nIndex) Then Return False
+ state.GetField(nIndex, sVarName)
+ Dim bResult As Boolean = LuaGetParam(state, -1, bValue)
+ state.Pop(1)
+ Return bResult
+ End Function
+
+ Friend Function LuaGetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef nValue As Integer) As Boolean
+ If Not state.IsTable(nIndex) Then Return False
+ state.GetField(nIndex, sVarName)
+ Dim bResult As Boolean = LuaGetParam(state, -1, nValue)
+ state.Pop(1)
+ Return bResult
+ End Function
+
+ Friend Function LuaGetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef lValue As Long) As Boolean
+ If Not state.IsTable(nIndex) Then Return False
+ state.GetField(nIndex, sVarName)
+ Dim bResult As Boolean = LuaGetParam(state, -1, lValue)
+ state.Pop(1)
+ Return bResult
+ End Function
+
+ Friend Function LuaGetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef dValue As Double) As Boolean
+ If Not state.IsTable(nIndex) Then Return False
+ state.GetField(nIndex, sVarName)
+ Dim bResult As Boolean = LuaGetParam(state, -1, dValue)
+ state.Pop(1)
+ Return bResult
+ End Function
+
+ Friend Function LuaGetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef sValue As String) As Boolean
+ If Not state.IsTable(nIndex) Then Return False
+ state.GetField(nIndex, sVarName)
+ Dim bResult As Boolean = LuaGetParam(state, -1, sValue)
+ state.Pop(1)
+ Return bResult
+ End Function
+
+ Friend Function LuaGetGlobVar(state As Lua, ByRef sName As String, ByRef bValue As Boolean) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ state.GetGlobal(sName)
+ Dim bResult As Boolean = LuaGetParam(state, -1, bValue)
+ state.Pop(1)
+ Return bResult
+ Else
+ Dim sTableName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ state.GetGlobal(sTableName)
+ For nParamIndex As Integer = 1 To sParams.Count - 2
+ Dim nTableIndex As Integer = -1
+ If Integer.TryParse(sParams(nParamIndex), nTableIndex) Then
+ state.RawGetInteger(-1, nTableIndex)
+ Else
+ state.GetField(-1, sParams(nParamIndex))
+ End If
+ Next
+ Dim sVarName As String = sParams(sParams.Count - 1)
+ Dim bResult As Boolean = LuaGetTabFieldParam(state, -1, sVarName, bValue)
+ state.Pop(sParams.Count - 1)
+ Return bResult
+ End If
+ End Function
+ Friend Function LuaGetGlobVar(ByRef sName As String, ByRef bValue As Boolean) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ m_State.GetGlobal(sName)
+ Dim bResult As Boolean = LuaGetParam(m_State, -1, bValue)
+ m_State.Pop(1)
+ Return bResult
+ Else
+ Dim sTableName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ m_State.GetGlobal(sTableName)
+ For nParamIndex As Integer = 1 To sParams.Count - 2
+ Dim nTableIndex As Integer = -1
+ If Integer.TryParse(sParams(nParamIndex), nTableIndex) Then
+ m_State.RawGetInteger(-1, nTableIndex)
+ Else
+ m_State.GetField(-1, sParams(nParamIndex))
+ End If
+ Next
+ Dim sVarName As String = sParams(sParams.Count - 1)
+ Dim bResult As Boolean = LuaGetTabFieldParam(m_State, -1, sVarName, bValue)
+ m_State.Pop(sParams.Count - 1)
+ Return bResult
+ End If
+ End Function
+
+ Friend Function LuaGetGlobVar(state As Lua, ByRef sName As String, ByRef nValue As Integer) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ state.GetGlobal(sName)
+ Dim bResult As Boolean = LuaGetParam(state, -1, nValue)
+ state.Pop(1)
+ Return bResult
+ Else
+ Dim sTableName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ state.GetGlobal(sTableName)
+ For nParamIndex As Integer = 1 To sParams.Count - 2
+ Dim nTableIndex As Integer = -1
+ If Integer.TryParse(sParams(nParamIndex), nTableIndex) Then
+ state.RawGetInteger(-1, nTableIndex)
+ Else
+ state.GetField(-1, sParams(nParamIndex))
+ End If
+ Next
+ Dim sVarName As String = sParams(sParams.Count - 1)
+ Dim bResult As Boolean = LuaGetTabFieldParam(state, -1, sVarName, nValue)
+ state.Pop(sParams.Count - 1)
+ Return bResult
+ End If
+ End Function
+ Friend Function LuaGetGlobVar(ByRef sName As String, ByRef nValue As Integer) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ m_State.GetGlobal(sName)
+ Dim bResult As Boolean = LuaGetParam(m_State, -1, nValue)
+ m_State.Pop(1)
+ Return bResult
+ Else
+ Dim sTableName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ m_State.GetGlobal(sTableName)
+ For nParamIndex As Integer = 1 To sParams.Count - 2
+ Dim nTableIndex As Integer = -1
+ If Integer.TryParse(sParams(nParamIndex), nTableIndex) Then
+ m_State.RawGetInteger(-1, nTableIndex)
+ Else
+ m_State.GetField(-1, sParams(nParamIndex))
+ End If
+ Next
+ Dim sVarName As String = sParams(sParams.Count - 1)
+ Dim bResult As Boolean = LuaGetTabFieldParam(m_State, -1, sVarName, nValue)
+ m_State.Pop(sParams.Count - 1)
+ Return bResult
+ End If
+ End Function
+
+ Friend Function LuaGetGlobVar(state As Lua, ByRef sName As String, ByRef lValue As Long) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ state.GetGlobal(sName)
+ Dim bResult As Boolean = LuaGetParam(state, -1, lValue)
+ state.Pop(1)
+ Return bResult
+ Else
+ Dim sTableName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ state.GetGlobal(sTableName)
+ For nParamIndex As Integer = 1 To sParams.Count - 2
+ Dim nTableIndex As Integer = -1
+ If Integer.TryParse(sParams(nParamIndex), nTableIndex) Then
+ state.RawGetInteger(-1, nTableIndex)
+ Else
+ state.GetField(-1, sParams(nParamIndex))
+ End If
+ Next
+ Dim sVarName As String = sParams(sParams.Count - 1)
+ Dim bResult As Boolean = LuaGetTabFieldParam(state, -1, sVarName, lValue)
+ state.Pop(sParams.Count - 1)
+ Return bResult
+ End If
+ End Function
+ Friend Function LuaGetGlobVar(ByRef sName As String, ByRef lValue As Long) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ m_State.GetGlobal(sName)
+ Dim bResult As Boolean = LuaGetParam(m_State, -1, lValue)
+ m_State.Pop(1)
+ Return bResult
+ Else
+ Dim sTableName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ m_State.GetGlobal(sTableName)
+ For nParamIndex As Integer = 1 To sParams.Count - 2
+ Dim nTableIndex As Integer = -1
+ If Integer.TryParse(sParams(nParamIndex), nTableIndex) Then
+ m_State.RawGetInteger(-1, nTableIndex)
+ Else
+ m_State.GetField(-1, sParams(nParamIndex))
+ End If
+ Next
+ Dim sVarName As String = sParams(sParams.Count - 1)
+ Dim bResult As Boolean = LuaGetTabFieldParam(m_State, -1, sVarName, lValue)
+ m_State.Pop(sParams.Count - 1)
+ Return bResult
+ End If
+ End Function
+
+ Friend Function LuaGetGlobVar(state As Lua, ByRef sName As String, ByRef dValue As Double) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ state.GetGlobal(sName)
+ Dim bResult As Boolean = LuaGetParam(state, -1, dValue)
+ state.Pop(1)
+ Return bResult
+ Else
+ Dim sTableName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ state.GetGlobal(sTableName)
+ For nParamIndex As Integer = 1 To sParams.Count - 2
+ Dim nTableIndex As Integer = -1
+ If Integer.TryParse(sParams(nParamIndex), nTableIndex) Then
+ state.RawGetInteger(-1, nTableIndex)
+ Else
+ state.GetField(-1, sParams(nParamIndex))
+ End If
+ Next
+ Dim sVarName As String = sParams(sParams.Count - 1)
+ Dim bResult As Boolean = LuaGetTabFieldParam(state, -1, sVarName, dValue)
+ state.Pop(sParams.Count - 1)
+ Return bResult
+ End If
+ End Function
+ Friend Function LuaGetGlobVar(ByRef sName As String, ByRef dValue As Double) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ m_State.GetGlobal(sName)
+ Dim bResult As Boolean = LuaGetParam(m_State, -1, dValue)
+ m_State.Pop(1)
+ Return bResult
+ Else
+ Dim sTableName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ m_State.GetGlobal(sTableName)
+ For nParamIndex As Integer = 1 To sParams.Count - 2
+ Dim nTableIndex As Integer = -1
+ If Integer.TryParse(sParams(nParamIndex), nTableIndex) Then
+ m_State.RawGetInteger(-1, nTableIndex)
+ Else
+ m_State.GetField(-1, sParams(nParamIndex))
+ End If
+ Next
+ Dim sVarName As String = sParams(sParams.Count - 1)
+ Dim bResult As Boolean = LuaGetTabFieldParam(m_State, -1, sVarName, dValue)
+ m_State.Pop(sParams.Count - 1)
+ Return bResult
+ End If
+ End Function
+
+ Friend Function LuaGetGlobVar(state As Lua, ByRef sName As String, ByRef sValue As String) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ state.GetGlobal(sName)
+ Dim bResult As Boolean = LuaGetParam(state, -1, sValue)
+ state.Pop(1)
+ Return bResult
+ Else
+ Dim sTableName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ state.GetGlobal(sTableName)
+ For nParamIndex As Integer = 1 To sParams.Count - 2
+ Dim nTableIndex As Integer = -1
+ If Integer.TryParse(sParams(nParamIndex), nTableIndex) Then
+ state.RawGetInteger(-1, nTableIndex)
+ Else
+ state.GetField(-1, sParams(nParamIndex))
+ End If
+ Next
+ Dim sVarName As String = sParams(sParams.Count - 1)
+ Dim bResult As Boolean = LuaGetTabFieldParam(state, -1, sVarName, sValue)
+ state.Pop(sParams.Count - 1)
+ Return bResult
+ End If
+ End Function
+ Friend Function LuaGetGlobVar(ByRef sName As String, ByRef sValue As String) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ m_State.GetGlobal(sName)
+ Dim bResult As Boolean = LuaGetParam(m_State, -1, sValue)
+ m_State.Pop(1)
+ Return bResult
+ Else
+ Dim sTableName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ m_State.GetGlobal(sTableName)
+ For nParamIndex As Integer = 1 To sParams.Count - 2
+ Dim nTableIndex As Integer = -1
+ If Integer.TryParse(sParams(nParamIndex), nTableIndex) Then
+ m_State.RawGetInteger(-1, nTableIndex)
+ Else
+ m_State.GetField(-1, sParams(nParamIndex))
+ End If
+ Next
+ Dim sVarName As String = sParams(sParams.Count - 1)
+ Dim bResult As Boolean = LuaGetTabFieldParam(m_State, -1, sVarName, sValue)
+ m_State.Pop(sParams.Count - 1)
+ Return bResult
+ End If
+ End Function
+
+ Friend Function LuaSetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String) As Boolean
+ If Not state.IsTable(nIndex) Then Return False
+ If Not LuaSetParam(state) Then Return False
+ Dim nPos As Integer = (If(nIndex > 0, nIndex, nIndex - 1))
+ state.SetField(nPos, sVarName)
+ Return True
+ End Function
+
+ Friend Function LuaSetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef bValue As Boolean) As Boolean
+ If Not state.IsTable(nIndex) Then Return False
+ If Not LuaSetParam(state, bValue) Then Return False
+ Dim nPos As Integer = (If(nIndex > 0, nIndex, nIndex - 1))
+ state.SetField(nPos, sVarName)
+ Return True
+ End Function
+
+ Friend Function LuaSetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef nValue As Integer) As Boolean
+ If Not state.IsTable(nIndex) Then Return False
+ If Not LuaSetParam(state, nValue) Then Return False
+ Dim nPos As Integer = (If(nIndex > 0, nIndex, nIndex - 1))
+ state.SetField(nPos, sVarName)
+ Return True
+ End Function
+
+ Friend Function LuaSetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef dValue As Double) As Boolean
+ If Not state.IsTable(nIndex) Then Return False
+ If Not LuaSetParam(state, dValue) Then Return False
+ Dim nPos As Integer = (If(nIndex > 0, nIndex, nIndex - 1))
+ state.SetField(nPos, sVarName)
+ Return True
+ End Function
+
+ Friend Function LuaSetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef sValue As String) As Boolean
+ If Not state.IsTable(nIndex) Then Return False
+ If Not LuaSetParam(state, sValue) Then Return False
+ Dim nPos As Integer = (If(nIndex > 0, nIndex, nIndex - 1))
+ state.SetField(nPos, sVarName)
+ Return True
+ End Function
+
+ Friend Function LuaSetGlobVar(state As Lua, ByRef sName As String, ByRef bValue As Boolean) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ If Not LuaSetParam(state, bValue) Then Return False
+ state.SetGlobal(sName)
+ Return True
+ ' altrimenti campo di tabella
+ Else
+ Dim sTableName As String = "", sVarName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ sVarName = sParams(1)
+ state.GetGlobal(sTableName)
+ Dim bResult As Boolean = LuaSetTabFieldParam(state, -1, sVarName, bValue)
+ state.Pop(1)
+ Return bResult
+ End If
+ End Function
+ Friend Function LuaSetGlobVar(ByRef sName As String, ByRef bValue As Boolean) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ If Not LuaSetParam(m_State, bValue) Then Return False
+ m_State.SetGlobal(sName)
+ Return True
+ ' altrimenti campo di tabella
+ Else
+ Dim sTableName As String = "", sVarName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ sVarName = sParams(1)
+ m_State.GetGlobal(sTableName)
+ Dim bResult As Boolean = LuaSetTabFieldParam(m_State, -1, sVarName, bValue)
+ m_State.Pop(1)
+ Return bResult
+ End If
+ End Function
+
+ Friend Function LuaSetGlobVar(state As Lua, ByRef sName As String, ByRef nValue As Integer) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ If Not LuaSetParam(state, nValue) Then Return False
+ state.SetGlobal(sName)
+ Return True
+ ' altrimenti campo di tabella
+ Else
+ Dim sTableName As String = "", sVarName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ sVarName = sParams(1)
+ state.GetGlobal(sTableName)
+ Dim bResult As Boolean = LuaSetTabFieldParam(state, -1, sVarName, nValue)
+ state.Pop(1)
+ Return bResult
+ End If
+ End Function
+ Friend Function LuaSetGlobVar(ByRef sName As String, ByRef nValue As Integer) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ If Not LuaSetParam(m_State, nValue) Then Return False
+ m_State.SetGlobal(sName)
+ Return True
+ ' altrimenti campo di tabella
+ Else
+ Dim sTableName As String = "", sVarName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ sVarName = sParams(1)
+ m_State.GetGlobal(sTableName)
+ Dim bResult As Boolean = LuaSetTabFieldParam(m_State, -1, sVarName, nValue)
+ m_State.Pop(1)
+ Return bResult
+ End If
+ End Function
+
+ Friend Function LuaSetGlobVar(state As Lua, ByRef sName As String, ByRef dValue As Double) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ If Not LuaSetParam(state, dValue) Then Return False
+ state.SetGlobal(sName)
+ Return True
+ ' altrimenti campo di tabella
+ Else
+ Dim sTableName As String = "", sVarName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ sVarName = sParams(1)
+ state.GetGlobal(sTableName)
+ Dim bResult As Boolean = LuaSetTabFieldParam(state, -1, sVarName, dValue)
+ state.Pop(1)
+ Return bResult
+ End If
+ End Function
+ Friend Function LuaSetGlobVar(ByRef sName As String, ByRef dValue As Double) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ If Not LuaSetParam(m_State, dValue) Then Return False
+ m_State.SetGlobal(sName)
+ Return True
+ ' altrimenti campo di tabella
+ Else
+ Dim sTableName As String = "", sVarName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ sVarName = sParams(1)
+ m_State.GetGlobal(sTableName)
+ Dim bResult As Boolean = LuaSetTabFieldParam(m_State, -1, sVarName, dValue)
+ m_State.Pop(1)
+ Return bResult
+ End If
+ End Function
+
+ Friend Function LuaSetGlobVar(state As Lua, ByRef sName As String, ByRef sValue As String) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ If Not LuaSetParam(state, sValue) Then Return False
+ state.SetGlobal(sName)
+ Return True
+ ' altrimenti campo di tabella
+ Else
+ Dim sTableName As String = "", sVarName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ sVarName = sParams(1)
+ state.GetGlobal(sTableName)
+ Dim bResult As Boolean = LuaSetTabFieldParam(state, -1, sVarName, sValue)
+ state.Pop(1)
+ Return bResult
+ End If
+ End Function
+ Friend Function LuaSetGlobVar(ByRef sName As String, ByRef sValue As String) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ If Not LuaSetParam(m_State, sValue) Then Return False
+ m_State.SetGlobal(sName)
+ Return True
+ ' altrimenti campo di tabella
+ Else
+ Dim sTableName As String = "", sVarName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ sVarName = sParams(1)
+ m_State.GetGlobal(sTableName)
+ Dim bResult As Boolean = LuaSetTabFieldParam(m_State, -1, sVarName, sValue)
+ m_State.Pop(1)
+ Return bResult
+ End If
+ End Function
+
+ Friend Function LuaResetGlobVar(state As Lua, ByRef sName As String) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ If Not LuaSetParam(state) Then Return False
+ state.SetGlobal(sName)
+ Return True
+ ' altrimenti campo di tabella
+ Else
+ Dim sTableName As String = "", sVarName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ sVarName = sParams(1)
+ state.GetGlobal(sTableName)
+ Dim bResult As Boolean = LuaSetTabFieldParam(state, -1, sVarName)
+ state.Pop(1)
+ Return bResult
+ End If
+ End Function
+ Friend Function LuaResetGlobVar(ByRef sName As String) As Boolean
+ ' se variabile standard
+ If Not sName.Contains("."c) Then
+ If Not LuaSetParam(m_State) Then Return False
+ m_State.SetGlobal(sName)
+ Return True
+ ' altrimenti campo di tabella
+ Else
+ Dim sTableName As String = "", sVarName As String = ""
+ Dim sParams() As String = sName.Split("."c)
+ sTableName = sParams(0)
+ sVarName = sParams(1)
+ m_State.GetGlobal(sTableName)
+ Dim bResult As Boolean = LuaSetTabFieldParam(m_State, -1, sVarName)
+ m_State.Pop(1)
+ Return bResult
+ End If
+ End Function
+
+ Friend Function LuaCreateGlobTable(state As Lua, ByRef sName As String) As Boolean
+ Try
+ state.NewTable()
+ state.SetGlobal(sName)
+ Catch ex As Exception
+ Return False
+ End Try
+ Return True
+ End Function
+ Friend Function LuaCreateGlobTable(ByRef sName As String) As Boolean
+ Try
+ m_State.NewTable()
+ m_State.SetGlobal(sName)
+ Catch ex As Exception
+ Return False
+ End Try
+ Return True
+ End Function
+
+End Module
diff --git a/Effector.Plugin.FiveLakes/LUA/Lua_General.vb b/Effector.Plugin.FiveLakes/LUA/Lua_General.vb
new file mode 100644
index 0000000..8b7879f
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/LUA/Lua_General.vb
@@ -0,0 +1,156 @@
+Imports KeraLua
+
+Public Module Lua_General
+
+ Friend func_PlgGetNumberFromIni As LuaFunction = AddressOf Lua_PlgGetNumberFromIni
+ Friend func_PlgGetStringFromIni As LuaFunction = AddressOf Lua_PlgGetStringFromIni
+ Friend func_PlgWriteStringToIni As LuaFunction = AddressOf Lua_PlgWriteStringToIni
+ Friend func_PlgExecProcess As LuaFunction = AddressOf Lua_PlgExecProcess
+ Friend func_PlgExecProcessAsync As LuaFunction = AddressOf Lua_PlgExecProcessAsync
+ Friend func_PlgCheckExecProcessAsync As LuaFunction = AddressOf Lua_PlgCheckExecProcessAsync
+ Friend func_PlgGetNextDoor As LuaFunction = AddressOf Lua_PlgGetNextDoor
+ Friend func_PlgOpenRestartWnd As LuaFunction = AddressOf Lua_PlgOpenRestartWnd
+ Friend func_PlgMachineReset As LuaFunction = AddressOf Lua_PlgMachineReset
+
+ Private Function Lua_PlgGetNumberFromIni(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ ' 4 parametri: sSec, sKey, dDef
+ Dim sSec As String = ""
+ Dim sKey As String = ""
+ Dim dDef As Integer = 0
+ LuaCheckParam(state, 1, sSec)
+ LuaCheckParam(state, 2, sKey)
+ LuaCheckParam(state, 3, dDef)
+ LuaClearStack(state)
+ Dim dResult As Double = GetPluginPrivateProfileDouble(sSec, sKey, dDef)
+ ' restituisco il risultato
+ LuaSetParam(state, dResult)
+ Return 1
+ End Function
+
+ Private Function Lua_PlgGetStringFromIni(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ ' 4 parametri: sSec, sKey, sDef
+ Dim sSec As String = ""
+ Dim sKey As String = ""
+ Dim sDef As String = 0
+ LuaCheckParam(state, 1, sSec)
+ LuaCheckParam(state, 2, sKey)
+ LuaCheckParam(state, 3, sDef)
+ LuaClearStack(state)
+ Dim sResult As String = ""
+ GetPluginPrivateProfileString(sSec, sKey, sDef, sResult)
+ ' restituisco il risultato
+ LuaSetParam(state, sResult)
+ Return 1
+ End Function
+
+ Private Function Lua_PlgWriteStringToIni(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ ' 4 parametri: sSec, sKey, sVal
+ Dim sSec As String = ""
+ Dim sKey As String = ""
+ Dim sVal As Integer = 0
+ LuaCheckParam(state, 1, sSec)
+ LuaCheckParam(state, 2, sKey)
+ LuaCheckParam(state, 3, sVal)
+ LuaClearStack(state)
+ Dim bResult As Boolean = WritePluginPrivateProfileString(sSec, sKey, sVal)
+ ' restituisco il risultato
+ LuaSetParam(state, bResult)
+ Return 1
+ End Function
+
+ Private Function Lua_PlgExecProcess(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ Dim sDDFName As String = ""
+ LuaCheckParam(state, 1, sDDFName)
+ LuaClearStack(state)
+ If Map.refDoorListPageVM.ExecCAMProcess(sDDFName) Then
+ state.PushBoolean(True)
+ Return 1
+ Else
+ Return 0
+ End If
+ End Function
+
+ Private Function Lua_PlgExecProcessAsync(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ Dim sDDFName As String = ""
+ LuaCheckParam(state, 1, sDDFName)
+ LuaClearStack(state)
+ If Map.refDoorListPageVM.ExecCAMProcessAsync(sDDFName) Then
+ state.PushBoolean(True)
+ Return 1
+ Else
+ Return 0
+ End If
+ End Function
+
+ Private Function Lua_PlgCheckExecProcessAsync(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ LuaClearStack(state)
+ Dim bHasExited As Boolean = False
+ Dim nExitCode As Integer = -1
+ If Map.refSupervisorFunction.PlgCheckExecProcessAsync(bHasExited, nExitCode) Then
+ state.PushBoolean(bHasExited)
+ state.PushInteger(nExitCode)
+ Return 2
+ Else
+ Return 0
+ End If
+ End Function
+
+ Private Function Lua_PlgGetNextDoor(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ LuaClearStack(state)
+ Dim NextDoor As Door = Map.refDoorListPageVM.GetNextDoor()
+ If Not IsNothing(NextDoor) Then
+ ' restituisco il risultato
+ LuaSetParam(state, NextDoor.nId)
+ ' Dim sGenDDFName As String = Path.GetFileNameWithoutExtension(NextDoor.sDDFName) & "_" & NextDoor.nId & ".ddf"
+ LuaSetParam(state, NextDoor.sDDFName & "_" & NextDoor.nId)
+ Return 2
+ End If
+ Return 0
+ End Function
+
+ Private Function Lua_PlgOpenRestartWnd(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ Dim nMachineIndex As Integer = 1
+ LuaGetParam(state, 1, nMachineIndex)
+ LuaClearStack(state)
+ Dim RestartWnd As New RestartWndV(Application.Current.MainWindow, New RestartWndVM(nMachineIndex))
+ Dim bRes As Boolean = RestartWnd.ShowDialog()
+ If Not IsNothing(bRes) Then
+ ' restituisco il risultato
+ LuaSetParam(state, bRes)
+ Return 1
+ End If
+ Return 0
+ End Function
+
+ Private Function Lua_PlgMachineReset(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ Dim nMachineIndex As Integer = 1
+ LuaGetParam(state, 1, nMachineIndex)
+ LuaClearStack(state)
+ Map.refDoorListPageVM.ResetProductionQueue()
+ Return 0
+ End Function
+
+ Friend Function LuaInstallGeneral(state As Lua) As Boolean
+ If IsNothing(state) Then Return False
+ state.Register("PlgGetNumberFromIni", func_PlgGetNumberFromIni)
+ state.Register("PlgGetStringFromIni", func_PlgGetStringFromIni)
+ state.Register("PlgWriteStringToIni", func_PlgWriteStringToIni)
+ state.Register("PlgExecProcess", func_PlgExecProcess)
+ state.Register("PlgExecProcessAsync", func_PlgExecProcessAsync)
+ state.Register("PlgCheckExecProcessAsync", func_PlgCheckExecProcessAsync)
+ state.Register("PlgGetNextDoor", func_PlgGetNextDoor)
+ state.Register("PlgOpenRestartWnd", func_PlgOpenRestartWnd)
+ state.Register("PlgMachineReset", func_PlgMachineReset)
+ Return True
+ End Function
+
+End Module
diff --git a/Effector.Plugin.FiveLakes/MachinePage/MachinePageV.xaml b/Effector.Plugin.FiveLakes/MachinePage/MachinePageV.xaml
new file mode 100644
index 0000000..293a78d
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/MachinePage/MachinePageV.xaml
@@ -0,0 +1,1138 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Effector.Plugin.FiveLakes/MachinePage/MachinePageV.xaml.vb b/Effector.Plugin.FiveLakes/MachinePage/MachinePageV.xaml.vb
new file mode 100644
index 0000000..76c4d6d
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/MachinePage/MachinePageV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class MachinePageV
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/MachinePage/MachinePageVM.vb b/Effector.Plugin.FiveLakes/MachinePage/MachinePageVM.vb
new file mode 100644
index 0000000..8b8aca7
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/MachinePage/MachinePageVM.vb
@@ -0,0 +1,1059 @@
+Imports System.Collections.ObjectModel
+Imports System.ComponentModel.Composition
+Imports System.Globalization
+Imports System.Reflection
+Imports System.Windows.Threading
+Imports Newtonsoft.Json.Linq
+Imports Effector.Plugin.FiveLakes.Variable
+Imports Effector.Plugin.Interface
+
+Public Class MachinePageVM
+ Inherits VMBase
+
+ Private m_DoorOnMachineList As New ObservableCollection(Of Door)
+ Public ReadOnly Property DoorOnMachineList As ObservableCollection(Of Door)
+ Get
+ Return m_DoorOnMachineList
+ End Get
+ End Property
+
+ Private m_VarTimer As New DispatcherTimer
+
+ Private m_VariableList As ObservableCollection(Of Variable)
+ Public ReadOnly Property VariableList As ObservableCollection(Of Variable)
+ Get
+ Return m_VariableList
+ End Get
+ End Property
+
+ Private m_sMachineImagePath As String
+ Public ReadOnly Property sMachineImagePath As String
+ Get
+ Return m_sMachineImagePath
+ End Get
+ End Property
+
+ Private m_nDDfCalcState As Integer = -1
+ Public ReadOnly Property nDDfCalcState As Integer
+ Get
+ Return m_nDDfCalcState
+ End Get
+ End Property
+ Private Sub SetDDfCalcState(nState As Integer)
+ m_nDDfCalcState = nState
+ NotifyPropertyChanged(NameOf(nDDfCalcState))
+ End Sub
+
+ Private m_nNewDoorState As Integer = -1
+ Public ReadOnly Property nNewDoorState As Integer
+ Get
+ Return m_nNewDoorState
+ End Get
+ End Property
+ Private Sub SetNewDoorState(nState As Integer)
+ m_nNewDoorState = nState
+ NotifyPropertyChanged(NameOf(nNewDoorState))
+ End Sub
+
+ 'Private m_DoorOnMachineArray(8) As LuaDoor
+ 'Public ReadOnly Property DoorOnMachineArray As LuaDoor()
+ ' Get
+ ' Return m_DoorOnMachineArray
+ ' End Get
+ 'End Property
+
+ Private m_DoorOnMachineArray As New ObservableCollection(Of LuaDoor)
+ Public ReadOnly Property DoorOnMachineArray As ObservableCollection(Of LuaDoor)
+ Get
+ Return m_DoorOnMachineArray
+ End Get
+ End Property
+
+ Private m_LuaDoorList As New ObservableCollection(Of LuaDoor)
+ Public ReadOnly Property LuaDoorList As ObservableCollection(Of LuaDoor)
+ Get
+ Return m_LuaDoorList
+ End Get
+ End Property
+
+ Public ReadOnly Property VariableList_Visibility As Visibility
+ Get
+ Return If(GetPluginPrivateProfileInt(S_DEBUG, K_VARIABLELIST, 0) <> 0, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ End Property
+
+ Public ReadOnly Property VariableOnDraw_Visibility As Visibility
+ Get
+ Return If(GetPluginPrivateProfileInt(S_DEBUG, K_VARIABLEONDRAW, 0) <> 0, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ End Property
+
+ Public ReadOnly Property MachineCommands_Visibility As Visibility
+ Get
+ Return If(GetPluginPrivateProfileInt(S_DEBUG, K_MACHINECOMMANDS, 0) <> 0, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ End Property
+
+ Public ReadOnly Property DoorCircList_Visibility As Visibility
+ Get
+ Return If(GetPluginPrivateProfileInt(S_DEBUG, K_DOORCIRCLIST, 0) <> 0, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdWriteVariable As ICommand
+ Private m_cmdMoveVariable As ICommand
+ Private m_cmdManageMachining As ICommand
+
+ Sub New()
+ ' imposto riferimento in Map
+ Map.SetRefMachinePageVM(Me)
+ m_VariableList = New ObservableCollection(Of Variable)({New Variable(Variable.VariableTypes.DOUBLE, "@WP_PR_00", "980", 1),
+ New Variable(Variable.VariableTypes.DOUBLE, "@WP_PR_01", "981", 1),
+ New Variable(Variable.VariableTypes.DOUBLE, "@WP_PR_02", "982", 1),
+ New Variable(Variable.VariableTypes.DOUBLE, "@WP_PR_03", "983", 1),
+ New Variable(Variable.VariableTypes.DOUBLE, "@WP_PR_04", "984", 1),
+ New Variable(Variable.VariableTypes.INTEGER, "@DOORN_S0", "1360", 1),
+ New Variable(Variable.VariableTypes.INTEGER, "@DOORN_S1", "1361", 1),
+ New Variable(Variable.VariableTypes.INTEGER, "@DOORN_S2", "1362", 1),
+ New Variable(Variable.VariableTypes.INTEGER, "@DOORN_S3", "1363", 1),
+ New Variable(Variable.VariableTypes.INTEGER, "@DOORN_S4", "1364", 1),
+ New Variable(Variable.VariableTypes.INTEGER, "@SENT_1", "1350", 1),
+ New Variable(Variable.VariableTypes.INTEGER, "@SENT_2", "1351", 1),
+ New Variable(Variable.VariableTypes.INTEGER, "@STATE", "1352", 1),
+ New Variable(Variable.VariableTypes.INTEGER, "@RESET_ON", "1365", 1),
+ New Variable(Variable.VariableTypes.INTEGER, "@MAST_OK", "1366", 1),
+ New Variable(Variable.VariableTypes.INTEGER, "@START_OK", "1367", 1),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF00", "901.0", 1),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF01", "901.1", 1),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF02", "901.2", 1),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF03", "901.3", 1),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF04", "901.4", 1),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF05", "901.5", 1),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF06", "901.6", 1),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF07", "901.7", 1),
+ New Variable(Variable.VariableTypes.DOUBLE, "@WP_PR_00", "980", 2),
+ New Variable(Variable.VariableTypes.DOUBLE, "@WP_PR_01", "981", 2),
+ New Variable(Variable.VariableTypes.DOUBLE, "@WP_PR_02", "982", 2),
+ New Variable(Variable.VariableTypes.DOUBLE, "@WP_PR_03", "983", 2),
+ New Variable(Variable.VariableTypes.DOUBLE, "@WP_PR_04", "984", 2),
+ New Variable(Variable.VariableTypes.INTEGER, "@DOORN_S0", "1360", 2),
+ New Variable(Variable.VariableTypes.INTEGER, "@DOORN_S1", "1361", 2),
+ New Variable(Variable.VariableTypes.INTEGER, "@DOORN_S2", "1362", 2),
+ New Variable(Variable.VariableTypes.INTEGER, "@DOORN_S3", "1363", 2),
+ New Variable(Variable.VariableTypes.INTEGER, "@DOORN_S4", "1364", 2),
+ New Variable(Variable.VariableTypes.INTEGER, "@SENT_1", "1350", 2),
+ New Variable(Variable.VariableTypes.INTEGER, "@SENT_2", "1351", 2),
+ New Variable(Variable.VariableTypes.INTEGER, "@STATE", "1352", 2),
+ New Variable(Variable.VariableTypes.INTEGER, "@RESET_ON", "1365", 2),
+ New Variable(Variable.VariableTypes.INTEGER, "@MAST_OK", "1366", 2),
+ New Variable(Variable.VariableTypes.INTEGER, "@START_OK", "1367", 2),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF00", "901.0", 2),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF01", "901.1", 2),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF02", "901.2", 2),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF03", "901.3", 2),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF04", "901.4", 2),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF05", "901.5", 2),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF06", "901.6", 2),
+ New Variable(Variable.VariableTypes.BOOLEAN, "@BF07", "901.7", 2)})
+ AddHandler m_VarTimer.Tick, AddressOf VarTimer_Tick
+ m_VarTimer.Interval = New TimeSpan(100)
+ m_VarTimer.Start()
+ m_DoorOnMachineList.Add(New Door(35, 1, "Test.ddf", "Produzione2024", 1, 800, 1800, 40, {""}, {""}))
+ Dim sResourcesDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, K_RESOURCESDIR, "", sResourcesDirPath)
+ m_sMachineImagePath = sResourcesDirPath & "\FiveLakesMachine.png"
+ ' creo posti in lista descrizioni
+ For nIndex As Integer = 0 To 8
+ m_DoorOnMachineArray.Add(Nothing)
+ Next
+ End Sub
+
+ Friend Sub VarTimer_Tick()
+ ' leggo variabili da macchina
+ For nVarIndex As Integer = 0 To m_VariableList.Count - 1
+ Dim Var As Variable = m_VariableList(nVarIndex)
+ Select Case Var.Type
+ Case Variable.VariableTypes.INTEGER
+ Dim nIndex As Integer = 0
+ Integer.TryParse(Var.sIndex, nIndex)
+ Dim nValue As Integer = 0
+ If Map.refSupervisorFunction.ComReadShortVar(nIndex, nValue, Var.nMachine) Then
+ Var.SetValue(nValue)
+ Else
+ Map.refSupervisorFunction.PlgOutLog("Error! Reading Variable " & Var.sIndex & " on machine " & Var.nMachine & "failed!")
+ End If
+ Case Variable.VariableTypes.DOUBLE
+ Dim nIndex As Integer = 0
+ Integer.TryParse(Var.sIndex, nIndex)
+ Dim dValue As Double = 0
+ If Map.refSupervisorFunction.ComReadDoubleVar(nIndex, dValue, Var.nMachine) Then
+ Var.SetValue(dValue)
+ Else
+ Map.refSupervisorFunction.PlgOutLog("Error! Reading Variable " & Var.sIndex & " on machine " & Var.nMachine & "failed!")
+ End If
+ Case Variable.VariableTypes.BOOLEAN
+ Dim nIndex As Integer = 0
+ Dim nBit As Integer = 0
+ Dim sIndexSplit() As String = Var.sIndex.Split("."c)
+ Integer.TryParse(sIndexSplit(0), nIndex)
+ Integer.TryParse(sIndexSplit(1), nBit)
+ Dim bValue As Boolean = 0
+ If Map.refSupervisorFunction.ComReadBitVar(nIndex, nBit, bValue, Var.nMachine) Then
+ Var.SetValue(bValue)
+ Else
+ Map.refSupervisorFunction.PlgOutLog("Error! Reading Variable " & Var.sIndex & " on machine " & Var.nMachine & "failed!")
+ End If
+ End Select
+ Next
+ ' se in simulazione
+ If Map.refSupervisorFunction.PlgGetPrivateProfileInt(S_NC, K_NC_SIMULATE, 0) > 0 Then
+ ' aggiorno stato porta in macchina da 1 a 2 se in stazione di lavorazione
+ For nMachineIndex = 1 To 2
+ Dim nMachineId As Integer = nMachineIndex
+ Dim Machine1Var As Variable = m_VariableList.FirstOrDefault(Function(x) x.sName = "@WP_PR_02" AndAlso x.nMachine = nMachineId)
+ If Not IsNothing(Machine1Var) AndAlso Machine1Var.dValue = 1 Then
+ Dim nIndex As Integer = -1
+ Integer.TryParse(Machine1Var.sIndex, nIndex)
+ Map.refSupervisorFunction.ComWriteDoubleVar(nIndex, 2, Machine1Var.nMachine)
+ End If
+ Next
+ ' se presente un sent
+ Dim Sent1Var As Variable = m_VariableList.FirstOrDefault(Function(x) x.sName = "@SENT_1" AndAlso x.nMachine = 2)
+ Dim Sent2Var As Variable = m_VariableList.FirstOrDefault(Function(x) x.sName = "@SENT_2" AndAlso x.nMachine = 2)
+ If Sent1Var.nValue = 1 OrElse Sent2Var.nValue = 1 Then
+ ' aggiorno stato porta su rulliera intermedia da 2 a 1
+ For nMachineIndex = 1 To 2
+ Dim nMachineId As Integer = nMachineIndex
+ Dim sVariableName As String = "@WP_PR_04"
+ If nMachineIndex = 2 Then
+ sVariableName = "@WP_PR_00"
+ End If
+ Dim Machine1Var As Variable = m_VariableList.FirstOrDefault(Function(x) x.sName = sVariableName AndAlso x.nMachine = nMachineId)
+ If Not IsNothing(Machine1Var) AndAlso Machine1Var.dValue = 2 Then
+ Dim nIndex As Integer = -1
+ Integer.TryParse(Machine1Var.sIndex, nIndex)
+ Map.refSupervisorFunction.ComWriteDoubleVar(nIndex, 1, Machine1Var.nMachine)
+ End If
+ Next
+ End If
+ End If
+ ' leggo stato calcolo da lua
+ Dim nState As Integer = -1
+ If LuaGetGlobVar("MACHINE1.DDfCalcState", nState) Then
+ SetDDfCalcState(nState)
+ End If
+ If LuaGetGlobVar("MACHINE1.NewDoorState", nState) Then
+ SetNewDoorState(nState)
+ End If
+ m_LuaDoorList.Clear()
+ For nDoorIndex = 1 To 10
+ Dim nId As Integer = -1
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nId", nId)
+ Dim nCircIndex As Integer = -1
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nCircIndex", nCircIndex)
+ Dim nDoorState As Integer = -1
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nState", nDoorState)
+ Dim nDoorPosition As Integer = -1
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nDoorPosition", nDoorPosition)
+ Dim sDoorCode As String = ""
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".sDoorCode", sDoorCode)
+ Dim sDoorDescription As String = ""
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".sDoorDescription", sDoorDescription)
+ Dim sDDFName As String = ""
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".sDDFName", sDDFName)
+ Dim sCSVName As String = ""
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".sCSVName", sCSVName)
+ Dim sM1CNPath As String = ""
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".sM1CNPath", sM1CNPath)
+ Dim sM2CNPath As String = ""
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".sM2CNPath", sM2CNPath)
+ Dim lLoadTime As Long = 0
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nLoadTime", lLoadTime)
+ Dim lMachining1Start As Long = 0
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nMachining1Start", lMachining1Start)
+ Dim lMachining1End As Long = 0
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nMachining1End", lMachining1End)
+ Dim lMachining2Start As Long = 0
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nMachining2Start", lMachining2Start)
+ Dim lMachining2End As Long = 0
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nMachining2End", lMachining2End)
+ Dim lUnloadTime As Long = 0
+ LuaGetGlobVar("ListaCircPorte." & nDoorIndex & ".nUnloadTime", lUnloadTime)
+ m_LuaDoorList.Add(New LuaDoor(nId, nCircIndex, nDoorState, nDoorPosition, sDoorCode, sDoorDescription, sDDFName, sCSVName, sM1CNPath, sM2CNPath, lLoadTime, lMachining1Start, lMachining1End, lMachining2Start, lMachining2End, lUnloadTime))
+ If nId > 0 Then
+ ' aggiorno dati in lista porte
+ Dim Door As Door = Map.refDoorListPageVM.DoorList.FirstOrDefault(Function(x) x.nId = nId)
+ If nDoorState <> Door.nProdState Then
+ Door.SetProdState(nDoorState)
+ If lLoadTime > 0 Then Door.SetLoadTime(lLoadTime)
+ If lMachining1Start > 0 Then Door.SetMachining1Start(lMachining1Start)
+ If lMachining1End > 0 Then Door.SetMachining1End(lMachining1End)
+ If lMachining2Start > 0 Then Door.SetMachining2Start(lMachining2Start)
+ If lMachining2End > 0 Then Door.SetMachining2End(lMachining2End)
+ If lUnloadTime > 0 Then Door.SetUnloadTime(lUnloadTime)
+ End If
+ End If
+ Next
+ For nVarIndex As Integer = 0 To m_VariableList.Count - 1
+ Dim Var As Variable = m_VariableList(nVarIndex)
+ If nVarIndex >= 5 AndAlso nVarIndex <= 9 Then
+ Dim nId As Integer = -1
+ If Var.nValue > 0 AndAlso Var.nValue <= 10 Then
+ m_DoorOnMachineArray(nVarIndex - 5) = m_LuaDoorList(Var.nValue - 1)
+ Else
+ m_DoorOnMachineArray(nVarIndex - 5) = Nothing
+ End If
+ End If
+ If nVarIndex >= 30 AndAlso nVarIndex <= 33 Then
+ Dim nId As Integer = -1
+ If Var.nValue > 0 AndAlso Var.nValue <= 10 Then
+ m_DoorOnMachineArray(nVarIndex - 25) = m_LuaDoorList(Var.nValue - 1)
+ Else
+ m_DoorOnMachineArray(nVarIndex - 25) = Nothing
+ End If
+ End If
+ Next
+ 'For nVarIndex As Integer = 0 To m_VariableList.Count - 1
+ ' Dim Var As Variable = m_VariableList(nVarIndex)
+ ' If nVarIndex >= 5 AndAlso nVarIndex <= 9 Then
+ ' Dim nId As Integer = -1
+ ' If Var.nValue > 0 Then
+ ' m_DoorOnMachineArray(nVarIndex - 5) = m_LuaDoorList(Var.nValue - 1)
+ ' Else
+ ' m_DoorOnMachineArray(nVarIndex - 5) = Nothing
+ ' End If
+ ' End If
+ ' If nVarIndex >= 30 AndAlso nVarIndex <= 33 Then
+ ' Dim nId As Integer = -1
+ ' If Var.nValue > 0 Then
+ ' m_DoorOnMachineArray(nVarIndex - 25) = m_LuaDoorList(Var.nValue - 1)
+ ' Else
+ ' m_DoorOnMachineArray(nVarIndex - 25) = Nothing
+ ' End If
+ ' End If
+ 'Next
+
+ NotifyPropertyChanged(NameOf(DoorOnMachineArray))
+ End Sub
+
+#Region "COMMANDS"
+
+#Region "WriteVariable"
+
+ Public ReadOnly Property WriteVariable_Command As ICommand
+ Get
+ If m_cmdWriteVariable Is Nothing Then
+ m_cmdWriteVariable = New Command(AddressOf WriteVariable)
+ End If
+ Return m_cmdWriteVariable
+ End Get
+ End Property
+
+ Public Sub WriteVariable(sVariable As String)
+ Dim sVariables As String() = sVariable.Split(";"c)
+ For nVariableIndex As Integer = 0 To sVariables.Count - 1
+ Dim sVariableArgs As String() = sVariables(nVariableIndex).Split(","c)
+ Dim nMachineIndex As Integer = -1
+ Integer.TryParse(sVariableArgs(0), nMachineIndex)
+ Dim nVariableType As Integer = -1
+ Integer.TryParse(sVariableArgs(1), nVariableType)
+ Select Case nVariableType
+ Case 1
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sVariableArgs(2), nVarAddress)
+ Dim nVarValue As Integer = -1
+ Integer.TryParse(sVariableArgs(3), nVarValue)
+ Map.refSupervisorFunction.ComWriteShortVar(nVarAddress, nVarValue, nMachineIndex)
+ Case 2
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sVariableArgs(2), nVarAddress)
+ Dim dVarValue As Double = -1
+ StringToDouble(sVariableArgs(3), dVarValue)
+ Map.refSupervisorFunction.ComWriteDoubleVar(nVarAddress, dVarValue, nMachineIndex)
+ Case 3
+ Dim sVarAddress As String() = sVariableArgs(2).Split("."c)
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sVarAddress(0), nVarAddress)
+ Dim nBit As Integer = -1
+ Integer.TryParse(sVarAddress(1), nBit)
+ Dim nVarValue As Integer = -1
+ Integer.TryParse(sVariableArgs(3), nVarValue)
+ Map.refSupervisorFunction.ComWriteBitVar(nVarAddress, nBit, nVarValue <> 0, nMachineIndex)
+ End Select
+ Next
+ End Sub
+
+#End Region ' WriteVariable
+
+#Region "MoveVariable"
+
+ Public ReadOnly Property MoveVariable_Command As ICommand
+ Get
+ If m_cmdMoveVariable Is Nothing Then
+ m_cmdMoveVariable = New Command(AddressOf MoveVariable)
+ End If
+ Return m_cmdMoveVariable
+ End Get
+ End Property
+
+ Public Sub MoveVariable(sVariableToMove As String)
+ Dim sVariableToMoveArgs As String() = sVariableToMove.Split({"->"}, StringSplitOptions.None)
+ Dim sFromAndPresenceVariables As String() = sVariableToMoveArgs(0).Split("/"c)
+ ' verifico presenza da variabile di partenza
+ Dim sVerifyFromVariables As String() = sFromAndPresenceVariables(0).Split(";"c)
+ Dim sVerifyFromVariableArgs As String() = sVerifyFromVariables(0).Split(","c)
+ Dim nVerifyFromMachineIndex As Integer = -1
+ Integer.TryParse(sVerifyFromVariableArgs(0), nVerifyFromMachineIndex)
+ Dim nVerifyFromVarAddress As Integer = -1
+ Integer.TryParse(sVerifyFromVariableArgs(2), nVerifyFromVarAddress)
+ Dim dVerifyFromVarValue As Double = -1
+ Map.refSupervisorFunction.ComReadShortVar(nVerifyFromVarAddress, dVerifyFromVarValue, nVerifyFromMachineIndex)
+ If dVerifyFromVarValue < 1 Then Return
+ ' verifco se variabile di carico, che la macchina abbia iniziato a lavorare
+ If nVerifyFromVarAddress = 1360 Then
+ Dim MachineStateVar As Variable = VariableList.FirstOrDefault(Function(x) x.nMachine = nVerifyFromMachineIndex AndAlso x.sName = "@STATE")
+ Dim Sent1Var As Variable = VariableList.FirstOrDefault(Function(x) x.nMachine = nVerifyFromMachineIndex AndAlso x.sName = "@SENT_1")
+ Dim Sent2Var As Variable = VariableList.FirstOrDefault(Function(x) x.nMachine = nVerifyFromMachineIndex AndAlso x.sName = "@SENT_2")
+ If (MachineStateVar.nValue <> 2 AndAlso MachineStateVar.nValue <> 4) OrElse
+ Sent1Var.nValue <> 0 OrElse Sent2Var.nValue <> 0 Then Return
+ End If
+ ' verifco se variabile tavolo di lavoro, che la macchina abbia finito di lavorare o che sia a inizializzazione perche' ripartenza
+ If nVerifyFromVarAddress = 1362 Then
+ Dim MachineStateVar As Variable = VariableList.FirstOrDefault(Function(x) x.nMachine = nVerifyFromMachineIndex AndAlso x.sName = "@STATE")
+ If MachineStateVar.nValue <> 1 AndAlso MachineStateVar.nValue <> 3 AndAlso MachineStateVar.nValue <> 5 Then Return
+ End If
+ ' verifico che stazione di destinazione non sia gia' occupata
+ Dim sToAndPresenceVariables As String() = sVariableToMoveArgs(1).Split("/"c)
+ Dim sVerifyToVariables As String() = sToAndPresenceVariables(1).Split(";"c)
+ Dim sVerifyToVariableArgs As String() = sVerifyToVariables(0).Split(","c)
+ Dim nVerifyToMachineIndex As Integer = -1
+ Integer.TryParse(sVerifyToVariableArgs(0), nVerifyToMachineIndex)
+ Dim nVerifyToVarAddress As Integer = -1
+ Integer.TryParse(sVerifyToVariableArgs(2), nVerifyToVarAddress)
+ Dim dVerifyToVarValue As Double = -1
+ Map.refSupervisorFunction.ComReadDoubleVar(nVerifyToVarAddress, dVerifyToVarValue, nVerifyToMachineIndex)
+ If dVerifyToVarValue > 0 Then Return
+ ' leggo variabili di partenza
+ Dim sFromVariables As String() = sFromAndPresenceVariables(0).Split(";"c)
+ Dim sFromVariableArgs As String() = sFromVariables(0).Split(","c)
+ Dim nFromMachineIndex As Integer = -1
+ Integer.TryParse(sFromVariableArgs(0), nFromMachineIndex)
+ Dim nFromVariableType As Integer = -1
+ Integer.TryParse(sFromVariableArgs(1), nFromVariableType)
+ Dim nVarValue As Integer = -1
+ Dim dVarValue As Double = -1
+ Dim bVarValue As Boolean = False
+ Select Case nFromVariableType
+ Case 1
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sFromVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComReadShortVar(nVarAddress, nVarValue, nFromMachineIndex)
+ Case 2
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sFromVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComReadDoubleVar(nVarAddress, dVarValue, nFromMachineIndex)
+ Case 3
+ Dim sVarAddress As String() = sFromVariableArgs(2).Split("."c)
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sVarAddress(0), nVarAddress)
+ Dim nBit As Integer = -1
+ Integer.TryParse(sVarAddress(1), nBit)
+ Map.refSupervisorFunction.ComReadBitVar(nVarAddress, nBit, bVarValue, nFromMachineIndex)
+ End Select
+ ' scrivo valore in variabili di arrivo
+ Dim sToVariables As String() = sToAndPresenceVariables(0).Split(";"c)
+ For nToVariableIndex As Integer = 0 To sToVariables.Count - 1
+ Dim sToVariableArgs As String() = sToVariables(nToVariableIndex).Split(","c)
+ Dim nToMachineIndex As Integer = -1
+ Integer.TryParse(sToVariableArgs(0), nToMachineIndex)
+ Dim nToVariableType As Integer = -1
+ Integer.TryParse(sToVariableArgs(1), nToVariableType)
+ Select Case nToVariableType
+ Case 1
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sToVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComWriteShortVar(nVarAddress, nVarValue, nToMachineIndex)
+ Case 2
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sToVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComWriteDoubleVar(nVarAddress, dVarValue, nToMachineIndex)
+ Case 3
+ Dim sVarAddress As String() = sToVariableArgs(2).Split("."c)
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sVarAddress(0), nVarAddress)
+ Dim nBit As Integer = -1
+ Integer.TryParse(sVarAddress(1), nBit)
+ Map.refSupervisorFunction.ComWriteBitVar(nVarAddress, nBit, nVarValue <> 0, nToMachineIndex)
+ End Select
+ Next
+ ' cancello valore da variabili di partenza
+ Select Case nFromVariableType
+ Case 1
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sFromVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComWriteShortVar(nVarAddress, 0, nFromMachineIndex)
+ Case 2
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sFromVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComWriteDoubleVar(nVarAddress, 0, nFromMachineIndex)
+ Case 3
+ Dim sVarAddress As String() = sFromVariableArgs(2).Split("."c)
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sVarAddress(0), nVarAddress)
+ Dim nBit As Integer = -1
+ Integer.TryParse(sVarAddress(1), nBit)
+ Map.refSupervisorFunction.ComWriteBitVar(nVarAddress, nBit, False, nFromMachineIndex)
+ End Select
+ For nFromVariableIndex As Integer = 1 To sFromVariables.Count - 1
+ sFromVariableArgs = sFromVariables(nFromVariableIndex).Split(","c)
+ Integer.TryParse(sFromVariableArgs(0), nFromMachineIndex)
+ Integer.TryParse(sFromVariableArgs(1), nFromVariableType)
+ Select Case nFromVariableType
+ Case 1
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sFromVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComWriteShortVar(nVarAddress, 0, nFromMachineIndex)
+ Case 2
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sFromVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComWriteDoubleVar(nVarAddress, 0, nFromMachineIndex)
+ Case 3
+ Dim sVarAddress As String() = sFromVariableArgs(2).Split("."c)
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sVarAddress(0), nVarAddress)
+ Dim nBit As Integer = -1
+ Integer.TryParse(sVarAddress(1), nBit)
+ Map.refSupervisorFunction.ComWriteBitVar(nVarAddress, nBit, False, nFromMachineIndex)
+ End Select
+ Next
+ ' resetto presenza da variabili di partenza
+ Dim sFromPresenceVariables As String() = sFromAndPresenceVariables(1).Split(";"c)
+ For nFromPresenceVariableIndex As Integer = 0 To sFromPresenceVariables.Count - 1
+ Dim sFromPresenceVariableArgs As String() = sFromPresenceVariables(nFromPresenceVariableIndex).Split(","c)
+ Dim nFromPresenceMachineIndex As Integer = -1
+ Integer.TryParse(sFromPresenceVariableArgs(0), nFromPresenceMachineIndex)
+ Dim nFromPresenceVariableType As Integer = -1
+ Integer.TryParse(sFromPresenceVariableArgs(1), nFromPresenceVariableType)
+ Select Case nFromPresenceVariableType
+ Case 1
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sFromPresenceVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComReadShortVar(nVarAddress, nVarValue, nFromPresenceMachineIndex)
+ Map.refSupervisorFunction.ComWriteShortVar(nVarAddress, 0, nFromPresenceMachineIndex)
+ Case 2
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sFromPresenceVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComReadDoubleVar(nVarAddress, dVarValue, nFromPresenceMachineIndex)
+ Map.refSupervisorFunction.ComWriteDoubleVar(nVarAddress, 0, nFromPresenceMachineIndex)
+ Case 3
+ Dim sVarAddress As String() = sFromPresenceVariableArgs(2).Split("."c)
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sVarAddress(0), nVarAddress)
+ Dim nBit As Integer = -1
+ Integer.TryParse(sVarAddress(1), nBit)
+ Map.refSupervisorFunction.ComReadBitVar(nVarAddress, nBit, bVarValue, nFromPresenceMachineIndex)
+ Map.refSupervisorFunction.ComWriteBitVar(nVarAddress, nBit, False, nFromPresenceMachineIndex)
+ End Select
+ Next
+ ' imposto presenza in variabili di arrivo
+ Dim sToPresenceVariables As String() = sToAndPresenceVariables(1).Split(";"c)
+ For nToPresenceVariableIndex As Integer = 0 To sToPresenceVariables.Count - 1
+ Dim sToPresenceVariableArgs As String() = sToPresenceVariables(nToPresenceVariableIndex).Split(","c)
+ Dim nToPresenceMachineIndex As Integer = -1
+ Integer.TryParse(sToPresenceVariableArgs(0), nToPresenceMachineIndex)
+ Dim nVarAddress As Integer = -1
+ Integer.TryParse(sToPresenceVariableArgs(2), nVarAddress)
+ Map.refSupervisorFunction.ComWriteDoubleVar(nVarAddress, dVarValue, nToPresenceMachineIndex)
+ Next
+ End Sub
+
+#End Region ' MoveVariable
+
+#Region "ManageMachining"
+
+ Public ReadOnly Property ManageMachining_Command As ICommand
+ Get
+ If m_cmdManageMachining Is Nothing Then
+ m_cmdManageMachining = New Command(AddressOf ManageMachining)
+ End If
+ Return m_cmdManageMachining
+ End Get
+ End Property
+
+ Public Sub ManageMachining(sArg As String)
+ Dim sArgs As String() = sArg.Split(","c)
+ Dim nMachineIndex As Integer = -1
+ Dim nStartStop As Integer = -1
+ Integer.TryParse(sArgs(0), nMachineIndex)
+ Integer.TryParse(sArgs(1), nStartStop)
+ Dim nVarAddress As Integer
+ If nMachineIndex = 1 Then
+ nVarAddress = 1352
+ ElseIf nMachineIndex = 2 Then
+ nVarAddress = 1352
+ Else Return
+ End If
+ Dim nState As Integer
+ Dim StateVariable As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@STATE")
+ Dim Sent1 As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@SENT_1")
+ Dim Sent2 As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@SENT_2")
+ Dim StartDoorPresence As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@WP_PR_00")
+ Dim EndDoorPresence As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@WP_PR_02")
+ If StateVariable.nValue < 1 OrElse StateVariable.nValue > 5 Then Return
+ Select Case StateVariable.nValue
+ Case 0
+ Return
+ Case 1
+ If nStartStop = 1 AndAlso (StartDoorPresence.dValue = 1 OrElse EndDoorPresence.dValue = 2) AndAlso Sent1.nValue = 1 Then
+ nState = 2
+ Map.refSupervisorFunction.ComWriteShortVar(Sent1.sIndex, 0, nMachineIndex)
+ Else Return
+ End If
+ Case 2
+ If nStartStop = 2 AndAlso EndDoorPresence.dValue = 2 Then
+ nState = 3
+ Else Return
+ End If
+ Case 3
+ If nStartStop = 1 AndAlso StartDoorPresence.dValue = 1 AndAlso Sent2.nValue = 1 Then
+ nState = 4
+ Map.refSupervisorFunction.ComWriteShortVar(Sent2.sIndex, 0, nMachineIndex)
+ Else Return
+ End If
+ Case 4
+ If nStartStop = 2 AndAlso EndDoorPresence.dValue = 2 Then
+ nState = 5
+ Else Return
+ End If
+ Case 5
+ If nStartStop = 1 AndAlso StartDoorPresence.dValue = 1 AndAlso Sent1.nValue = 1 Then
+ nState = 2
+ Map.refSupervisorFunction.ComWriteShortVar(Sent1.sIndex, 0, nMachineIndex)
+ Else Return
+ End If
+ End Select
+ Map.refSupervisorFunction.ComWriteShortVar(nVarAddress, nState, nMachineIndex)
+ End Sub
+
+#End Region ' ManageMachining
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class Variable
+ Inherits VMBase
+
+ Public Enum VariableTypes As Integer
+ [INTEGER] = 1
+ [DOUBLE] = 2
+ [BOOLEAN] = 3
+ End Enum
+
+ Private m_Type As VariableTypes
+ Public ReadOnly Property Type As Integer
+ Get
+ Return m_Type
+ End Get
+ End Property
+
+ Private m_sName As String
+ Public ReadOnly Property sName As String
+ Get
+ Return m_sName
+ End Get
+ End Property
+
+ Private m_sIndex As String
+ Public ReadOnly Property sIndex As String
+ Get
+ Return m_sIndex
+ End Get
+ End Property
+
+ Private m_nMachine As Integer
+ Public ReadOnly Property nMachine As Integer
+ Get
+ Return m_nMachine
+ End Get
+ End Property
+
+ Private m_nValue As Integer
+ Friend ReadOnly Property nValue As Integer
+ Get
+ Return m_nValue
+ End Get
+ End Property
+ Private m_dValue As Double
+ Friend ReadOnly Property dValue As Integer
+ Get
+ Return m_dValue
+ End Get
+ End Property
+ Private m_bValue As Boolean
+ Public Property sValue As String
+ Get
+ Select Case Type
+ Case VariableTypes.INTEGER
+ Return m_nValue.ToString()
+ Case VariableTypes.DOUBLE
+ Return DoubleToString(m_dValue, 2)
+ Case VariableTypes.BOOLEAN
+ Return If(m_bValue, 1, 0)
+ End Select
+ End Get
+ Set(value As String)
+ Select Case Type
+ Case VariableTypes.INTEGER
+ If Not Integer.TryParse(value, m_nValue) Then
+ NotifyPropertyChanged(NameOf(sValue))
+ End If
+ Case VariableTypes.DOUBLE
+ If Not StringToDouble(value, m_dValue) Then
+ NotifyPropertyChanged(NameOf(sValue))
+ End If
+ Case VariableTypes.BOOLEAN
+ Dim nBoolean As Integer = 0
+ If Integer.TryParse(value, nBoolean) Then
+ m_bValue = If(nBoolean > 0, 1, 0)
+ Else
+ NotifyPropertyChanged(NameOf(sValue))
+ End If
+ End Select
+ m_nValue = value
+ End Set
+ End Property
+ Friend Sub SetValue(value As Integer)
+ m_nValue = value
+ NotifyPropertyChanged(NameOf(sValue))
+ End Sub
+ Friend Sub SetValue(value As Double)
+ m_dValue = value
+ NotifyPropertyChanged(NameOf(sValue))
+ End Sub
+ Friend Sub SetValue(value As Boolean)
+ m_bValue = value
+ NotifyPropertyChanged(NameOf(sValue))
+ End Sub
+
+ Sub New(Type As VariableTypes, sName As String, sIndex As String, nMachine As Integer)
+ m_Type = Type
+ m_sName = sName
+ m_sIndex = sIndex
+ m_nMachine = nMachine
+ End Sub
+
+End Class
+
+Public Class LuaDoor
+ Inherits VMBase
+
+ Private m_nId As Integer = -1
+ Public ReadOnly Property nId As Integer
+ Get
+ Return m_nId
+ End Get
+ End Property
+
+ Private m_nCircIndex As Integer = -1
+ Public ReadOnly Property nCircIndex As Integer
+ Get
+ Return m_nCircIndex
+ End Get
+ End Property
+
+ Private m_nState As Integer = 0
+ Public ReadOnly Property nState As Integer
+ Get
+ Return m_nState
+ End Get
+ End Property
+
+ Private m_nDoorPosition As Integer = 0
+ Public ReadOnly Property nDoorPosition As Integer
+ Get
+ Return m_nDoorPosition
+ End Get
+ End Property
+
+ Private m_sDoorCode As String = ""
+ Public ReadOnly Property sDoorCode As String
+ Get
+ Return m_sDoorCode
+ End Get
+ End Property
+
+ Private m_sDoorDescription As String = ""
+ Public ReadOnly Property sDoorDescription As String
+ Get
+ Return m_sDoorDescription
+ End Get
+ End Property
+
+ Private m_sDDFName As String = ""
+ Public ReadOnly Property sDDFName As String
+ Get
+ Return m_sDDFName
+ End Get
+ End Property
+
+ Private m_sCSVName As String = ""
+ Public ReadOnly Property sCSVName As String
+ Get
+ Return m_sCSVName
+ End Get
+ End Property
+
+ Private m_sM1CNPath As String = ""
+ Public ReadOnly Property sM1CNPath As String
+ Get
+ Return m_sM1CNPath
+ End Get
+ End Property
+
+ Private m_sM2CNPath As String = ""
+ Public ReadOnly Property sM2CNPath As String
+ Get
+ Return m_sM2CNPath
+ End Get
+ End Property
+
+ Private m_dtLoadTime As DateTime
+ Public ReadOnly Property sLoadTime As String
+ Get
+ Return m_dtLoadTime.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtMachining1Start As DateTime
+ Public ReadOnly Property sMachining1Start As String
+ Get
+ Return m_dtMachining1Start.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtMachining1End As DateTime
+ Public ReadOnly Property sMachining1End As String
+ Get
+ Return m_dtMachining1End.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtMachining2Start As DateTime
+ Public ReadOnly Property sMachining2Start As String
+ Get
+ Return m_dtMachining2Start.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtMachining2End As DateTime
+ Public ReadOnly Property sMachining2End As String
+ Get
+ Return m_dtMachining2End.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtUnloadTime As DateTime
+ Public ReadOnly Property sUnloadTime As String
+ Get
+ Return m_dtUnloadTime.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Sub New(nId As Integer, nCircIndex As Integer, nState As Integer, nDoorPosition As Integer, sDoorCode As String, sDoorDescription As String, sDDFName As String, sCSVName As String,
+ sM1CNPath As String, sM2CNPath As String, lLoadTime As Long, lMachining1Start As Long, lMachining1End As Long, lMachining2Start As Long, lMachining2End As Long, lUnloadTime As Long)
+ m_nId = nId
+ m_nCircIndex = nCircIndex
+ m_nState = nState
+ m_nDoorPosition = nDoorPosition
+ m_sDoorCode = sDoorCode
+ m_sDoorDescription = sDoorDescription
+ m_sDDFName = sDDFName
+ m_sCSVName = sCSVName
+ m_sM1CNPath = sM1CNPath
+ m_sM2CNPath = sM2CNPath
+ m_dtLoadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(lLoadTime).ToLocalTime()
+ m_dtMachining1Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(lMachining1Start).ToLocalTime()
+ m_dtMachining1End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(lMachining1End).ToLocalTime()
+ m_dtMachining2Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(lMachining2Start).ToLocalTime()
+ m_dtMachining2End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(lMachining2End).ToLocalTime()
+ m_dtUnloadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(lUnloadTime).ToLocalTime()
+ End Sub
+
+End Class
+
+Public Class StringToVisibilityConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If Not TypeOf value Is String OrElse String.IsNullOrWhiteSpace(value) Then Return Visibility.Collapsed
+ Dim sValue As String = value
+ Dim sLowerValue As String = sValue.ToLower()
+ If sLowerValue = "true" Then Return Visibility.Visible
+ If sLowerValue = "false" Then Return Visibility.Collapsed
+ Dim nValue As Integer
+ If Not Integer.TryParse(sValue, nValue) Then Return Visibility.Collapsed
+ Return If(nValue <> 0, Visibility.Visible, Visibility.Collapsed)
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class StringToMachineStateConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If Not TypeOf value Is String OrElse String.IsNullOrWhiteSpace(value) Then Return Visibility.Collapsed
+ Dim sValue As String = value
+ Dim nValue As Integer
+ If Not Integer.TryParse(sValue, nValue) Then Return ""
+ Select Case nValue
+ Case -1
+ Return "Not Initialized"
+ Case 0
+ Return "Reset"
+ Case 1
+ Return "Initialized"
+ Case 2
+ Return "Start machining 1000"
+ Case 3
+ Return "End machining 1000"
+ Case 4
+ Return "Start machining 2000"
+ Case 5
+ Return "End machining 2000"
+ Case Else
+ Return "Unknown State"
+ End Select
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class StringToDDFCalcStateConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If Not TypeOf value Is Integer Then Return value
+ Dim sValue As String = value
+ Dim nValue As Integer = value
+ Select Case nValue
+ Case 0
+ Return "Null"
+ Case 1
+ Return "Running"
+ Case 2
+ Return "Result"
+ Case Else
+ Return value
+ End Select
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class StringToNewDoorStateConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If Not TypeOf value Is Integer Then Return value
+ Dim nValue As Integer = value
+ Select Case nValue
+ Case 0
+ Return "Null"
+ Case 1
+ Return "Present"
+ Case 2
+ Return "Assigned"
+ Case Else
+ Return value
+ End Select
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class StringToBooleanConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If Not TypeOf value Is String OrElse String.IsNullOrWhiteSpace(value) Then Return Nothing
+ Dim sValue As String = value
+ Dim nValue As Integer
+ If Not Integer.TryParse(sValue, nValue) Then Return Nothing
+ If nValue = -1 Then Return Nothing
+ Return nValue <> 0
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class StringToBackgroundConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If Not TypeOf value Is String OrElse String.IsNullOrWhiteSpace(value) Then Return False
+ Dim sValue As String = value
+ Dim nValue As Integer
+ If Not Integer.TryParse(sValue, nValue) Then Return Brushes.LightGray
+ Return If(nValue <> 0, Brushes.Green, Brushes.LightGray)
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class DoorToVisibilityConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If IsNothing(value) OrElse (Not TypeOf value Is LuaDoor AndAlso Not TypeOf value Is RestartDoor) Then Return Visibility.Hidden
+ Return Visibility.Visible
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class StringToStyleConverter
+ Implements IValueConverter
+
+ Dim DoorStyle As Style = Application.Current.TryFindResource("Door")
+ Dim CutOutScrapStyle As Style = Application.Current.TryFindResource("CutOutScrap")
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If Not TypeOf value Is String OrElse String.IsNullOrWhiteSpace(value) Then Return "Door"
+ Dim sValue As String = value
+ Dim sLowerValue As String = sValue.ToLower()
+ If sLowerValue = "true" Then Return "Door"
+ If sLowerValue = "false" Then Return "Door"
+ Dim nValue As Integer
+ If Not Integer.TryParse(sValue, nValue) Then Return "Door"
+ Return If(nValue = 4, CutOutScrapStyle, DoorStyle)
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/MainMenu/MainMenuV.xaml b/Effector.Plugin.FiveLakes/MainMenu/MainMenuV.xaml
new file mode 100644
index 0000000..142cf0f
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/MainMenu/MainMenuV.xaml
@@ -0,0 +1,32 @@
+
+
+ 0
+ 1
+ 2
+
+
+
+
+
+
+
+
+
+
diff --git a/Effector.Plugin.FiveLakes/MainMenu/MainMenuV.xaml.vb b/Effector.Plugin.FiveLakes/MainMenu/MainMenuV.xaml.vb
new file mode 100644
index 0000000..55df891
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/MainMenu/MainMenuV.xaml.vb
@@ -0,0 +1,9 @@
+Imports System.ComponentModel.Composition
+Imports Effector.Plugin.Interface
+
+
+
+Public Class MainMenuV
+ Implements IPluginControl
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/MainMenu/MainMenuVM.vb b/Effector.Plugin.FiveLakes/MainMenu/MainMenuVM.vb
new file mode 100644
index 0000000..5e92528
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/MainMenu/MainMenuVM.vb
@@ -0,0 +1,28 @@
+Public Class MainMenuVM
+ Inherits VMBase
+
+ ' Definizione comandi
+ Private m_cmdPage As ICommand
+
+#Region "COMMANDS"
+
+#Region "Page"
+
+ Public ReadOnly Property Page_Command As ICommand
+ Get
+ If m_cmdPage Is Nothing Then
+ m_cmdPage = New Command(AddressOf Page)
+ End If
+ Return m_cmdPage
+ End Get
+ End Property
+
+ Public Sub Page(nPage As Integer)
+ Map.refFiveLakesUIVM.SetSelPage(nPage)
+ End Sub
+
+#End Region ' Page
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/My Project/AssemblyInfo.vb b/Effector.Plugin.FiveLakes/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..67a798b
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/My Project/AssemblyInfo.vb
@@ -0,0 +1,59 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+Imports System.Globalization
+Imports System.Resources
+Imports 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.
+
+' Review the values of the assembly attributes
+
+
+
+
+
+
+
+
+
+'In order to begin building localizable applications, set
+'CultureYouAreCodingWith in your .vbproj file
+'inside a . For example, if you are using US english
+'in your source files, set the to "en-US". Then uncomment the
+'NeutralResourceLanguage attribute below. Update the "en-US" in the line
+'below to match the UICulture setting in the project file.
+
+'
+
+
+'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found.
+'1st parameter: where theme specific resource dictionaries are located
+'(used if a resource is not found in the page,
+' or application resource dictionaries)
+
+'2nd parameter: where the generic resource dictionary is located
+'(used if a resource is not found in the page,
+'app, and any theme specific resource dictionaries)
+
+
+
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+'
+
+
+
diff --git a/Effector.Plugin.FiveLakes/My Project/Resources.Designer.vb b/Effector.Plugin.FiveLakes/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..e7ecddc
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/My Project/Resources.Designer.vb
@@ -0,0 +1,62 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:$clrversion$
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My.Resources
+
+ '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.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("$safeprojectname$.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set(ByVal value As Global.System.Globalization.CultureInfo)
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Effector.Plugin.FiveLakes/My Project/Resources.resx b/Effector.Plugin.FiveLakes/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/My Project/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/Effector.Plugin.FiveLakes/My Project/Settings.Designer.vb b/Effector.Plugin.FiveLakes/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..8a58064
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' 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.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.Effector.Plugin.FiveLakes.My.MySettings
+ Get
+ Return Global.Effector.Plugin.FiveLakes.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Effector.Plugin.FiveLakes/My Project/Settings.settings b/Effector.Plugin.FiveLakes/My Project/Settings.settings
new file mode 100644
index 0000000..40ed9fd
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerV.xaml b/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerV.xaml
new file mode 100644
index 0000000..d749df5
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerV.xaml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerV.xaml.vb b/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerV.xaml.vb
new file mode 100644
index 0000000..20886ee
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerV.xaml.vb
@@ -0,0 +1,19 @@
+Public Class ProcessManagerV
+
+ Private WithEvents m_ProcessManagerVM As ProcessManagerVM
+
+ Sub New(Owner As Window, ProcessManagerVM As ProcessManagerVM)
+ 'MyBase.New(Owner)
+ Me.Owner = Owner
+ ' This call is required by the designer.
+ InitializeComponent()
+ Me.DataContext = ProcessManagerVM
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_ProcessManagerVM = ProcessManagerVM
+ End Sub
+
+ 'Private Sub CloseWindow(bDialogResult As Boolean) Handles m_ProcessManagerVM.m_CloseWindow
+ ' Me.DialogResult = bDialogResult
+ 'End Sub
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerVM.vb b/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerVM.vb
new file mode 100644
index 0000000..03ddb50
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/ProcessManager/ProcessManagerVM.vb
@@ -0,0 +1,70 @@
+Imports System.Windows.Threading
+Imports System.Collections.ObjectModel
+
+Public Class ProcessManagerVM
+ Inherits VMBase
+
+ Private m_nTaskQuantity As Integer = 3
+
+ Private m_UpdateDataTimer As New DispatcherTimer
+
+ Private m_ExecProcessManager As ExecProcessManager
+ Public ReadOnly Property ExecProcessManager As ExecProcessManager
+ Get
+ Return m_ExecProcessManager
+ End Get
+ End Property
+
+ Public ReadOnly Property ArgumentsQueue As String
+ Get
+ Return m_ExecProcessManager.ArgumentsQueueCount.ToString()
+ End Get
+ End Property
+
+ Public ReadOnly Property ResultQueue As String
+ Get
+ Return m_ExecProcessManager.ArgumentsResultQueueCount.ToString()
+ End Get
+ End Property
+
+ Public ReadOnly Property ThreadList As ObservableCollection(Of ThreadData)
+ Get
+ If Not IsNothing(m_ExecProcessManager.ThreadDataList) Then
+ Return New ObservableCollection(Of ThreadData)(m_ExecProcessManager.ThreadDataList.ToList())
+ Else
+ Return New ObservableCollection(Of ThreadData)
+ End If
+ End Get
+ End Property
+
+ Private m_dProgress_Value As Double
+ Public ReadOnly Property dProgress_Value As Double
+ Get
+ Return (m_dProgress_Maximum - m_nTaskQuantity - m_ExecProcessManager.ArgumentsQueueCount) '/ m_dProgress_Maximum * 100
+ End Get
+ End Property
+
+ Private m_dProgress_Maximum As Double
+ Public ReadOnly Property dProgress_Maximum As Double
+ Get
+ Return m_dProgress_Maximum
+ End Get
+ End Property
+
+ Sub New(ExecProcessManager As ExecProcessManager)
+ m_ExecProcessManager = ExecProcessManager
+ m_dProgress_Maximum = m_ExecProcessManager.ArgumentsQueueCount + m_nTaskQuantity
+ m_UpdateDataTimer.Interval = New TimeSpan(0, 0, 1)
+ AddHandler m_UpdateDataTimer.Tick, AddressOf UpdateDataTimer_Tick
+ m_UpdateDataTimer.Start()
+ End Sub
+
+ Private Sub UpdateDataTimer_Tick(sender As Object, e As EventArgs)
+ NotifyPropertyChanged(NameOf(ArgumentsQueue))
+ NotifyPropertyChanged(NameOf(ResultQueue))
+ NotifyPropertyChanged(NameOf(ThreadList))
+ NotifyPropertyChanged(NameOf(dProgress_Value))
+ End Sub
+
+End Class
+
diff --git a/Effector.Plugin.FiveLakes/RestartWnd/RestartWndV.xaml b/Effector.Plugin.FiveLakes/RestartWnd/RestartWndV.xaml
new file mode 100644
index 0000000..8ef8917
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/RestartWnd/RestartWndV.xaml
@@ -0,0 +1,282 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Effector.Plugin.FiveLakes/RestartWnd/RestartWndV.xaml.vb b/Effector.Plugin.FiveLakes/RestartWnd/RestartWndV.xaml.vb
new file mode 100644
index 0000000..4f5f238
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/RestartWnd/RestartWndV.xaml.vb
@@ -0,0 +1,19 @@
+Public Class RestartWndV
+
+ Private WithEvents m_RestartWndVM As RestartWndVM
+
+ Sub New(Owner As Window, RestartWndVM As RestartWndVM)
+ 'MyBase.New(Owner)
+ Me.Owner = Owner
+ ' This call is required by the designer.
+ InitializeComponent()
+ Me.DataContext = RestartWndVM
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_RestartWndVM = RestartWndVM
+ End Sub
+
+ Private Sub CloseWindow(bDialogResult As Boolean) Handles m_RestartWndVM.m_CloseWindow
+ Me.DialogResult = bDialogResult
+ End Sub
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/RestartWnd/RestartWndVM.vb b/Effector.Plugin.FiveLakes/RestartWnd/RestartWndVM.vb
new file mode 100644
index 0000000..5fa12b8
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/RestartWnd/RestartWndVM.vb
@@ -0,0 +1,435 @@
+Imports Newtonsoft.Json
+Imports Newtonsoft.Json.Linq
+Imports System.Collections.ObjectModel
+Imports System.Globalization
+Imports System.IO
+Imports System.Reflection
+
+Public Class RestartWndVM
+ Inherits VMBase
+
+ Friend Event m_CloseWindow(bDialogResult As Boolean)
+
+ Private m_sTitle As String = ""
+ Public ReadOnly Property sTitle As String
+ Get
+ Return m_sTitle
+ End Get
+ End Property
+
+ Private m_nMachineIndex As Integer = 1
+ Public ReadOnly Property nMachineIndex As Integer
+ Get
+ Return m_nMachineIndex
+ End Get
+ End Property
+
+ Private m_RestartDoorList As ObservableCollection(Of RestartDoor)
+ Public ReadOnly Property RestartDoorList As ObservableCollection(Of RestartDoor)
+ Get
+ Return m_RestartDoorList
+ End Get
+ End Property
+
+ Private m_sMachineImagePath As String
+ Public ReadOnly Property sMachineImagePath As String
+ Get
+ Return m_sMachineImagePath
+ End Get
+ End Property
+
+ 'Private m_DoorOnMachineArray(4) As RestartDoor
+ 'Public ReadOnly Property DoorOnMachineArray As RestartDoor()
+ ' Get
+ ' Return m_DoorOnMachineArray
+ ' End Get
+ 'End Property
+
+ Private m_DoorOnMachineArray As New ObservableCollection(Of RestartDoor)
+ Public ReadOnly Property DoorOnMachineArray As ObservableCollection(Of RestartDoor)
+ Get
+ Return m_DoorOnMachineArray
+ End Get
+ End Property
+
+ Public ReadOnly Property VariableList As ObservableCollection(Of Variable)
+ Get
+ Return Map.refMachinePageVM.VariableList
+ End Get
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdOk As ICommand
+ Private m_cmdEmpty As ICommand
+
+#Region "CONSTRUCTOR"
+
+ Sub New(nMachineIndex As Integer)
+ m_nMachineIndex = nMachineIndex
+ m_sTitle = "Machine " & m_nMachineIndex
+ If Map.refSupervisorFunction.PlgGetPrivateProfileInt(S_NC, K_NC_SIMULATE, 0) > 0 Then
+ For nIndex = 0 To 4
+ Dim dValue As Double = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORPRESENCE & "M" & m_nMachineIndex & "P" & nIndex, 0)
+ WriteVariableValueToName(nMachineIndex, "@WP_PR_0" & nIndex.ToString(), dValue)
+ Dim nValue As Integer = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORINDEX & "M" & m_nMachineIndex & "P" & nIndex, 0)
+ WriteVariableValueToName(nMachineIndex, "@DOORN_S" & nIndex.ToString(), nValue)
+ Next
+ End If
+ Dim sBackupFilePath As String = ""
+ GetPluginPrivateProfileString("General", "BackupDir", "", sBackupFilePath)
+ sBackupFilePath &= "\LuaBackup.json"
+
+ Dim JsonLuaDoorList As List(Of JsonLuaDoor)
+ If File.Exists(sBackupFilePath) Then
+ Dim sReadedFile As String = File.ReadAllText(sBackupFilePath)
+ JsonLuaDoorList = JsonConvert.DeserializeObject(Of List(Of JsonLuaDoor))(sReadedFile)
+ JsonLuaDoorList = JsonLuaDoorList.OrderBy(Of Integer)(Function(x) x.nCircIndex).ToList()
+ End If
+
+ ' creo posti in lista descrizioni
+ For nIndex As Integer = 0 To 4
+ m_DoorOnMachineArray.Add(Nothing)
+ Next
+
+ ' leggo presenze porta
+ For nPositionIndex As Integer = 4 To 0 Step -1
+ Dim dWPValue As Double = 0
+ GetVariableValueFromName(nMachineIndex, "@WP_PR_0" & nPositionIndex.ToString(), dWPValue)
+ If dWPValue <> 0 Then
+ ' verifico indice
+ Dim nCircindex As Integer = 0
+ GetVariableValueFromName(nMachineIndex, "@DOORN_S" & nPositionIndex.ToString(), nCircindex)
+ If nCircindex <> 0 Then
+ m_DoorOnMachineArray(nPositionIndex) = New RestartDoor(JsonLuaDoorList(nCircindex - 1))
+ End If
+ End If
+ Next
+ NotifyPropertyChanged(NameOf(DoorOnMachineArray))
+
+
+ 'If File.Exists(sBackupFilePath) Then
+ ' Dim sReadedFile As String = File.ReadAllText(sBackupFilePath)
+
+ ' Dim JsonLuaDoorList As List(Of JsonLuaDoor) = JsonConvert.DeserializeObject(Of List(Of JsonLuaDoor))(sReadedFile)
+ ' JsonLuaDoorList = JsonLuaDoorList.OrderBy(Of Integer)(Function(x) x.nCircIndex).ToList()
+
+ ' m_RestartDoorList = New ObservableCollection(Of RestartDoor)((From JsonLuaDoor In Map.refDoorListPageVM.DoorList
+ ' Select New RestartDoor(JsonLuaDoor)).ToList())
+ ' For JsonLuaDoorIndex = 0 To JsonLuaDoorList.Count - 1
+ ' Dim JsonLuaDoor As JsonLuaDoor = JsonLuaDoorList(JsonLuaDoorIndex)
+ ' Dim RestartDoor As RestartDoor = m_RestartDoorList.FirstOrDefault(Function(x) x.nId = JsonLuaDoor.nId)
+ ' If Not IsNothing(RestartDoor) Then
+ ' RestartDoor.Update(JsonLuaDoor)
+ ' End If
+
+
+ ' Next
+
+ 'End If
+
+
+
+ ' se macchina 1
+ Dim sResourcesDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, K_RESOURCESDIR, "", sResourcesDirPath)
+ m_sMachineImagePath = sResourcesDirPath & "\Multiax-C1223Ripartenza.png"
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Public Shared Function GetVariableValueFromName(nMachIndex As Integer, sName As String, ByRef nValue As Integer) As Boolean
+ Dim Variable As Variable = Map.refMachinePageVM.VariableList.FirstOrDefault(Function(x) x.nMachine = nMachIndex AndAlso x.sName = sName)
+ If IsNothing(Variable) Then Return False
+ Dim nIndex As Integer = 0
+ If Not Integer.TryParse(Variable.sIndex, nIndex) Then Return False
+ Return Map.refSupervisorFunction.ComReadShortVar(nIndex, nValue, nMachIndex)
+ End Function
+
+ Public Shared Function GetVariableValueFromName(nMachIndex As Integer, sName As String, ByRef dValue As Double) As Boolean
+ Dim Variable As Variable = Map.refMachinePageVM.VariableList.FirstOrDefault(Function(x) x.nMachine = nMachIndex AndAlso x.sName = sName)
+ If IsNothing(Variable) Then Return False
+ Dim nIndex As Integer = 0
+ If Not Integer.TryParse(Variable.sIndex, nIndex) Then Return False
+ Return Map.refSupervisorFunction.ComReadDoubleVar(nIndex, dValue, nMachIndex)
+ End Function
+
+ Public Shared Function WriteVariableValueToName(nMachIndex As Integer, sName As String, nValue As Integer) As Boolean
+ Dim Variable As Variable = Map.refMachinePageVM.VariableList.FirstOrDefault(Function(x) x.nMachine = nMachIndex AndAlso x.sName = sName)
+ If IsNothing(Variable) Then Return False
+ Dim nIndex As Integer = 0
+ If Not Integer.TryParse(Variable.sIndex, nIndex) Then Return False
+ Return Map.refSupervisorFunction.ComWriteShortVar(nIndex, nValue, nMachIndex)
+ End Function
+
+ Public Shared Function WriteVariableValueToName(nMachIndex As Integer, sName As String, dValue As Double) As Boolean
+ Dim Variable As Variable = Map.refMachinePageVM.VariableList.FirstOrDefault(Function(x) x.nMachine = nMachIndex AndAlso x.sName = sName)
+ If IsNothing(Variable) Then Return False
+ Dim nIndex As Integer = 0
+ If Not Integer.TryParse(Variable.sIndex, nIndex) Then Return False
+ Return Map.refSupervisorFunction.ComWriteDoubleVar(nIndex, dValue, nMachIndex)
+ End Function
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+#Region "Ok"
+
+ Public ReadOnly Property Ok_Command As ICommand
+ Get
+ If m_cmdOk Is Nothing Then
+ m_cmdOk = New Command(AddressOf Ok)
+ End If
+ Return m_cmdOk
+ End Get
+ End Property
+
+ Public Sub Ok()
+ RaiseEvent m_CloseWindow(True)
+ End Sub
+
+#End Region ' Ok
+
+#Region "Empty"
+
+ Public ReadOnly Property Empty_Command As ICommand
+ Get
+ If m_cmdEmpty Is Nothing Then
+ m_cmdEmpty = New Command(AddressOf Empty)
+ End If
+ Return m_cmdEmpty
+ End Get
+ End Property
+
+ Public Sub Empty()
+ Map.refDoorListPageVM.ResetProductionQueue()
+ Map.refDoorListPageVM.WriteBackup()
+ RaiseEvent m_CloseWindow(False)
+ End Sub
+
+#End Region ' Empty
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class StateToVisibilityConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If IsNothing(value) OrElse Not TypeOf value Is Integer Then Return Visibility.Collapsed
+ Return If(value > 0, Visibility.Visible, Visibility.Collapsed)
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class VariableNameToVisibilityConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
+ If IsNothing(value) OrElse Not TypeOf value Is Integer Then Return Visibility.Collapsed
+ If IsNothing(parameter) OrElse Not TypeOf parameter Is String OrElse String.IsNullOrWhiteSpace(parameter) Then Return Visibility.Collapsed
+ Dim nMachineIndex As Integer = 0
+ If Not Integer.TryParse(value, nMachineIndex) Then Return Visibility.Collapsed
+ Dim dWPValue As Double = 0
+ RestartWndVM.GetVariableValueFromName(nMachineIndex, "@" & parameter, dWPValue)
+ Return If(dWPValue = 1 OrElse dWPValue = 2 OrElse dWPValue = 3, Visibility.Visible, Visibility.Collapsed)
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Throw New NotImplementedException()
+ End Function
+
+End Class
+
+Public Class RestartDoor
+ Inherits VMBase
+
+ Private m_nId As Integer = -1
+ Public ReadOnly Property nId As Integer
+ Get
+ Return m_nId
+ End Get
+ End Property
+
+ Private m_nCircIndex As Integer = -1
+ Public ReadOnly Property nCircIndex As Integer
+ Get
+ Return m_nCircIndex
+ End Get
+ End Property
+
+ Private m_nState As Integer = 0
+ Public ReadOnly Property nState As Integer
+ Get
+ Return m_nState
+ End Get
+ End Property
+
+ Private m_DoorStateList As New List(Of IdNameStruct)({New IdNameStruct(0, "Not On Machine"),
+ New IdNameStruct(1, "Imported"),
+ New IdNameStruct(2, "On Load"),
+ New IdNameStruct(3, "On Machine 1"),
+ New IdNameStruct(4, "On Medium Station"),
+ New IdNameStruct(6, "On Machine 2"),
+ New IdNameStruct(7, "On Unload"),
+ New IdNameStruct(8, "Produced"),
+ New IdNameStruct(100, "Scrap")})
+ Public ReadOnly Property DoorStateList As List(Of IdNameStruct)
+ Get
+ Return m_DoorStateList
+ End Get
+ End Property
+
+ Public Property SelDoorState As IdNameStruct
+ Get
+ Return m_DoorStateList.FirstOrDefault(Function(x) x.Id = m_nState)
+ End Get
+ Set(value As IdNameStruct)
+ m_nState = value.Id
+ End Set
+ End Property
+
+ Private m_sDoorCode As String = ""
+ Public ReadOnly Property sDoorCode As String
+ Get
+ Return m_sDoorCode
+ End Get
+ End Property
+
+ Private m_sDoorDescription As String = ""
+ Public ReadOnly Property sDoorDescription As String
+ Get
+ Return m_sDoorDescription
+ End Get
+ End Property
+
+ Private m_sDDFName As String = ""
+ Public ReadOnly Property sDDFName As String
+ Get
+ Return m_sDDFName
+ End Get
+ End Property
+
+ Private m_sCSVName As String = ""
+ Public ReadOnly Property sCSVName As String
+ Get
+ Return m_sCSVName
+ End Get
+ End Property
+
+ Private m_sM1CNPath As String = ""
+ Public ReadOnly Property sM1CNPath As String
+ Get
+ Return m_sM1CNPath
+ End Get
+ End Property
+
+ Private m_sM2CNPath As String = ""
+ Public ReadOnly Property sM2CNPath As String
+ Get
+ Return m_sM2CNPath
+ End Get
+ End Property
+
+ Private m_dtLoadTime As DateTime
+ Public ReadOnly Property sLoadTime As String
+ Get
+ Return m_dtLoadTime.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtMachining1Start As DateTime
+ Public ReadOnly Property sMachining1Start As String
+ Get
+ Return m_dtMachining1Start.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtMachining1End As DateTime
+ Public ReadOnly Property sMachining1End As String
+ Get
+ Return m_dtMachining1End.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtMachining2Start As DateTime
+ Public ReadOnly Property sMachining2Start As String
+ Get
+ Return m_dtMachining2Start.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtMachining2End As DateTime
+ Public ReadOnly Property sMachining2End As String
+ Get
+ Return m_dtMachining2End.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Private m_dtUnloadTime As DateTime
+ Public ReadOnly Property sUnloadTime As String
+ Get
+ Return m_dtUnloadTime.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+
+ Sub New(Id As Integer, IndiceCirc As Integer, Stato As Integer, CodicePorta As String, DescrizionePorta As String, NomeDDF As String, NomeCSV As String,
+ CN_macchina_1 As String, CN_macchina_2 As String, tempo_carico As Long, tempo_inizio_lav_1 As Long, tempo_fine_lav_1 As Long, tempo_inizio_lav_2 As Long,
+ tempo_fine_lav_2 As Long, tempo_scarico As Long)
+ m_nId = Id
+ m_nCircIndex = IndiceCirc
+ m_nState = Stato
+ m_sDoorCode = CodicePorta
+ m_sDoorDescription = DescrizionePorta
+ m_sDDFName = NomeDDF
+ m_sCSVName = NomeCSV
+ m_sM1CNPath = CN_macchina_1
+ m_sM2CNPath = CN_macchina_2
+ m_dtLoadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(tempo_carico).ToLocalTime()
+ m_dtMachining1Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(tempo_inizio_lav_1).ToLocalTime()
+ m_dtMachining1End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(tempo_fine_lav_1).ToLocalTime()
+ m_dtMachining2Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(tempo_inizio_lav_2).ToLocalTime()
+ m_dtMachining2End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(tempo_fine_lav_2).ToLocalTime()
+ m_dtUnloadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(tempo_scarico).ToLocalTime()
+ End Sub
+
+ Sub New(Door As Door)
+ m_nId = Door.nId
+ m_nCircIndex = 0
+ m_nState = 0
+ m_sDDFName = Door.sDDFName
+ m_sCSVName = Door.sCSVName
+ m_sM1CNPath = ""
+ m_sM2CNPath = ""
+ m_dtLoadTime = DateTime.MinValue
+ m_dtMachining1Start = DateTime.MinValue
+ m_dtMachining1End = DateTime.MinValue
+ m_dtMachining2Start = DateTime.MinValue
+ m_dtMachining2End = DateTime.MinValue
+ m_dtUnloadTime = DateTime.MinValue
+ End Sub
+
+ Friend Sub New(JsonLuaDoor As JsonLuaDoor)
+ m_nId = JsonLuaDoor.nId
+ m_nCircIndex = JsonLuaDoor.nCircIndex
+ m_nState = JsonLuaDoor.nState
+ m_sDDFName = JsonLuaDoor.sDDFName
+ m_sCSVName = JsonLuaDoor.sCSVName
+ m_sM1CNPath = JsonLuaDoor.sM1CNPath
+ m_sM2CNPath = JsonLuaDoor.sM2CNPath
+ m_dtLoadTime = JsonLuaDoor.dtLoadTime
+ m_dtMachining1Start = JsonLuaDoor.dtMachining1Start
+ m_dtMachining1End = JsonLuaDoor.dtMachining1End
+ m_dtMachining2Start = JsonLuaDoor.dtMachining2Start
+ m_dtMachining2End = JsonLuaDoor.dtMachining2End
+ m_dtUnloadTime = JsonLuaDoor.dtUnloadTime
+ End Sub
+
+End Class
\ No newline at end of file
diff --git a/Effector.Plugin.FiveLakes/StatisticsPage/StatisticsPageV.xaml b/Effector.Plugin.FiveLakes/StatisticsPage/StatisticsPageV.xaml
new file mode 100644
index 0000000..1130f54
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/StatisticsPage/StatisticsPageV.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/Effector.Plugin.FiveLakes/StatisticsPage/StatisticsPageV.xaml.vb b/Effector.Plugin.FiveLakes/StatisticsPage/StatisticsPageV.xaml.vb
new file mode 100644
index 0000000..2113c27
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/StatisticsPage/StatisticsPageV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class StatisticsPageV
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/StatisticsPage/StatisticsPageVM.vb b/Effector.Plugin.FiveLakes/StatisticsPage/StatisticsPageVM.vb
new file mode 100644
index 0000000..209e57c
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/StatisticsPage/StatisticsPageVM.vb
@@ -0,0 +1,3 @@
+Public Class StatisticsPageVM
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/Utility/Command.vb b/Effector.Plugin.FiveLakes/Utility/Command.vb
new file mode 100644
index 0000000..f9e3baf
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Utility/Command.vb
@@ -0,0 +1,69 @@
+
+'''
+''' A command whose sole purpose is to
+''' relay its functionality to other
+''' objects by invoking delegates. The
+''' default return value for the CanExecute
+''' method is 'true'.
+'''
+Public Class Command
+ Implements ICommand
+
+#Region "Fields"
+
+ Private ReadOnly _execute As Action(Of Object)
+ Private ReadOnly _canExecute As Predicate(Of Object)
+
+#End Region ' Fields
+
+#Region "Constructors"
+
+ '''
+ ''' Creates a new command that can always execute.
+ '''
+ ''' The execution logic.
+ Public Sub New(ByVal execute As Action(Of Object))
+ Me.New(execute, Nothing)
+ End Sub
+
+ '''
+ ''' Creates a new command.
+ '''
+ ''' The execution logic.
+ ''' The execution status logic.
+ Public Sub New(ByVal execute As Action(Of Object), ByVal canExecute As Predicate(Of Object))
+ If execute Is Nothing Then
+ Throw New ArgumentNullException("execute")
+ End If
+
+ _execute = execute
+ _canExecute = canExecute
+ End Sub
+
+#End Region ' Constructors
+
+#Region "ICommand Members"
+
+ _
+ Public Function CanExecute(ByVal parameter As Object) As Boolean Implements ICommand.CanExecute
+ Return If(_canExecute Is Nothing, True, _canExecute(parameter))
+ End Function
+
+ Public Custom Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
+ AddHandler(ByVal value As EventHandler)
+ AddHandler CommandManager.RequerySuggested, value
+ End AddHandler
+ RemoveHandler(ByVal value As EventHandler)
+ RemoveHandler CommandManager.RequerySuggested, value
+ End RemoveHandler
+ RaiseEvent(ByVal sender As System.Object, ByVal e As System.EventArgs)
+ End RaiseEvent
+ End Event
+
+ Public Sub Execute(ByVal parameter As Object) Implements ICommand.Execute
+ _execute(parameter)
+ End Sub
+
+#End Region ' ICommand Members
+
+End Class
\ No newline at end of file
diff --git a/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml b/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml
new file mode 100644
index 0000000..f206425
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ None
+
+
+
+ 30
+ 2
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml.vb b/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml.vb
new file mode 100644
index 0000000..a33f325
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Utility/Dictionary.xaml.vb
@@ -0,0 +1,108 @@
+Imports System.ComponentModel.Composition
+Imports System.Globalization
+Imports Effector.Plugin.Interface
+
+
+
+Public Class Dictionary
+ Inherits ResourceDictionary
+ Implements IPluginControl
+
+ Public Shared ReadOnly MySceneHostVM As String = "MySceneHostVM"
+
+#Region "Colors"
+
+ 'Private m_Omag_Red As SolidColorBrush = Brushes.Red
+ 'Public ReadOnly Property Omag_Red As SolidColorBrush
+ ' Get
+ ' Return m_Omag_Red
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Button_Static_Background As SolidColorBrush = New BrushConverter().ConvertFrom("#FFDDDDDD")
+ 'Public Shared ReadOnly Property Button_Static_Background As SolidColorBrush
+ ' Get
+ ' Return m_Button_Static_Background
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_TabControl_Header_Background As LinearGradientBrush = Application.Current.FindResource("TabItem.Static.Background")
+ 'Public Shared ReadOnly Property TabControl_Header_Background As LinearGradientBrush
+ ' Get
+ ' Return m_TabControl_Header_Background
+ ' End Get
+ 'End Property
+
+
+ 'Private Shared m_Icarus_Gray As SolidColorBrush = Application.Current.FindResource("Icarus_Gray")
+ 'Public Shared ReadOnly Property Icarus_Gray As SolidColorBrush
+ ' Get
+ ' Return m_Icarus_Gray
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Icarus_LightBlue As SolidColorBrush = Application.Current.FindResource("Icarus_LightBlue")
+ 'Public Shared ReadOnly Property Icarus_LightBlue As SolidColorBrush
+ ' Get
+ ' Return m_Icarus_LightBlue
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Icarus_Blue As SolidColorBrush = Application.Current.FindResource("Icarus_Blue")
+ 'Public Shared ReadOnly Property Icarus_Blue As SolidColorBrush
+ ' Get
+ ' Return m_Icarus_Blue
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Icarus_Green As SolidColorBrush = Application.Current.FindResource("Icarus_Green")
+ 'Public Shared ReadOnly Property Icarus_Green As SolidColorBrush
+ ' Get
+ ' Return m_Icarus_Green
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Icarus_Orange As SolidColorBrush = Application.Current.FindResource("Icarus_Orange")
+ 'Public Shared ReadOnly Property Icarus_Orange As SolidColorBrush
+ ' Get
+ ' Return m_Icarus_Orange
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Icarus_Purple As SolidColorBrush = Application.Current.FindResource("Icarus_Purple")
+ 'Public Shared ReadOnly Property Icarus_Purple As SolidColorBrush
+ ' Get
+ ' Return m_Icarus_Purple
+ ' End Get
+ 'End Property
+
+ '
+ '
+ '
+ '
+ '
+ '
+
+#End Region ' Colors
+
+End Class
+
+Public Class CenterToolTipConverter
+ Implements IMultiValueConverter
+
+ Public Function Convert(ByVal values As Object(), ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IMultiValueConverter.Convert
+ For Each value In values
+ If TypeOf (value) IsNot Double Then
+ Return Double.NaN
+ End If
+ Next
+ Dim dPlacementTarget As Double = CDbl(values(0))
+ Dim dToolTip As Double = CDbl(values(1))
+ Return (dPlacementTarget / 2.0) - (dToolTip / 2.0)
+ End Function
+
+ Public Function ConvertBack(ByVal value As Object, ByVal targetTypes As Type(), ByVal parameter As Object, ByVal culture As CultureInfo) As Object() Implements IMultiValueConverter.ConvertBack
+ Throw New NotSupportedException()
+ End Function
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/Utility/ExecProcessManager.vb b/Effector.Plugin.FiveLakes/Utility/ExecProcessManager.vb
new file mode 100644
index 0000000..23919df
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Utility/ExecProcessManager.vb
@@ -0,0 +1,711 @@
+Imports System.IO
+Imports System.Threading
+Imports MS.Internal
+Imports Effector.Plugin.FiveLakes.ThreadData
+Imports System.Windows.Threading
+
+Public Class ExecProcessManager
+
+ Public Event m_AllArgsProcessed()
+
+ Public Enum ExecutionThreadStatuses As Integer
+ RUNNING = 1
+ STOPPED = 2
+ End Enum
+
+ Private Enum ProcessManagerStates
+ NULL = 0
+ OPEN = 1
+ CLOSE = 2
+ End Enum
+
+ Private m_ProcessManagerTimer As New DispatcherTimer
+ Private m_ProcessManagerState As ProcessManagerStates
+ Private m_ProcessManagerV As ProcessManagerV
+ Public ReadOnly Property ProcessManagerV As ProcessManagerV
+ Get
+ Return m_ProcessManagerV
+ End Get
+ End Property
+
+ ' riferimento al thread principale
+ Private m_ExecutionThread As Thread
+ Private m_ExecutionThreadStatus As ExecutionThreadStatuses = ExecutionThreadStatuses.STOPPED
+ Public ReadOnly Property ExecutionThreadStatus As ExecutionThreadStatuses
+ Get
+ Return m_ExecutionThreadStatus
+ End Get
+ End Property
+ ' array dei thread
+ Private m_ThreadList As Thread()
+ ' array dei dati dei thread
+ Private m_ThreadDataList As ThreadData()
+ Friend ReadOnly Property ThreadDataList As ThreadData()
+ Get
+ Return m_ThreadDataList
+ End Get
+ End Property
+ ' variabile che ferma i processi
+ Private m_bStopProcess As Boolean = False
+ ' variabile che conferma chiusura dei processi
+ Private m_bExecutionThreadStoped As Boolean = False
+ ' numero massimo di istanze del cam
+ Private m_MaxCamInstances As Integer = 1
+ ' nome dell'eseguibile da lanciare
+ Private m_sProcessFileName As String = ""
+ ' stringa di argomenti dell'eseguibile da lanciare
+ Private m_sProcessArguments As String = ""
+ ' coda delle cose da eseguire
+ Private ArgumentsQueueLock As New Object
+ Private m_ArgumentsQueue As New Queue(Of ProcessArgs)
+ Public ReadOnly Property ArgumentsQueue As Queue(Of ProcessArgs)
+ Get
+ Return m_ArgumentsQueue
+ End Get
+ End Property
+ ' coda dei risultati
+ Private ArgumentsResultQueueLock As New Object
+ Private m_ArgumentsResultQueue As New Queue(Of ProcessArgsResult)
+ Public ReadOnly Property ArgumentsResultQueue As Queue(Of ProcessArgsResult)
+ Get
+ Return m_ArgumentsResultQueue
+ End Get
+ End Property
+
+ ' funzione che richiede prossimo elemento da processare
+ Private m_delGetNextProcessArgs As Func(Of ProcessArgs)
+ Public Sub SetGetNextProcessArgs(GetNextProcessArgs As Func(Of ProcessArgs))
+ m_delGetNextProcessArgs = GetNextProcessArgs
+ End Sub
+ ' funzione di pre processing dell'elemento
+ Private m_delPreProcess As Func(Of ProcessArgs, ProcessArgs)
+ Public Sub SetPreProcess(PreProcess As Func(Of ProcessArgs, ProcessArgs))
+ m_delPreProcess = PreProcess
+ End Sub
+ ' funzione di post processing dell'elemento
+ Private m_delPostProcess As Action(Of ProcessArgsResult)
+ Public Sub SetPostProcess(PostProcess As Action(Of ProcessArgsResult))
+ m_delPostProcess = PostProcess
+ End Sub
+
+ Sub New(sProcessFileName As String, sProcessArguments As String)
+ m_sProcessFileName = sProcessFileName
+ m_sProcessArguments = sProcessArguments
+ m_ProcessManagerTimer.Interval = New TimeSpan(0, 0, 1)
+ AddHandler m_ProcessManagerTimer.Tick, AddressOf ProcessManagerTimer_Tick
+ m_ProcessManagerTimer.Start()
+ End Sub
+
+ Private Sub ProcessManagerTimer_Tick(sender As Object, e As EventArgs)
+ Select Case m_ProcessManagerState
+ Case ProcessManagerStates.OPEN
+ ' creo finestra statistiche processi
+ m_ProcessManagerV = New ProcessManagerV(Application.Current.MainWindow, New ProcessManagerVM(Me))
+ ProcessManagerV.Show()
+ m_ProcessManagerState = ProcessManagerStates.NULL
+ Case ProcessManagerStates.CLOSE
+ ' chiudo finestra statistiche processi
+ If Not IsNothing(m_ProcessManagerV) Then
+ ProcessManagerV.Close()
+ m_ProcessManagerV = Nothing
+ End If
+ m_ProcessManagerState = ProcessManagerStates.NULL
+ End Select
+ End Sub
+
+ Public Function ArgumentsEnqueue(ProcessArgs As ProcessArgs) As Boolean
+ If ProcessArgs.nId <= 0 OrElse String.IsNullOrWhiteSpace(ProcessArgs.sArgs) Then Return False
+ SyncLock ArgumentsQueueLock
+ m_ArgumentsQueue.Enqueue(ProcessArgs)
+ End SyncLock
+ Return True
+ End Function
+
+ Public Function ArgumentsDequeue() As ProcessArgs
+ Dim DequeueProcessArgs As ProcessArgs = Nothing
+ SyncLock ArgumentsQueueLock
+ If m_ArgumentsQueue.Count > 0 Then
+ DequeueProcessArgs = m_ArgumentsQueue.Dequeue()
+ End If
+ End SyncLock
+ Return DequeueProcessArgs
+ End Function
+
+ Public Function ArgumentsQueueCount() As Integer
+ Dim nCount As Integer = 0
+ SyncLock ArgumentsQueueLock
+ nCount = m_ArgumentsQueue.Count
+ End SyncLock
+ Return nCount
+ End Function
+
+ Public Function ArgumentsResultEnqueue(ProcessArgsResult As ProcessArgsResult) As Boolean
+ SyncLock ArgumentsResultQueueLock
+ m_ArgumentsResultQueue.Enqueue(ProcessArgsResult)
+ End SyncLock
+ Return True
+ End Function
+
+ Public Function ArgumentsResultDequeue() As ProcessArgsResult
+ Dim DequeueProcessArgsResult As ProcessArgsResult = Nothing
+ SyncLock ArgumentsResultQueueLock
+ If m_ArgumentsResultQueue.Count > 0 Then
+ DequeueProcessArgsResult = m_ArgumentsResultQueue.Dequeue()
+ End If
+ End SyncLock
+ Return DequeueProcessArgsResult
+ End Function
+
+ Public Function ArgumentsResultQueueCount() As Integer
+ Dim nCount As Integer = 0
+ SyncLock ArgumentsResultQueueLock
+ nCount = m_ArgumentsResultQueue.Count
+ End SyncLock
+ Return nCount
+ End Function
+
+ Public Sub SetMaxCamInstances(nValue As Integer)
+ ' Numero di core logici da utilizzare (minimo tra presenti sul PC e imposti da INI)
+ Dim nMaxThread As Integer = Math.Min(Environment.ProcessorCount, nValue)
+ m_MaxCamInstances = nMaxThread
+ End Sub
+
+ ' funzione che avvia thread principale
+ Public Sub StartExecutionThread()
+ If m_ExecutionThreadStatus = ExecutionThreadStatuses.RUNNING Then Return
+ m_bStopProcess = False
+ m_bExecutionThreadStoped = False
+ m_ExecutionThread = New Thread(Sub()
+ ExecutionProcess()
+ End Sub)
+
+ m_ExecutionThread.SetApartmentState(ApartmentState.STA)
+ ' avvio thread di gestione della macchina che avvia la connessione
+ m_ExecutionThread.Start()
+
+ m_ExecutionThreadStatus = ExecutionThreadStatuses.RUNNING
+ ' lancio apertura finestra statistiche processi
+ m_ProcessManagerState = ProcessManagerStates.OPEN
+ End Sub
+
+ Public Sub StopExecutionThread()
+ If m_ExecutionThreadStatus = ExecutionThreadStatuses.STOPPED Then Return
+ m_bStopProcess = True
+ While Not m_bExecutionThreadStoped
+ Thread.Sleep(100)
+ End While
+ If Not IsNothing(m_ExecutionThread) Then
+ m_ExecutionThread.Abort()
+ While Not m_ExecutionThread.ThreadState = ThreadState.Aborted
+ Thread.Sleep(100)
+ End While
+ m_ExecutionThread = Nothing
+ End If
+ m_ThreadList = Nothing
+ m_ExecutionThreadStatus = ExecutionThreadStatuses.STOPPED
+ ' lancio chiusura finestra statistiche processi
+ m_ProcessManagerState = ProcessManagerStates.CLOSE
+ End Sub
+
+ ' funzione di esecuzione del thread principale che gestice i processi
+ Private Sub ExecutionProcess()
+ Dim bStopMainProcess As Boolean = False
+ Dim nStartingProc As Integer = 0
+ While Not bStopMainProcess
+ bStopMainProcess = m_bStopProcess
+ ' se processo fermato, fermo i thread
+ If bStopMainProcess Then
+ If Not IsNothing(m_ThreadList) AndAlso m_ThreadList.Count > 0 AndAlso Not IsNothing(m_ThreadList(0)) Then
+ ' li fermo
+ m_bStopProcess = True
+ ' verifico siano terminati
+ Dim bOneNotEnded As Boolean = True
+ While bOneNotEnded
+ bOneNotEnded = False
+ For Each Thread In m_ThreadList
+ If Not IsNothing(Thread) Then
+ If Thread.IsAlive Then
+ bOneNotEnded = True
+ End If
+ End If
+ Next
+ End While
+ ' pulisco la lista
+ For ThreadIndex = 0 To m_ThreadList.Count - 1
+ m_ThreadList(ThreadIndex) = Nothing
+ Next
+ m_bStopProcess = False
+ End If
+ m_bExecutionThreadStoped = True
+ Return
+ End If
+ ' se lista processi nulla o vuota, li faccio partire
+ If (IsNothing(m_ThreadList) OrElse m_ThreadList.Count = 0) Then
+ m_ThreadList = New Thread(m_MaxCamInstances - 1) {}
+ m_ThreadDataList = New ThreadData(m_MaxCamInstances - 1) {}
+ For nThreadIndex = 0 To m_MaxCamInstances - 1
+ Dim ThreadId As Integer = nThreadIndex
+ m_ThreadList(nThreadIndex) = New Thread(Sub()
+ ThreadFunction(ThreadId)
+ End Sub)
+ m_ThreadList(nThreadIndex).SetApartmentState(ApartmentState.STA)
+ ' avvio thread di gestione della macchina che avvia la connessione
+ m_ThreadList(nThreadIndex).Start()
+ Thread.Sleep(100)
+ Next
+ End If
+ ' se qualche processo in stop, lo faccio ripartire
+ For ThreadIndex = 0 To m_ThreadList.Count - 1
+ If ThreadIndex < m_ThreadList.Count Then
+ Dim Thread = m_ThreadList(ThreadIndex)
+ If Not IsNothing(Thread) Then
+ If Thread.ThreadState = ThreadState.Stopped OrElse
+ Thread.ThreadState = ThreadState.Aborted OrElse
+ Thread.ThreadState = ThreadState.Suspended OrElse
+ (Not m_ThreadDataList(ThreadIndex).ProcessStatus = ProcessStatuses.TOBESTARTED AndAlso
+ (IsNothing(m_ThreadDataList(ThreadIndex).Process) OrElse
+ (Not IsNothing(m_ThreadDataList(ThreadIndex).Process) AndAlso m_ThreadDataList(ThreadIndex).Process.HasExited))) Then
+ ' inserire un ritardo di rilancio?
+ ' lo chiudo e rilancio
+ 'Thread.Sleep(500)
+ Thread.Abort()
+ Thread.Sleep(100)
+ While Not Thread.ThreadState = ThreadState.Aborted
+ Thread.Sleep(100)
+ End While
+ Thread = Nothing
+ Dim ThreadId As Integer = ThreadIndex
+ m_ThreadList(ThreadIndex) = New Thread(Sub()
+ ThreadFunction(ThreadId)
+ End Sub)
+ m_ThreadList(ThreadIndex).SetApartmentState(ApartmentState.STA)
+ ' avvio thread di gestione della macchina che avvia la connessione
+ m_ThreadList(ThreadIndex).Start()
+ End If
+ Else
+ Dim ThreadId As Integer = ThreadIndex
+ If ThreadIndex < m_ThreadList.Count Then
+ m_ThreadList(ThreadIndex) = New Thread(Sub()
+ ThreadFunction(ThreadId)
+ End Sub)
+ m_ThreadList(ThreadIndex).SetApartmentState(ApartmentState.STA)
+ ' avvio thread di gestione della macchina che avvia la connessione
+ m_ThreadList(ThreadIndex).Start()
+ End If
+ End If
+ End If
+ Next
+ ' verifico se coda vuota e tutti i processi hanno finito
+ Dim nQueueArgs As Integer = 0
+ SyncLock ArgumentsQueueLock
+ nQueueArgs = m_ArgumentsQueue.Count
+ End SyncLock
+ If nQueueArgs = 0 Then
+ Dim bProcessWaiting As Boolean = False
+ For Each ThreadData In m_ThreadDataList
+ If ThreadData.ProcessStatus = ProcessStatuses.WAITINGANSWER OrElse ThreadData.ProcessStatus = ProcessStatuses.ANSWERRECEIVED Then
+ bProcessWaiting = True
+ Exit For
+ End If
+ Next
+ If Not bProcessWaiting Then
+ ' creo thread per lanciare evento asincrono di fine calcolo
+ Dim AllArgsProcessedThread = New Thread(Sub()
+ RaiseEvent m_AllArgsProcessed()
+ End Sub)
+ AllArgsProcessedThread.SetApartmentState(ApartmentState.STA)
+ AllArgsProcessedThread.Start()
+ End If
+ End If
+ Thread.Sleep(1000)
+ End While
+ End Sub
+
+ ' funzione di esecuzione del singolo processo che comunica con il programma
+ Private Sub ThreadFunction(ThreadIndex As Integer)
+ Dim MyThreadData As New ThreadData
+ m_ThreadDataList(ThreadIndex) = MyThreadData
+ 'Dim CurrThreadStat As New ThreadStat(ThreadIndex, DateTime.Now)
+ 'HistoryThreadDataList.Add(CurrThreadStat)
+ 'MyThreadData.SetThreadStat(CurrThreadStat)
+ 'Dim sDrive As String = "c" ' If(ThreadIndex Mod 2 = 0, "A", "B")
+ 'Dim sCurrDdfDir As String = sDrive & ":\EgtData\WebDoor\Ddf"
+ 'Dim stopWatch As New Stopwatch()
+ 'Dim lExeTime As Long = 0
+ 'Dim lOtherTime As Long = 0
+
+ ' avvio processo
+ Dim Proc As Process = New Process()
+ Proc.StartInfo.FileName = m_sProcessFileName
+ Proc.StartInfo.RedirectStandardInput = True
+ Proc.StartInfo.RedirectStandardOutput = True
+ Proc.StartInfo.Arguments = ThreadIndex.ToString() & " " & m_sProcessArguments
+ Proc.StartInfo.UseShellExecute = False
+ Proc.StartInfo.CreateNoWindow = True
+ AddHandler Proc.OutputDataReceived, AddressOf Thread_OutputDataReceived
+
+ If Proc.Start() Then
+ 'Dim CurrPocStat As New ProcStat(DateTime.Now)
+ 'CurrThreadStat.ProcExecutionList.Add(CurrPocStat)
+ Proc.BeginOutputReadLine()
+ MyThreadData.SetProcess(Proc)
+ MyThreadData.SetProcessStatus(ProcessStatuses.NULL)
+
+ 'Dim nProc0Wait As Integer = 0
+ ' ciclo per leggere coda ed eseguire
+ While Not m_bStopProcess AndAlso Not Proc.HasExited
+ Select Case MyThreadData.ProcessStatus
+ Case ThreadData.ProcessStatuses.NULL
+ 'MyThreadData.SetThreadOperation(ThreadOperations.WaitingData)
+ ' se c'e' qualcosa da processare
+ 'Dim nNumTaskToProcess As Integer = 0
+ 'If ThreadIndex = 0 Then
+ ' nNumTaskToProcess = currWDC.numTask2proc
+ ' If nNumTaskToProcess > 0 Then
+ ' If Not m_bCheckOrder Then m_bCheckOrder = True
+ ' Else
+ ' If m_bCheckOrder Then m_bCheckOrder = False
+ ' Thread.Sleep(100)
+ ' End If
+ 'ElseIf m_bCheckOrder Then
+ ' nNumTaskToProcess = currWDC.numTask2proc
+ ' If nNumTaskToProcess = 0 Then
+ ' m_bCheckOrder = False
+ ' End If
+ 'End If
+ Dim NextProcessArgs As ProcessArgs = Nothing
+ If Not IsNothing(m_delGetNextProcessArgs) Then
+ NextProcessArgs = m_delGetNextProcessArgs()
+ Else
+ NextProcessArgs = ArgumentsDequeue()
+ End If
+
+ If Not IsNothing(NextProcessArgs) AndAlso NextProcessArgs.nId > 0 AndAlso Not String.IsNullOrWhiteSpace(NextProcessArgs.sArgs) Then
+ If Not IsNothing(m_delPreProcess) Then
+ NextProcessArgs = m_delPreProcess(NextProcessArgs)
+ End If
+ MyThreadData.SetCurrRequest(NextProcessArgs)
+ Proc.StandardInput.WriteLine(ThreadIndex & "," & NextProcessArgs.sArgs)
+ MyThreadData.SetProcessStatus(ThreadData.ProcessStatuses.WAITINGANSWER)
+ End If
+ 'If m_bCheckOrder Then
+ ' Dim LastRequest As Dictionary(Of String, CalcReqtDTO) = currWDC.queueList(1)
+ ' If LastRequest.Count > 0 Then
+ ' MyThreadData.SetThreadOperation(ThreadOperations.FoundRequest)
+
+ ' Dim ConvItem As KeyValuePair(Of String, String)
+ ' ConvItem = New KeyValuePair(Of String, String)(LastRequest.First().Key, LastRequest.First().Value.DDF)
+ ' MyThreadData.SetCurrRequest(ConvItem)
+
+ ' ' vecchia versione
+ ' 'MyThreadData.SetCurrRequest(LastRequest.First())
+
+ ' Dim Item As KeyValuePair(Of String, String) = MyThreadData.CurrRequest
+ ' Dim bOk As Boolean = Not IsNothing(Item)
+ ' If bOk Then
+
+ ' ' avvio cronometro
+ ' 'stopWatch.Reset()
+ ' stopWatch.Restart()
+ ' ' svuoto vecchio set file della porta richiesta
+ ' Dim fileList As String() = Directory.GetFiles(sCurrDdfDir, Item.Key + ".*")
+ ' ' elimino vecchi
+ ' If Not IsNothing(fileList) Then
+ ' For Each sFile In fileList
+ ' Try
+ ' File.Delete(sFile)
+ ' Catch ex As Exception
+ ' End Try
+ ' Next
+ ' End If
+
+ ' ' scrivo ddf
+ ' MyThreadData.SetThreadOperation(ThreadOperations.WritingDdf)
+ ' MyThreadData.SetDdfPath(sCurrDdfDir & "\" & Item.Key & ".ddf")
+ ' Dim sDdfPath As String = MyThreadData.sDdfPath
+ ' Try
+ ' File.WriteAllText(sDdfPath, Item.Value)
+ ' Catch ex As Exception
+ ' bOk = False
+ ' End Try
+
+ ' If bOk Then
+ ' MyThreadData.SetThreadOperation(ThreadOperations.ProcessingDdf)
+
+ ' Proc.StandardInput.WriteLine(ThreadIndex & "," & sDdfPath)
+
+ ' MyThreadData.SetWaitProcAnswer(ThreadData.ProcComm.WaitingAnswer)
+ ' End If
+ ' End If
+ ' Else
+ ' Thread.Sleep(100)
+ ' End If
+ 'Else
+ ' Thread.Sleep(100)
+ 'End If
+ Case ThreadData.ProcessStatuses.WAITINGANSWER
+ Thread.Sleep(10)
+ Case ThreadData.ProcessStatuses.ANSWERRECEIVED
+ Dim NewProcessArgsResult As New ProcessArgsResult(MyThreadData.CurrRequest, MyThreadData.nProcResult)
+ If Not IsNothing(m_delPostProcess) Then
+ m_delPostProcess(NewProcessArgsResult)
+ End If
+ ArgumentsResultEnqueue(NewProcessArgsResult)
+ 'Dim Item As ProcessArgs = MyThreadData.CurrRequest
+ 'Dim sDdfPath As String = MyThreadData.sDdfPath
+ 'Dim bOk As Boolean = True
+ '' salvo exe time...
+ 'stopWatch.Stop()
+ 'lExeTime = stopWatch.ElapsedMilliseconds
+ 'stopWatch.Restart()
+ 'Dim procResults As New List(Of CalcResultDTO)
+ 'Dim currRes As New CalcResultDTO
+ 'Dim fContent As String = ""
+ 'MyThreadData.SetThreadOperation(ThreadOperations.ReadingSvg)
+ '' verifico esistenza file svg e lo carico
+ 'bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "svg"), fContent)
+ '' !!! ToDo: inserire TIPO di richiesta secondo quanto ricevuto....
+ '' invio risposta
+ 'currRes.Validated = MyThreadData.nProcResult = 0 AndAlso bOk
+ 'currRes.DoorIdVers = Item.Key
+ '' per ora cablato a svg, prendere da MimeType richiesta...
+ 'currRes.MimeType = "svg"
+
+ '' se NON fosse validato --> messo il messaggio...
+ 'If (currRes.Validated) Then
+ ' currRes.RawContent = fContent
+ 'Else
+ ' bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "txt"), fContent)
+ ' currRes.ErrorMsg = fContent
+ 'End If
+ 'MyThreadData.SetThreadOperation(ThreadOperations.SendResult)
+
+ 'procResults.Add(currRes)
+ 'Dim respPut As String = currWDC.SendProcResults(procResults)
+
+ 'stopWatch.Stop()
+ 'lOtherTime = stopWatch.ElapsedMilliseconds
+ 'CurrPocStat.IncrementDoneRequest()
+ '' aggiorno thread display...
+ 'UpdateThreadList(Item.Key, lExeTime, lOtherTime)
+ '' cambio nomi file generati in old
+ 'Dim OldSvg As String = Path.ChangeExtension(sDdfPath, "svg")
+ 'Dim NewSvg As String = Path.GetDirectoryName(sDdfPath) & "\" & Path.GetFileNameWithoutExtension(sDdfPath) & "_old.svg"
+ 'Try
+ ' File.Delete(NewSvg)
+ 'Catch ex As Exception
+ 'End Try
+ 'Try
+ ' File.Delete(Path.ChangeExtension(NewSvg, "txt"))
+ 'Catch ex As Exception
+ 'End Try
+ 'Try
+ ' File.Delete(Path.ChangeExtension(NewSvg, "log"))
+ 'Catch ex As Exception
+ 'End Try
+ 'Try
+ ' File.Delete(Path.ChangeExtension(NewSvg, "nge"))
+ 'Catch ex As Exception
+ 'End Try
+ 'Try
+ ' File.Delete(Path.ChangeExtension(NewSvg, "ddf"))
+ 'Catch ex As Exception
+ 'End Try
+ 'Try
+ ' File.Move(OldSvg, NewSvg)
+ 'Catch ex As Exception
+ 'End Try
+ 'Try
+ ' File.Move(Path.ChangeExtension(OldSvg, "txt"), Path.ChangeExtension(NewSvg, "txt"))
+ 'Catch ex As Exception
+ 'End Try
+ 'Try
+ ' File.Move(Path.ChangeExtension(OldSvg, "log"), Path.ChangeExtension(NewSvg, "log"))
+ 'Catch ex As Exception
+ 'End Try
+ 'Try
+ ' File.Move(Path.ChangeExtension(OldSvg, "nge"), Path.ChangeExtension(NewSvg, "nge"))
+ 'Catch ex As Exception
+ 'End Try
+ 'Try
+ ' File.Move(Path.ChangeExtension(OldSvg, "ddf"), Path.ChangeExtension(NewSvg, "ddf"))
+ 'Catch ex As Exception
+ 'End Try
+ MyThreadData.SetProcessStatus(ThreadData.ProcessStatuses.NULL)
+ End Select
+
+ End While
+ ' CurrPocStat.SetStopProc(DateTime.Now)
+ If m_bStopProcess Then
+ Proc.StandardInput.WriteLine("quit")
+ End If
+ End If
+
+ ' CurrThreadStat.SetStopThread(DateTime.Now)
+ MyThreadData.SetProcess(Nothing)
+ ' MyThreadData.SetThreadOperation(ThreadOperations.Closed)
+
+ End Sub
+
+ Private Sub Thread_OutputDataReceived(sender As Object, e As DataReceivedEventArgs)
+ Dim sResult As String = e.Data
+ If Not String.IsNullOrWhiteSpace(sResult) AndAlso sResult.StartsWith("#42315#,") Then
+ Dim Results() As String = sResult.Split(","c)
+ If Results.Count >= 2 Then
+ Dim nIndex As Integer = -1
+ Dim nResult As Integer = -1
+ Dim dResult As Integer = -1
+ If Integer.TryParse(Results(1), nIndex) AndAlso nIndex >= 0 Then
+ If Integer.TryParse(Results(2), nResult) AndAlso nResult >= 0 Then
+ m_ThreadDataList(nIndex).SetProcResult(nResult)
+ ElseIf StringToDouble(Results(2), dResult) AndAlso dResult >= 0 Then
+ nResult = Math.Floor(dResult)
+ m_ThreadDataList(nIndex).SetProcResult(nResult)
+ End If
+ m_ThreadDataList(nIndex).SetProcessStatus(ThreadData.ProcessStatuses.ANSWERRECEIVED)
+ End If
+ End If
+ End If
+ End Sub
+
+End Class
+
+Public Class ThreadData
+
+ 'Enum ThreadOperations As Integer
+ ' WaitingData = 1
+ ' FoundRequest = 2
+ ' WritingDdf = 3
+ ' ProcessingDdf = 4
+ ' ReadingSvg = 5
+ ' SendResult = 6
+ ' Closed = 10
+ 'End Enum
+
+ Public Enum ProcessStatuses As Integer
+ NULL = 0
+ WAITINGANSWER = 1
+ ANSWERRECEIVED = 2
+ TOBESTARTED = 10
+ End Enum
+
+ Private m_ProcessStatus As ProcessStatuses = ProcessStatuses.TOBESTARTED
+ Public ReadOnly Property ProcessStatus As ProcessStatuses
+ Get
+ Return m_ProcessStatus
+ End Get
+ End Property
+ Friend Sub SetProcessStatus(value As ProcessStatuses)
+ m_ProcessStatus = value
+ End Sub
+
+ Private m_CurrRequest As ProcessArgs
+ Public ReadOnly Property CurrRequest As ProcessArgs
+ Get
+ Return m_CurrRequest
+ End Get
+ End Property
+ Friend Sub SetCurrRequest(value As ProcessArgs)
+ m_CurrRequest = value
+ End Sub
+
+ 'Private m_sDdfPath As String
+ 'Public ReadOnly Property sDdfPath As String
+ ' Get
+ ' Return m_sDdfPath
+ ' End Get
+ 'End Property
+ 'Friend Sub SetDdfPath(value As String)
+ ' m_sDdfPath = value
+ 'End Sub
+
+ Private m_nProcResult As Integer
+ Public ReadOnly Property nProcResult As Integer
+ Get
+ Return m_nProcResult
+ End Get
+ End Property
+ Friend Sub SetProcResult(value As Integer)
+ m_nProcResult = value
+ End Sub
+
+ 'Private m_ThreadOperation As ThreadOperations
+ 'Public ReadOnly Property ThreadOperation As ThreadOperations
+ ' Get
+ ' Return m_ThreadOperation
+ ' End Get
+ 'End Property
+ 'Friend Sub SetThreadOperation(value As ThreadOperations)
+ ' m_ThreadOperation = value
+ 'End Sub
+
+ Private m_Process As Process
+ Public ReadOnly Property Process As Process
+ Get
+ Return m_Process
+ End Get
+ End Property
+ Friend Sub SetProcess(value As Process)
+ m_Process = value
+ End Sub
+
+ 'Private m_ThreadStat As ThreadStat
+ 'Public ReadOnly Property ThreadStat As ThreadStat
+ ' Get
+ ' Return m_ThreadStat
+ ' End Get
+ 'End Property
+ 'Friend Sub SetThreadStat(value As ThreadStat)
+ ' m_ThreadStat = value
+ 'End Sub
+
+End Class
+
+Public Class ProcessArgs
+
+ Private m_nId As Integer
+ Public ReadOnly Property nId As Integer
+ Get
+ Return m_nId
+ End Get
+ End Property
+
+ Private m_sArgs As String
+ Public ReadOnly Property sArgs As String
+ Get
+ Return m_sArgs
+ End Get
+ End Property
+
+ Sub New(nId As Integer, sArgs As String)
+ m_nId = nId
+ m_sArgs = sArgs
+ End Sub
+
+End Class
+
+Public Class ProcessArgsResult
+
+ Private m_ProcessArgs As ProcessArgs
+ Public ReadOnly Property ProcessArgs As ProcessArgs
+ Get
+ Return m_ProcessArgs
+ End Get
+ End Property
+
+ Private m_nResult As Integer
+ Public ReadOnly Property nResult As Integer
+ Get
+ Return m_nResult
+ End Get
+ End Property
+ Public Sub SetResult(nResult As Integer)
+ m_nResult = nResult
+ End Sub
+
+ Sub New(ProcessArgs As ProcessArgs, nResult As Integer)
+ m_ProcessArgs = ProcessArgs
+ m_nResult = nResult
+ End Sub
+
+End Class
\ No newline at end of file
diff --git a/Effector.Plugin.FiveLakes/Utility/GenInterface.vb b/Effector.Plugin.FiveLakes/Utility/GenInterface.vb
new file mode 100644
index 0000000..f7bf24d
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Utility/GenInterface.vb
@@ -0,0 +1,76 @@
+Imports System.Globalization
+Imports System.Runtime.InteropServices
+Imports System.Text
+
+Public Module GenInterface
+
+ '-------------------------------- IniFile : Get --------------------------------------------------
+
+ Public Function GetPrivateProfileInt(
+ lpAppName As String,
+ lpKeyName As String,
+ nDefault As Integer,
+ lpFileName As String) As Integer
+ End Function
+
+ Public Function GetPrivateProfileDouble(
+ lpAppName As String,
+ lpKeyName As String,
+ dDefault As Double,
+ lpFileName As String) As Double
+ Dim sValue As String = String.Empty
+ GetPrivateProfileString(lpAppName, lpKeyName, dDefault.ToString(), sValue, lpFileName)
+ Dim nPos As Integer = sValue.IndexOf(";")
+ If nPos >= 0 Then
+ sValue = sValue.Remove(nPos)
+ End If
+ Dim dValue As Double
+ If Not Double.TryParse(sValue, NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, dValue) Then
+ dValue = dDefault
+ End If
+ Return dValue
+ End Function
+
+
+ Private Function GetPrivateProfileString(
+ lpAppName As String,
+ lpKeyName As String,
+ lpDefault As String,
+ lpReturnedString As StringBuilder,
+ nSize As Integer,
+ lpFileName As String) As Integer
+ End Function
+ Public Function GetPrivateProfileString(
+ lpAppName As String,
+ lpKeyName As String,
+ lpDefault As String,
+ ByRef lpString As String,
+ lpFileName As String) As Integer
+ Dim sb As New StringBuilder(1024)
+ Dim nRet As Integer = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, sb, sb.Capacity, lpFileName)
+ lpString = sb.ToString
+ Return nRet
+ End Function
+
+ '-------------------------------- IniFile : Write ------------------------------------------------
+
+ Public Function WritePrivateProfileString(
+ lpAppName As String,
+ lpKeyName As String,
+ lpString As String,
+ lpFileName As String) As Boolean
+ End Function
+
+ '-------------------------------- Windows --------------------------------------------------------
+ Public Enum SW As Integer
+ HIDE = 0
+ SHOWMAXIMIZED = 3
+ RESTORE = 9
+ End Enum
+
+
+ Public Function ShowWindow(hWnd As IntPtr, nCmdShow As Integer) As Boolean
+ End Function
+
+
+End Module
diff --git a/Effector.Plugin.FiveLakes/Utility/IdNameStruct.vb b/Effector.Plugin.FiveLakes/Utility/IdNameStruct.vb
new file mode 100644
index 0000000..656e028
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Utility/IdNameStruct.vb
@@ -0,0 +1,97 @@
+Imports System.Collections.ObjectModel
+
+Public Structure IdNameStruct
+
+ Private m_Id As Integer
+ Public Property Id As Integer
+ Get
+ Return m_Id
+ End Get
+ Set(value As Integer)
+ m_Id = value
+ End Set
+ End Property
+
+ Private m_Name As String
+ Public Property Name As String
+ Get
+ Return m_Name
+ End Get
+ Set(value As String)
+ m_Name = value
+ End Set
+ End Property
+
+ Sub New(Id As Integer, Name As String)
+ m_Id = Id
+ m_Name = Name
+ End Sub
+
+ Public Overrides Function ToString() As String
+ Return Name
+ End Function
+
+ Public Shared Function IndFromId(Id As Integer, List As ObservableCollection(Of IdNameStruct)) As Integer
+ For i = 0 To List.Count - 1
+ If List(i).Id = Id Then Return i
+ Next
+ Return 0
+ End Function
+ Public Shared Function IndFromId(Id As Integer, List As List(Of IdNameStruct)) As Integer
+ For i = 0 To List.Count - 1
+ If List(i).Id = Id Then Return i
+ Next
+ Return 0
+ End Function
+
+ Public Shared Function IdFromInd(Ind As Integer, List As ObservableCollection(Of IdNameStruct)) As Integer
+ Return List(Ind).Id
+ End Function
+ Public Shared Function IdFromInd(Ind As Integer, List As List(Of IdNameStruct)) As Integer
+ Return List(Ind).Id
+ End Function
+
+ Public Shared Function IndFromId(Id As Integer, List As ObservableCollection(Of Object)) As Integer
+ For i = 0 To List.Count - 1
+ If TypeOf (List(i)) Is IdNameStruct AndAlso DirectCast(List(i), IdNameStruct).Id = Id Then
+ Return i
+ End If
+ Next
+ Return 0
+ End Function
+ Public Shared Function IndFromId(Id As Integer, List As List(Of Object)) As Integer
+ For i = 0 To List.Count - 1
+ If TypeOf (List(i)) Is IdNameStruct AndAlso DirectCast(List(i), IdNameStruct).Id = Id Then
+ Return i
+ End If
+ Next
+ Return 0
+ End Function
+
+ Public Shared Function IdFromInd(Ind As Integer, List As ObservableCollection(Of Object)) As Integer
+ If TypeOf (List(Ind)) Is IdNameStruct Then
+ Return DirectCast(List(Ind), IdNameStruct).Id
+ End If
+ Return 0
+ End Function
+ Public Shared Function IdFromInd(Ind As Integer, List As List(Of Object)) As Integer
+ If TypeOf (List(Ind)) Is IdNameStruct Then
+ Return DirectCast(List(Ind), IdNameStruct).Id
+ End If
+ Return 0
+ End Function
+
+ Public Shared Function IdFromName(Name As String, List As ObservableCollection(Of Object)) As Integer
+ For i = 0 To List.Count - 1
+ If DirectCast(List(i), IdNameStruct).Name = Name Then Return DirectCast(List(i), IdNameStruct).Id
+ Next
+ Return 0
+ End Function
+ Public Shared Function IdFromName(Name As String, List As List(Of Object)) As Integer
+ For i = 0 To List.Count - 1
+ If DirectCast(List(i), IdNameStruct).Name = Name Then Return DirectCast(List(i), IdNameStruct).Id
+ Next
+ Return 0
+ End Function
+
+End Structure
diff --git a/Effector.Plugin.FiveLakes/Utility/IniFile.vb b/Effector.Plugin.FiveLakes/Utility/IniFile.vb
new file mode 100644
index 0000000..658b230
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Utility/IniFile.vb
@@ -0,0 +1,65 @@
+'----------------------------------------------------------------------------
+' EgalTech 2017-2017
+'----------------------------------------------------------------------------
+' File : IniFile.vb Data : 08.05.24 Versione : 2.6e1
+' Contenuto : Modulo IniFile per gestione lettura/scrittura da file INI.
+'
+'
+'
+' Modifiche : 08.05.24 ES Creazione modulo.
+'
+'
+'----------------------------------------------------------------------------
+
+
+Imports System.Collections.ObjectModel
+
+Public Module IniFile
+
+ Private m_sPath As String
+ Public ReadOnly Property sPath As String
+ Get
+ Return m_sPath
+ End Get
+ End Property
+ Friend Sub SetIniFile(sPath)
+ m_sPath = sPath
+ End Sub
+
+ Public Function GetPluginPrivateProfileInt(IpAppName As String, IpKeyName As String, nDefault As Integer) As Integer
+ Return GetPrivateProfileInt(IpAppName, IpKeyName, nDefault, m_sPath)
+ End Function
+
+ Public Function GetPluginPrivateProfileDouble(IpAppName As String, IpKeyName As String, dDefault As Double) As Double
+ Return GetPrivateProfileDouble(IpAppName, IpKeyName, dDefault, m_sPath)
+ End Function
+
+ Public Function GetPluginPrivateProfileString(IpAppName As String, IpKeyName As String, IpDefault As String, ByRef IpString As String) As Integer
+ Return GetPrivateProfileString(IpAppName, IpKeyName, IpDefault, IpString, m_sPath)
+ End Function
+
+ 'Public Function GetPrivateProfileLanguage(lpAppName As String, lpKeyName As String, lpFileName As String) As Language
+ ' Dim sVal As String = String.Empty
+ ' GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
+ ' Dim sItems() As String = sVal.Split(",".ToCharArray)
+ ' If sItems.Count() = 2 Then
+ ' Return New Language(sItems(0), sItems(1))
+ ' End If
+ ' Return Nothing
+ 'End Function
+
+ 'Public Function GetMainPrivateProfileLanguage(lpAppName As String, lpKeyName As String) As Language
+ ' Dim sVal As String = String.Empty
+ ' GetMainPrivateProfileString(lpAppName, lpKeyName, "", sVal)
+ ' Dim sItems() As String = sVal.Split(",".ToCharArray)
+ ' If sItems.Count() = 2 Then
+ ' Return New Language(sItems(0), sItems(1))
+ ' End If
+ ' Return Nothing
+ 'End Function
+
+ Public Function WritePluginPrivateProfileString(IpAppName As String, IpKeyName As String, ByRef IpString As String) As Boolean
+ Return WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_sPath)
+ End Function
+
+End Module
diff --git a/Effector.Plugin.FiveLakes/Utility/JsonUtility.vb b/Effector.Plugin.FiveLakes/Utility/JsonUtility.vb
new file mode 100644
index 0000000..71965e4
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Utility/JsonUtility.vb
@@ -0,0 +1,401 @@
+Imports System.Globalization
+Imports Newtonsoft.Json
+Imports Newtonsoft.Json.Converters
+Imports Effector.Plugin.FiveLakes.Door
+
+Public Class JsonDoor
+
+ Private m_nListIndex As Integer
+ Public ReadOnly Property nListIndex As Integer
+ Get
+ Return m_nListIndex
+ End Get
+ End Property
+
+ Private m_nId As Integer
+ Public ReadOnly Property nId As Integer
+ Get
+ Return m_nId
+ End Get
+ End Property
+
+ Private m_nCSVLine As Integer
+ Public ReadOnly Property nCSVLine As Integer
+ Get
+ Return m_nCSVLine
+ End Get
+ End Property
+
+ Private m_sDDFName As String
+ Public ReadOnly Property sDDFName As String
+ Get
+ Return m_sDDFName
+ End Get
+ End Property
+
+ Private m_nQuantity As Integer
+ Public ReadOnly Property nQuantity As Integer
+ Get
+ Return m_nQuantity
+ End Get
+ End Property
+
+ Private m_dWidth As Double
+ Public ReadOnly Property dWidth As Double
+ Get
+ Return m_dWidth
+ End Get
+ End Property
+
+ Private m_dHeight As Double
+ Public ReadOnly Property dHeight As Double
+ Get
+ Return m_dHeight
+ End Get
+ End Property
+
+ Private m_dThickness As Double
+ Public ReadOnly Property dThickness As Double
+ Get
+ Return m_dThickness
+ End Get
+ End Property
+
+ Private m_sCSVName As String
+ Public ReadOnly Property sCSVName As String
+ Get
+ Return m_sCSVName
+ End Get
+ End Property
+
+ Private m_CustomerParameters As New List(Of CustomerParameter)
+ Public ReadOnly Property CustomerParameters As List(Of CustomerParameter)
+ Get
+ Return m_CustomerParameters
+ End Get
+ End Property
+
+ Private m_nState As DoorStates = DoorStates.LOADED_FROM_CSV
+
+
+ Public ReadOnly Property nState As DoorStates
+ Get
+ Return m_nState
+ End Get
+ End Property
+
+#Region "Statistics"
+
+ Private m_nProdState As DoorProdStates = DoorProdStates.NOT_INIT
+
+
+ Public ReadOnly Property nProdState As DoorProdStates
+ Get
+ Return m_nProdState
+ End Get
+ End Property
+
+ Private m_dtLoadTime As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtLoadTime As DateTime
+ Get
+ Return m_dtLoadTime
+ End Get
+ End Property
+
+ Private m_dtMachining1Start As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtMachining1Start As DateTime
+ Get
+ Return m_dtMachining1Start
+ End Get
+ End Property
+
+ Private m_dtMachining1End As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtMachining1End As DateTime
+ Get
+ Return m_dtMachining1End
+ End Get
+ End Property
+
+ Private m_dtMachining2Start As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtMachining2Start As DateTime
+ Get
+ Return m_dtMachining2Start
+ End Get
+ End Property
+
+ Private m_dtMachining2End As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtMachining2End As DateTime
+ Get
+ Return m_dtMachining2End
+ End Get
+ End Property
+
+ Private m_dtUnloadTime As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtUnloadTime As DateTime
+ Get
+ Return m_dtUnloadTime
+ End Get
+ End Property
+
+#End Region ' Statistics
+
+
+ Sub New(nListIndex As Integer, nId As Integer, nCSVLine As Integer, sDDFName As String, sCSVName As String, nQuantity As Integer, dWidth As Double, dHeight As Double, dThickness As Double, nState As DoorStates, CustomerParameters As List(Of CustomerParameter),
+ nProdState As DoorProdStates, dtLoadTime As DateTime, dtMachining1Start As DateTime, dtMachining1End As DateTime, dtMachining2Start As DateTime, dtMachining2End As DateTime, dtUnloadTime As DateTime)
+ m_nListIndex = nListIndex
+ m_nId = nId
+ m_nCSVLine = nCSVLine
+ m_sDDFName = sDDFName
+ m_sCSVName = sCSVName
+ m_nQuantity = nQuantity
+ m_dHeight = dHeight
+ m_dWidth = dWidth
+ m_dThickness = dThickness
+ m_nState = nState
+ m_CustomerParameters = CustomerParameters
+ m_nProdState = nProdState
+ m_dtLoadTime = dtLoadTime
+ m_dtMachining1Start = dtMachining1Start
+ m_dtMachining1End = dtMachining1End
+ m_dtMachining2Start = dtMachining2Start
+ m_dtMachining2End = dtMachining2End
+ m_dtUnloadTime = dtUnloadTime
+ End Sub
+
+ Sub New(nListIndex As Integer, Door As Door)
+ m_nListIndex = nListIndex
+ m_nId = Door.nId
+ m_nCSVLine = Door.nCSVLine
+ m_sDDFName = Door.sDDFName
+ m_sCSVName = Door.sCSVName
+ m_nQuantity = Door.nQuantity
+ m_dHeight = Door.dHeight
+ m_dWidth = Door.dWidth
+ m_dThickness = Door.dThickness
+ m_nState = Door.nState
+ m_CustomerParameters = Door.CustomerParameters
+ m_nProdState = Door.nProdState
+ m_dtLoadTime = Door.dtLoadTime
+ m_dtMachining1Start = Door.dtMachining1Start
+ m_dtMachining1End = Door.dtMachining1End
+ m_dtMachining2Start = Door.dtMachining2Start
+ m_dtMachining2End = Door.dtMachining2End
+ m_dtUnloadTime = Door.dtUnloadTime
+ End Sub
+
+End Class
+
+Public Class JsonLuaDoor
+ Inherits VMBase
+
+ Private m_nId As Integer = -1
+ Public ReadOnly Property nId As Integer
+ Get
+ Return m_nId
+ End Get
+ End Property
+
+ Private m_nCircIndex As Integer = -1
+ Public ReadOnly Property nCircIndex As Integer
+ Get
+ Return m_nCircIndex
+ End Get
+ End Property
+
+ Private m_nState As Integer = 0
+ Public ReadOnly Property nState As Integer
+ Get
+ Return m_nState
+ End Get
+ End Property
+
+ Private m_DoorStateList As New List(Of IdNameStruct)({New IdNameStruct(0, "Not On Machine"),
+ New IdNameStruct(1, "Imported"),
+ New IdNameStruct(2, "On Load"),
+ New IdNameStruct(3, "On Machine 1"),
+ New IdNameStruct(4, "On Medium Station"),
+ New IdNameStruct(6, "On Machine 2"),
+ New IdNameStruct(7, "On Unload"),
+ New IdNameStruct(8, "Produced"),
+ New IdNameStruct(100, "Scrap")})
+ Public ReadOnly Property DoorStateList As List(Of IdNameStruct)
+ Get
+ Return m_DoorStateList
+ End Get
+ End Property
+
+ Private m_SelDoorState As IdNameStruct
+ Public Property SelDoorState As IdNameStruct
+ Get
+ Return m_SelDoorState
+ End Get
+ Set(value As IdNameStruct)
+ m_SelDoorState = value
+ End Set
+ End Property
+
+ Private m_sDoorCode As String = ""
+ Public ReadOnly Property sDoorCode As String
+ Get
+ Return m_sDoorCode
+ End Get
+ End Property
+
+ Private m_sDoorDescription As String = ""
+ Public ReadOnly Property sDoorDescription As String
+ Get
+ Return m_sDoorDescription
+ End Get
+ End Property
+
+ Private m_sDDFName As String = ""
+ Public ReadOnly Property sDDFName As String
+ Get
+ Return m_sDDFName
+ End Get
+ End Property
+
+ Private m_sCSVName As String = ""
+ Public ReadOnly Property sCSVName As String
+ Get
+ Return m_sCSVName
+ End Get
+ End Property
+
+ Private m_sM1CNPath As String = ""
+ Public ReadOnly Property sM1CNPath As String
+ Get
+ Return m_sM1CNPath
+ End Get
+ End Property
+
+ Private m_sM2CNPath As String = ""
+ Public ReadOnly Property sM2CNPath As String
+ Get
+ Return m_sM2CNPath
+ End Get
+ End Property
+
+ Private m_dtLoadTime As DateTime
+ Public ReadOnly Property sLoadTime As String
+ Get
+ Return m_dtLoadTime.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+ Public ReadOnly Property dtLoadTime As DateTime
+ Get
+ Return m_dtLoadTime
+ End Get
+ End Property
+
+ Private m_dtMachining1Start As DateTime
+ Public ReadOnly Property sMachining1Start As String
+ Get
+ Return m_dtMachining1Start.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+ Public ReadOnly Property dtMachining1Start As DateTime
+ Get
+ Return m_dtMachining1Start
+ End Get
+ End Property
+
+ Private m_dtMachining1End As DateTime
+ Public ReadOnly Property sMachining1End As String
+ Get
+ Return m_dtMachining1End.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+ Public ReadOnly Property dtMachining1End As DateTime
+ Get
+ Return m_dtMachining1End
+ End Get
+ End Property
+
+ Private m_dtMachining2Start As DateTime
+ Public ReadOnly Property sMachining2Start As String
+ Get
+ Return m_dtMachining2Start.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+ Public ReadOnly Property dtMachining2Start As DateTime
+ Get
+ Return m_dtMachining2Start
+ End Get
+ End Property
+
+ Private m_dtMachining2End As DateTime
+ Public ReadOnly Property sMachining2End As String
+ Get
+ Return m_dtMachining2End.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+ Public ReadOnly Property dtMachining2End As DateTime
+ Get
+ Return m_dtMachining2End
+ End Get
+ End Property
+
+ Private m_dtUnloadTime As DateTime
+ Public ReadOnly Property sUnloadTime As String
+ Get
+ Return m_dtUnloadTime.ToString("yy/MM/dd HH:mm:ss")
+ End Get
+ End Property
+ Public ReadOnly Property dtUnloadTime As DateTime
+ Get
+ Return m_dtUnloadTime
+ End Get
+ End Property
+
+
+ Sub New(nId As Integer, nCircIndex As Integer, nState As Integer, sDoorCode As String, sDoorDescription As String, sDDFName As String, sCSVName As String,
+ sM1CNPath As String, sM2CNPath As String, nLoadTime As Long, nMachining1Start As Long, nMachining1End As Long, nMachining2Start As Long,
+ nMachining2End As Long, nUnloadTime As Long)
+ m_nId = nId
+ m_nCircIndex = nCircIndex
+ m_nState = nState
+ m_sDoorCode = sDoorCode
+ m_sDoorDescription = sDoorDescription
+ m_sDDFName = sDDFName
+ m_sCSVName = sCSVName
+ m_sM1CNPath = sM1CNPath
+ m_sM2CNPath = sM2CNPath
+ m_dtLoadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nLoadTime).ToLocalTime()
+ m_dtMachining1Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nMachining1Start).ToLocalTime()
+ m_dtMachining1End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nMachining1End).ToLocalTime()
+ m_dtMachining2Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nMachining2Start).ToLocalTime()
+ m_dtMachining2End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nMachining2End).ToLocalTime()
+ m_dtUnloadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nUnloadTime).ToLocalTime()
+ End Sub
+
+ Sub New(Door As Door)
+ m_nId = Door.nId
+ m_nCircIndex = 0
+ m_nState = 0
+ m_sDDFName = Door.sDDFName
+ m_sCSVName = Door.sCSVName
+ m_sM1CNPath = ""
+ m_sM2CNPath = ""
+ m_dtLoadTime = DateTime.MinValue
+ m_dtMachining1Start = DateTime.MinValue
+ m_dtMachining1End = DateTime.MinValue
+ m_dtMachining2Start = DateTime.MinValue
+ m_dtMachining2End = DateTime.MinValue
+ m_dtUnloadTime = DateTime.MinValue
+ End Sub
+
+ Friend Sub Update(JsonLuaDoor As JsonLuaDoor)
+ m_nCircIndex = JsonLuaDoor.m_nCircIndex
+ m_nState = JsonLuaDoor.m_nState
+ m_sM1CNPath = JsonLuaDoor.m_sM1CNPath
+ m_sM2CNPath = JsonLuaDoor.m_sM2CNPath
+ m_dtLoadTime = JsonLuaDoor.m_dtLoadTime
+ m_dtMachining1Start = JsonLuaDoor.m_dtMachining1Start
+ m_dtMachining1End = JsonLuaDoor.m_dtMachining1End
+ m_dtMachining2Start = JsonLuaDoor.m_dtMachining2Start
+ m_dtMachining2End = JsonLuaDoor.m_dtMachining2End
+ m_dtUnloadTime = JsonLuaDoor.m_dtUnloadTime
+ End Sub
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/Utility/Map.vb b/Effector.Plugin.FiveLakes/Utility/Map.vb
new file mode 100644
index 0000000..56fb96d
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Utility/Map.vb
@@ -0,0 +1,473 @@
+Imports Effector.Plugin.Interface
+
+Module Map
+
+ Private m_refFiveLakesUIVM As FiveLakesUIVM
+ Private m_refDoorListPageVM As DoorListPageVM
+ Private m_refMachinePageVM As MachinePageVM
+ Private m_refSupervisorFunction As IHost
+
+ 'Private m_refMyStatusBarVM As MyStatusBarVM
+ 'Private m_refProjManagerVM As ProjManagerVM
+ 'Private m_refProjectVM As ProjectVM
+ 'Private m_refSecondaryWindowVM As SecondaryWindowVM
+ 'Private m_refSecondaryWindowV As SecondaryWindowV
+ 'Private m_refMachinePanelVM As MachinePanelVM
+ 'Private m_refLeftPanelVM As LeftPanelVM
+ 'Private m_refRightPanelVM As RightPanelVM
+ 'Private m_refDispositionPanelVM As DispositionPanelVM
+ 'Private m_refStartMachPanelVM As StartMachPanelVM
+ 'Private m_refRibPanelVM As RibPanelVM
+ 'Private m_refControllerInputPanelVM As ControllerInputPanelVM
+ 'Private m_refInstrumentPanelVM As InstrumentPanelVM
+ 'Private m_refTopPanelVM As TopPanelVM
+ 'Private m_refSliceManagerVM As SliceManagerVM
+ 'Private m_refTFSEditorVM As TFSEditorVM
+ 'Private m_refCurrMachiningPanelVM As CurrMachiningPanelVM
+ 'Private m_refMachiningDbVM As MachiningDbVM
+ 'Private m_refMaterialDbVM As MaterialDbVM
+ 'Private m_refSliderManagerVM As SliderManagerVM
+ 'Private m_refRibParamPanelVM As RibParamPanelVM
+ 'Private m_refSimulationPanelVM As SimulationPanelVM
+ 'Private m_refReferencePanelVM As ReferencePanelVM
+ 'Private m_refViewLayerManagerVM As ViewLayerManagerVM
+ 'Private m_refShellNumberPanelVM As ShellNumberPanelVM
+ 'Private m_refShellNumberParamPanelVM As ShellNumberParamPanelVM
+ 'Private m_refFilledSolidPanelVM As FilledSolidPanelVM
+ 'Private m_refFilledSolidParamPanelVM As FilledSolidParamPanelVM
+ 'Private m_refSplashScreen As SplashScreen
+ 'Private m_refManagePartPanelVM As ManagePartPanelVM
+ 'Private m_refMachineViewPanelVM As MachineViewPanelVM
+ 'Private m_refImportLoadingWndVM As ImportLoadingWndVM
+
+#Region "Get"
+
+ Public ReadOnly Property refFiveLakesUIVM As FiveLakesUIVM
+ Get
+ Return m_refFiveLakesUIVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refDoorListPageVM As DoorListPageVM
+ Get
+ Return m_refDoorListPageVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refMachinePageVM As MachinePageVM
+ Get
+ Return m_refMachinePageVM
+ End Get
+ End Property
+
+ Public ReadOnly Property refSupervisorFunction As IHost
+ Get
+ Return m_refSupervisorFunction
+ End Get
+ End Property
+
+ 'Public ReadOnly Property refMyStatusBarVM As MyStatusBarVM
+ ' Get
+ ' Return LibMap.refStatusBarVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refProjManagerVM As ProjManagerVM
+ ' Get
+ ' Return m_refProjManagerVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refProjectVM As ProjectVM
+ ' Get
+ ' Return m_refProjectVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refSceneHostVM As MySceneHostVM
+ ' Get
+ ' Return LibMap.refSceneHostVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refSecondaryWindowVM As SecondaryWindowVM
+ ' Get
+ ' Return m_refSecondaryWindowVM
+ ' End Get
+ 'End Property
+ 'Public ReadOnly Property refSecondaryWindowV As SecondaryWindowV
+ ' Get
+ ' Return m_refSecondaryWindowV
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refShowPanelVM As ShowPanelVM
+ ' Get
+ ' Return LibMap.refShowPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refMachinePanelVM As MachinePanelVM
+ ' Get
+ ' Return m_refMachinePanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refLeftPanelVM As LeftPanelVM
+ ' Get
+ ' Return m_refLeftPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refRightPanelVM As RightPanelVM
+ ' Get
+ ' Return m_refRightPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refDispositionPanelVM As DispositionPanelVM
+ ' Get
+ ' Return m_refDispositionPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refStartMachPanelVM As StartMachPanelVM
+ ' Get
+ ' Return m_refStartMachPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refRibPanelVM As RibPanelVM
+ ' Get
+ ' Return m_refRibPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refControllerInputPanelVM As ControllerInputPanelVM
+ ' Get
+ ' Return m_refControllerInputPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refInstrumentPanelVM As MyInstrumentPanelVM
+ ' Get
+ ' Return m_refInstrumentPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refTopPanelVM As TopPanelVM
+ ' Get
+ ' Return m_refTopPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refSliceManagerVM As SliceManagerVM
+ ' Get
+ ' Return m_refSliceManagerVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refTFSEditorVM As TFSEditorVM
+ ' Get
+ ' Return m_refTFSEditorVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refCurrMachiningPanelVM As CurrMachiningPanelVM
+ ' Get
+ ' Return m_refCurrMachiningPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refMachiningDbVM As MachiningDbVM
+ ' Get
+ ' Return m_refMachiningDbVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refMaterialDbVM As MaterialDbVM
+ ' Get
+ ' Return m_refMaterialDbVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refSliderManagerVM As SliderManagerVM
+ ' Get
+ ' Return m_refSliderManagerVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refRibParamPanelVM As RibParamPanelVM
+ ' Get
+ ' Return m_refRibParamPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refSimulationPanelVM As SimulationPanelVM
+ ' Get
+ ' Return m_refSimulationPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refReferencePanelVM As ReferencePanelVM
+ ' Get
+ ' Return m_refReferencePanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refViewLayerManagerVM As ViewLayerManagerVM
+ ' Get
+ ' Return m_refViewLayerManagerVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refShellNumberPanelVM As ShellNumberPanelVM
+ ' Get
+ ' Return m_refShellNumberPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refShellNumberParamPanelVM As ShellNumberParamPanelVM
+ ' Get
+ ' Return m_refShellNumberParamPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refFilledSolidPanelVM As FilledSolidPanelVM
+ ' Get
+ ' Return m_refFilledSolidPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refFilledSolidParamPanelVM As FilledSolidParamPanelVM
+ ' Get
+ ' Return m_refFilledSolidParamPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refSplashScreen As SplashScreen
+ ' Get
+ ' Return m_refSplashScreen
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refManagePartPanelVM As ManagePartPanelVM
+ ' Get
+ ' Return m_refManagePartPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refMachineViewPanelVM As MachineViewPanelVM
+ ' Get
+ ' Return m_refMachineViewPanelVM
+ ' End Get
+ 'End Property
+
+ 'Public ReadOnly Property refImportLoadingWndVM As ImportLoadingWndVM
+ ' Get
+ ' Return m_refImportLoadingWndVM
+ ' End Get
+ 'End Property
+
+#End Region ' Get
+
+#Region "Set"
+
+ Friend Function SetRefSupervisorFunction(IHost As IHost) As Boolean
+ m_refSupervisorFunction = IHost
+ Return Not IsNothing(m_refSupervisorFunction)
+ End Function
+
+ Friend Function SetRefDoorListPageVM(DoorListPageVM As DoorListPageVM) As Boolean
+ m_refDoorListPageVM = DoorListPageVM
+ Return Not IsNothing(m_refDoorListPageVM)
+ End Function
+
+ Friend Function SetRefMachinePageVM(MachinePageVM As MachinePageVM) As Boolean
+ m_refMachinePageVM = MachinePageVM
+ Return Not IsNothing(m_refMachinePageVM)
+ End Function
+
+ ' Friend Function SetRefProjManagerVM(ProjManagerVM As ProjManagerVM) As Boolean
+ ' m_refProjManagerVM = ProjManagerVM
+ ' Return Not IsNothing(m_refProjManagerVM)
+ ' End Function
+
+ ' Friend Function SetRefProjectVM(ProjectVM As ProjectVM) As Boolean
+ ' m_refProjectVM = ProjectVM
+ ' Return Not IsNothing(m_refProjectVM)
+ ' End Function
+
+ ' Friend Function SetRefSceneHostVM(SceneHostVM As SceneHostVM) As Boolean
+ ' LibMap.SetRefSceneHostVM(SceneHostVM)
+ ' Return Not IsNothing(LibMap.refSceneHostVM)
+ ' End Function
+
+ ' Friend Function SetRefSecondaryWindowVM(SecondaryWindowVM As SecondaryWindowVM) As Boolean
+ ' m_refSecondaryWindowVM = SecondaryWindowVM
+ ' Return Not IsNothing(m_refSecondaryWindowVM)
+ ' End Function
+ ' Friend Function SetRefSecondaryWindowV(SecondaryWindowV As SecondaryWindowV) As Boolean
+ ' m_refSecondaryWindowV = SecondaryWindowV
+ ' Return Not IsNothing(m_refSecondaryWindowV)
+ ' End Function
+
+ ' Friend Function SetRefMachinePanelVM(MachinePanelVM As MachinePanelVM) As Boolean
+ ' m_refMachinePanelVM = MachinePanelVM
+ ' Return Not IsNothing(m_refMachinePanelVM)
+ ' End Function
+
+ ' Friend Function SetRefLeftPanelVM(LeftPanelVM As LeftPanelVM) As Boolean
+ ' m_refLeftPanelVM = LeftPanelVM
+ ' Return Not IsNothing(m_refLeftPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefRightPanelVM(RightPanelVM As RightPanelVM) As Boolean
+ ' m_refRightPanelVM = RightPanelVM
+ ' Return Not IsNothing(m_refRightPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefDispositionPanelVM(DispositionPanelVM As DispositionPanelVM) As Boolean
+ ' m_refDispositionPanelVM = DispositionPanelVM
+ ' Return Not IsNothing(m_refDispositionPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefStartMachPanelVM(StartMachPanelVM As StartMachPanelVM) As Boolean
+ ' m_refStartMachPanelVM = StartMachPanelVM
+ ' Return Not IsNothing(m_refStartMachPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefRibPanelVM(RibPanelVM As RibPanelVM) As Boolean
+ ' m_refRibPanelVM = RibPanelVM
+ ' Return Not IsNothing(m_refRibPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefControllerInputPanelVM(ControllerInputPanelVM As ControllerInputPanelVM) As Boolean
+ ' m_refControllerInputPanelVM = ControllerInputPanelVM
+ ' Return Not IsNothing(m_refControllerInputPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefInstrumentPanelVM(InstrumentPanelVM As InstrumentPanelVM) As Boolean
+ ' m_refInstrumentPanelVM = InstrumentPanelVM
+ ' Return Not IsNothing(m_refInstrumentPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefTopPanelVM(TopPanelVM As TopPanelVM) As Boolean
+ ' m_refTopPanelVM = TopPanelVM
+ ' Return Not IsNothing(m_refTopPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefSliceManagerVM(SliceManagerVM As SliceManagerVM) As Boolean
+ ' m_refSliceManagerVM = SliceManagerVM
+ ' Return Not IsNothing(m_refSliceManagerVM)
+ ' End Function
+
+ ' Friend Function SetRefTFSEditorVM(TFSEditorVM As TFSEditorVM) As Boolean
+ ' m_refTFSEditorVM = TFSEditorVM
+ ' Return Not IsNothing(m_refTFSEditorVM)
+ ' End Function
+
+ ' Friend Function SetRefCurrMachiningPanelVM(CurrMachiningPanelVM As CurrMachiningPanelVM) As Boolean
+ ' m_refCurrMachiningPanelVM = CurrMachiningPanelVM
+ ' Return Not IsNothing(m_refCurrMachiningPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefMachiningDbVM(MachiningDbVM As MachiningDbVM) As Boolean
+ ' m_refMachiningDbVM = MachiningDbVM
+ ' Return Not IsNothing(m_refMachiningDbVM)
+ ' End Function
+
+ ' Friend Function SetRefMaterialDbVM(MaterialDbVM As MaterialDbVM) As Boolean
+ ' m_refMaterialDbVM = MaterialDbVM
+ ' Return Not IsNothing(m_refMaterialDbVM)
+ ' End Function
+
+ ' Friend Function SetRefSliderManagerVM(SliderManagerVM As SliderManagerVM) As Boolean
+ ' m_refSliderManagerVM = SliderManagerVM
+ ' Return Not IsNothing(m_refSliderManagerVM)
+ ' End Function
+
+ ' Friend Function SetRefRibParamPanelVM(RibParamPanelVM As RibParamPanelVM) As Boolean
+ ' m_refRibParamPanelVM = RibParamPanelVM
+ ' Return Not IsNothing(m_refRibParamPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefSimulationPanelVM(SimulationPanelVM As SimulationPanelVM) As Boolean
+ ' m_refSimulationPanelVM = SimulationPanelVM
+ ' Return Not IsNothing(m_refSimulationPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefReferencePanelVM(ReferencePanelVM As ReferencePanelVM) As Boolean
+ ' m_refReferencePanelVM = ReferencePanelVM
+ ' Return Not IsNothing(m_refReferencePanelVM)
+ ' End Function
+
+ ' Friend Function SetRefViewLayerManagerVM(ViewLayerManagerVM As ViewLayerManagerVM) As Boolean
+ ' m_refViewLayerManagerVM = ViewLayerManagerVM
+ ' Return Not IsNothing(m_refViewLayerManagerVM)
+ ' End Function
+
+ ' Friend Function SetRefShellNumberPanelVM(ShellNumberPanelVM As ShellNumberPanelVM) As Boolean
+ ' m_refShellNumberPanelVM = ShellNumberPanelVM
+ ' Return Not IsNothing(m_refShellNumberPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefShellNumberParamPanelVM(ShellNumberParamPanelVM As ShellNumberParamPanelVM) As Boolean
+ ' m_refShellNumberParamPanelVM = ShellNumberParamPanelVM
+ ' Return Not IsNothing(m_refShellNumberParamPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefFilledSolidPanelVM(FilledSolidPanelVM As FilledSolidPanelVM) As Boolean
+ ' m_refFilledSolidPanelVM = FilledSolidPanelVM
+ ' Return Not IsNothing(m_refFilledSolidPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefFilledSolidParamPanelVM(FilledSolidParamPanelVM As FilledSolidParamPanelVM) As Boolean
+ ' m_refFilledSolidParamPanelVM = FilledSolidParamPanelVM
+ ' Return Not IsNothing(m_refFilledSolidParamPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefSplashScreen(SplashScreen As SplashScreen) As Boolean
+ ' m_refSplashScreen = SplashScreen
+ ' Return Not IsNothing(m_refSplashScreen)
+ ' End Function
+
+ ' Friend Function SetRefManagePartPanelVM(ManagePartPanelVM As ManagePartPanelVM) As Boolean
+ ' m_refManagePartPanelVM = ManagePartPanelVM
+ ' Return Not IsNothing(m_refManagePartPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefMachineViewPanelVM(MachineViewPanelVM As MachineViewPanelVM) As Boolean
+ ' m_refMachineViewPanelVM = MachineViewPanelVM
+ ' Return Not IsNothing(m_refMachineViewPanelVM)
+ ' End Function
+
+ ' Friend Function SetRefImportLoadingWndVM(ImportLoadingWndVM As ImportLoadingWndVM) As Boolean
+ ' m_refImportLoadingWndVM = ImportLoadingWndVM
+ ' Return Not IsNothing(m_refImportLoadingWndVM)
+ ' End Function
+
+#End Region ' Set
+
+#Region "Init"
+
+ Friend Function BeginInit(FiveLakesUIVM As FiveLakesUIVM) As Boolean
+ m_refFiveLakesUIVM = FiveLakesUIVM
+ Return Not IsNothing(m_refFiveLakesUIVM)
+ End Function
+ Friend Function EndInit() As Boolean
+ ' Verifico se tutti i pezzi necessari sono stati caricati
+ 'Return Not IsNothing(m_refMainWindowVM) AndAlso Not IsNothing(m_refProjectVM) AndAlso
+ ' Not IsNothing(LibMap.refStatusBarVM) AndAlso Not IsNothing(m_refProjectManagerVM) AndAlso
+ ' Not IsNothing(LibMap.refSceneHostVM) AndAlso Not IsNothing(LibMap.refShowPanelVM) AndAlso
+ ' Not IsNothing(m_refVeinMatchPanelVM) AndAlso
+ ' Not IsNothing(m_refOptionPanelVM) AndAlso Not IsNothing(m_refRawPartTabVM) AndAlso
+ ' Not IsNothing(m_refNestingTabVM) AndAlso Not IsNothing(m_refSimulTabVM) AndAlso
+ ' Not IsNothing(m_refMachiningTabVM) AndAlso
+ ' LibMap.EndInit()
+ Return Not IsNothing(m_refFiveLakesUIVM)
+ End Function
+
+#End Region ' Init
+
+End Module
diff --git a/Effector.Plugin.FiveLakes/Utility/StringConversion.vb b/Effector.Plugin.FiveLakes/Utility/StringConversion.vb
new file mode 100644
index 0000000..0a07106
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Utility/StringConversion.vb
@@ -0,0 +1,66 @@
+Imports System.Globalization
+
+Public Module StringConversion
+
+ Public Function DoubleToString(ByVal dVal As Double, ByVal nNumDec As Integer) As String
+ Dim sFormat As String = "F" + Math.Abs(nNumDec).ToString()
+ Dim sVal As String = dVal.ToString(sFormat, CultureInfo.InvariantCulture)
+ If nNumDec > 0 Then
+ Return sVal.TrimEnd("0".ToCharArray()).TrimEnd(".".ToCharArray)
+ Else
+ Return sVal
+ End If
+ End Function
+
+ Public Function StringToDouble(ByVal sVal As String, ByRef dVal As Double) As Boolean
+ ' Return EgtLuaEvalNumExpr(sVal, dVal)
+ Return Double.TryParse(sVal, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, dVal)
+ End Function
+
+ 'Public Function StringToDoubleAdv(ByVal sVal As String, ByRef dVal As Double, Optional bEval As Boolean = False) As Boolean
+ ' If bEval Then
+ ' Return EgtLuaEvalNumExpr(sVal, dVal)
+ ' Else
+ ' Return Double.TryParse(sVal, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, dVal)
+ ' End If
+ 'End Function
+
+ Public Function StringToInt(sVal As String, ByRef nVal As Integer) As Boolean
+ Dim dVal As Double = 0
+ If Not StringToDouble(sVal, dVal) Then Return False
+ nVal = CInt(Math.Round(dVal))
+ Return True
+ End Function
+
+ 'Public Function LenToString(ByVal dVal As Double, ByVal nNumDec As Integer) As String
+ ' Return DoubleToString(EgtToUiUnits(dVal), nNumDec)
+ 'End Function
+
+ 'Public Function StringToLen(ByVal sVal As String, ByRef dVal As Double) As Boolean
+ ' If EgtLuaEvalNumExpr(sVal, dVal) Then
+ ' dVal = EgtFromUiUnits(dVal)
+ ' Return True
+ ' Else
+ ' Return False
+ ' End If
+ 'End Function
+
+ 'Public Function StringToLenAdv(ByVal sVal As String, ByRef dVal As Double, Optional bEval As Boolean = False) As Boolean
+ ' If bEval Then
+ ' If EgtLuaEvalNumExpr(sVal, dVal) Then
+ ' dVal = EgtFromUiUnits(dVal)
+ ' Return True
+ ' Else
+ ' Return False
+ ' End If
+ ' Else
+ ' If Double.TryParse(sVal, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, dVal) Then
+ ' dVal = EgtFromUiUnits(dVal)
+ ' Return True
+ ' Else
+ ' Return False
+ ' End If
+ ' End If
+ 'End Function
+
+End Module
diff --git a/Effector.Plugin.FiveLakes/Utility/VMBase.vb b/Effector.Plugin.FiveLakes/Utility/VMBase.vb
new file mode 100644
index 0000000..b2d5ce6
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/Utility/VMBase.vb
@@ -0,0 +1,12 @@
+Imports System.ComponentModel
+
+Public Class VMBase
+ Implements INotifyPropertyChanged
+
+ Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
+
+ Public Sub NotifyPropertyChanged(propName As String)
+ RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
+ End Sub
+
+End Class
diff --git a/Effector.Plugin.FiveLakes/packages.config b/Effector.Plugin.FiveLakes/packages.config
new file mode 100644
index 0000000..03464bd
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/Effector.Plugin.FiveLakes/pre-build.ps1 b/Effector.Plugin.FiveLakes/pre-build.ps1
new file mode 100644
index 0000000..3a61655
--- /dev/null
+++ b/Effector.Plugin.FiveLakes/pre-build.ps1
@@ -0,0 +1,3 @@
+param([string]$ProjectDir, [string]$ProjectPath);
+
+Copy-Item -Path c:\EgtProg\Effector\Effector*.exe $ProjectDir\..\Exe
diff --git a/Exe/SupervisorD32.exe b/Exe/SupervisorD32.exe
new file mode 100644
index 0000000..6c6ff16
Binary files /dev/null and b/Exe/SupervisorD32.exe differ
diff --git a/Exe/SupervisorD64.exe b/Exe/SupervisorD64.exe
new file mode 100644
index 0000000..84db609
Binary files /dev/null and b/Exe/SupervisorD64.exe differ
diff --git a/Exe/SupervisorR32.exe b/Exe/SupervisorR32.exe
new file mode 100644
index 0000000..57c3118
Binary files /dev/null and b/Exe/SupervisorR32.exe differ
diff --git a/Exe/SupervisorR64.exe b/Exe/SupervisorR64.exe
new file mode 100644
index 0000000..c3afa48
Binary files /dev/null and b/Exe/SupervisorR64.exe differ