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.StoneCut.Naked.sln b/Effector.Plugin.StoneCut.Naked.sln
new file mode 100644
index 0000000..81c7be5
--- /dev/null
+++ b/Effector.Plugin.StoneCut.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.StoneCut", "Effector.Plugin.StoneCut\Effector.Plugin.StoneCut.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.StoneCut.sln b/Effector.Plugin.StoneCut.sln
new file mode 100644
index 0000000..07047bc
--- /dev/null
+++ b/Effector.Plugin.StoneCut.sln
@@ -0,0 +1,68 @@
+
+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.StoneCut", "Effector.Plugin.StoneCut\Effector.Plugin.StoneCut.vbproj", "{7C77F537-8235-40AB-B24A-4E71CFB96D2C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {7D14D864-2BDC-4785-80F4-320164C2D5E4} = {7D14D864-2BDC-4785-80F4-320164C2D5E4}
+ EndProjectSection
+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.StoneCut/Constants/ConstGen.vb b/Effector.Plugin.StoneCut/Constants/ConstGen.vb
new file mode 100644
index 0000000..7cc6083
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/Constants/ConstIni.vb b/Effector.Plugin.StoneCut/Constants/ConstIni.vb
new file mode 100644
index 0000000..193c51b
--- /dev/null
+++ b/Effector.Plugin.StoneCut/Constants/ConstIni.vb
@@ -0,0 +1,56 @@
+'----------------------------------------------------------------------------
+' 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.StoneCut.ini"
+
+ Public Const S_GENERAL As String = "General"
+ Public Const K_CAMEXEPATH As String = "CAMExePath"
+ Public Const K_DOORCREATOREXEPATH As String = "DoorCreatorExePath"
+ Public Const K_BACKUPDIR As String = "BackupDir"
+ Public Const K_RESOURCESDIR As String = "ResourcesDir"
+ Public Const K_DDFDIR As String = "DDFDir"
+ Public Const K_DDTDIR As String = "DDTDir"
+ Public Const K_GENDDFDIR As String = "GenDDFDir"
+ Public Const K_CSV As String = "CSV"
+ Public Const K_ISCSVOUTPUTENABLED As String = "IsCSVOutputEnabled"
+ Public Const K_CSVOUTPUTPATH As String = "CSVOutputPath"
+ Public Const K_LASTCSVDIR As String = "LastCsvDir"
+
+ 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_SWING As String = "Swing"
+ Public Const K_PHASE As String = "Phase"
+ Public Const K_STATE As String = "State"
+ Public Const K_PROGRAMSENT As String = "ProgramSent"
+ Public Const K_PROGRAMSTART As String = "ProgramStart"
+ Public Const K_PROGRAMEND As String = "ProgramEnd"
+ Public Const K_MANUALADDEDDOORNAME As String = "ManualAddedDoorName"
+ 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.StoneCut/DoorListPage/DoorListPageV.xaml b/Effector.Plugin.StoneCut/DoorListPage/DoorListPageV.xaml
new file mode 100644
index 0000000..78f60f2
--- /dev/null
+++ b/Effector.Plugin.StoneCut/DoorListPage/DoorListPageV.xaml
@@ -0,0 +1,272 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Effector.Plugin.StoneCut/DoorListPage/DoorListPageV.xaml.vb b/Effector.Plugin.StoneCut/DoorListPage/DoorListPageV.xaml.vb
new file mode 100644
index 0000000..7330597
--- /dev/null
+++ b/Effector.Plugin.StoneCut/DoorListPage/DoorListPageV.xaml.vb
@@ -0,0 +1,13 @@
+Public Class DoorListPageV
+
+ ' funzione che impedisce di editare le righe che sono gia' in produzione
+ Private Sub DoorList_BeginningEdit(sender As Object, e As DataGridBeginningEditEventArgs)
+ 'If IsNothing(e.Row) Then Return
+ 'Dim RowVM As Door = DirectCast(e.Row.DataContext, Door)
+ '' se in produzione impedisco modifica dei parametri
+ 'If RowVM.nState >= Door.PartProgramStates.READY_FOR_PRODUCTION Then
+ ' e.Cancel = True
+ 'End If
+ End Sub
+
+End Class
diff --git a/Effector.Plugin.StoneCut/DoorListPage/DoorListPageVM.vb b/Effector.Plugin.StoneCut/DoorListPage/DoorListPageVM.vb
new file mode 100644
index 0000000..b7ca7fc
--- /dev/null
+++ b/Effector.Plugin.StoneCut/DoorListPage/DoorListPageVM.vb
@@ -0,0 +1,921 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports Newtonsoft.Json
+Imports System.Windows.Threading
+Imports System.Text.RegularExpressions
+Imports System.Security.Cryptography
+Imports Newtonsoft.Json.Linq
+Imports Effector.Plugin.StoneCut.Door
+Imports System.Globalization
+Imports System.Diagnostics
+Imports Effector.Plugin.Lib
+
+Public Class DoorListPageVM
+ Inherits VMBase
+
+ Private m_BackupTimer As New DispatcherTimer
+ Private m_WriteCSVTimer As New DispatcherTimer
+ Private m_RefreshGraphicsTimer As New DispatcherTimer
+ Private m_ExecProcessManager As ExecProcessManager
+
+ Private m_ReadPartProgramFolderTimer As New DispatcherTimer
+ Private m_sPartProgramFolderPath As String
+
+ Private m_DoorList As New ObservableCollection(Of Door)
+
+ Private m_bResetList As Boolean = False
+ Public ReadOnly Property bResetList As Boolean
+ Get
+ Return m_bResetList
+ End Get
+ End Property
+ Friend Sub ResetResetList()
+ m_bResetList = False
+ End Sub
+
+ 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_DDTList As New ObservableCollection(Of String)
+ Public ReadOnly Property DDTList As ObservableCollection(Of String)
+ Get
+ Return m_DDTList
+ End Get
+ End Property
+
+ Private m_ManualAddedDoorName As String = "Manual"
+ Public ReadOnly Property ManualAddedDoorName As String
+ Get
+ Return m_ManualAddedDoorName
+ End Get
+ 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
+
+ Private m_sCSVOutDirPath As String = ""
+
+ Private m_nExecIncrement As Integer = 0
+ Private m_nExecutedArgsCount As Integer = 0
+ Public ReadOnly Property dExecPercentage As Double
+ Get
+ If m_bCreatingDdfs Then
+ Return 5 / m_nTotCreatingDdf * m_nCurrCreatingDdf
+ End If
+ If IsNothing(m_ExecProcessManager) Then Return 0
+ Dim dExecIncrement As Double = If(m_ExecProcessManager.nArgsInQueue = 0, 0, Math.Min(28, m_nExecIncrement) / 34)
+ Return (m_ExecProcessManager.nExecutedArgsCounter + dExecIncrement) / (m_ExecProcessManager.nExecutedArgsCounter + m_ExecProcessManager.nArgsInQueue) * 100
+ End Get
+ End Property
+
+ Public ReadOnly Property sExecPercentage As String
+ Get
+ Return DoubleToString(dExecPercentage, 1) & "%"
+ End Get
+ End Property
+
+ Public ReadOnly Property ExecPercentage_Visibility As Visibility
+ Get
+ Return If((Not IsNothing(m_ExecProcessManager) AndAlso m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.RUNNING) OrElse m_bCreatingDdfs, Visibility.Visible, Visibility.Collapsed)
+ End Get
+ End Property
+
+ Private m_bCreatingDdfs As Boolean
+ Private m_nTotCreatingDdf As Integer
+ Private m_nCurrCreatingDdf As Integer
+
+ ' Definizione comandi
+ Private m_cmdProduce As ICommand
+ Private m_cmdProduceAll As ICommand
+ Private m_cmdResetProductionQueue As ICommand
+ Private m_cmdMoveUp As ICommand
+ Private m_cmdMoveDown As ICommand
+ Private m_cmdNotProduce As ICommand
+ Private m_cmdCopy As ICommand
+ ' Private m_cmdMultipleCopy As ICommand
+ Private m_cmdDelete As ICommand
+ Private m_cmdDeleteAll As ICommand
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' imposto riferimento in Map
+ Map.SetRefDoorListPageVM(Me)
+ ' leggo backup
+ 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_WriteCSVTimer.Interval = New TimeSpan(0, 1, 0)
+ AddHandler m_WriteCSVTimer.Tick, AddressOf WriteCSVTimer_Tick
+ m_RefreshGraphicsTimer.Interval = New TimeSpan(0, 0, 1)
+ AddHandler m_RefreshGraphicsTimer.Tick, AddressOf RefreshGraphicsTimer_Tick
+ m_BackupTimer.Start()
+ ' verifico path salvataggio CSV
+ Dim bStartWriteCSV As Boolean = False
+ If GetPluginPrivateProfileInt(S_GENERAL, K_ISCSVOUTPUTENABLED, 0) = 1 Then
+ bStartWriteCSV = True
+ If GetPluginPrivateProfileString(S_GENERAL, K_CSVOUTPUTPATH, "", m_sCSVOutDirPath) = 0 Then
+ bStartWriteCSV = False
+ MessageBox.Show("Path di salvataggio CSV non impostata! Impossibile creare file CSV!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
+ End If
+ If bStartWriteCSV AndAlso Not Directory.Exists(m_sCSVOutDirPath) Then
+ bStartWriteCSV = False
+ MessageBox.Show("Path di salvataggio CSV impostata non esiste! Impossibile creare file CSV!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
+ End If
+ If bStartWriteCSV Then
+ m_WriteCSVTimer.Start()
+ End If
+ End If
+ m_RefreshGraphicsTimer.Start()
+
+ ' leggo path cartella dei partprogram
+ GetPluginPrivateProfileString(S_GENERAL, "PartProgramFolder", "", m_sPartProgramFolderPath)
+ If Not Directory.Exists(m_sPartProgramFolderPath) Then
+ MessageBox.Show("Folder not found! Folder path not configured correctly")
+ End If
+ ' avvio timer di copia file
+ AddHandler m_ReadPartProgramFolderTimer.Tick, AddressOf ReadPartProgramFolderTimer_Tick
+ m_ReadPartProgramFolderTimer.Interval = TimeSpan.FromSeconds(1)
+ m_ReadPartProgramFolderTimer.Start()
+ End Sub
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Private Sub ReadPartProgramFolderTimer_Tick(sender As Object, e As EventArgs)
+ Dim FileList() As String = Directory.GetFiles(m_sPartProgramFolderPath)
+ If FileList.Count = 0 Then Return
+ ' copio file e li metto in lista
+ Dim sPartProgramDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "PartProgramDir", "", sPartProgramDirPath)
+ For nFileIndex = 0 To FileList.Count - 1
+ Dim bFileMove As Boolean = False
+
+ Dim sNewFilePath As String = sPartProgramDirPath & "\" & Path.GetFileName(FileList(nFileIndex))
+ Try
+ File.Move(FileList(nFileIndex), sNewFilePath)
+ bFileMove = True
+ Catch ex As Exception
+ MessageBox.Show("Impossible loading file " & FileList(0))
+ End Try
+ If bFileMove Then
+ Dim CurrFileInfo As New FileInfo(sNewFilePath)
+ Dim CurrFileLength As Double = CDbl(CurrFileInfo.Length)
+ Dim CurrFileLines = File.ReadLines(sNewFilePath).Take(10).ToList()
+ Dim nId As Integer = 0
+ Dim nTable As Integer = 0
+ For nLineIndex = 0 To CurrFileLines.Count - 1
+ Dim IdMatch As Match = Regex.Match(CurrFileLines(nLineIndex), ".*\(ID=(\d+)\)")
+ If Not IsNothing(IdMatch) AndAlso Not String.IsNullOrWhiteSpace(IdMatch.Value) Then
+ Integer.TryParse(IdMatch.Groups(1).Value, nId)
+ End If
+ Dim TableMatch As Match = Regex.Match(CurrFileLines(nLineIndex), ".*\(TABLE=(\d+)\)")
+ If Not IsNothing(TableMatch) AndAlso Not String.IsNullOrWhiteSpace(TableMatch.Value) Then
+ Integer.TryParse(TableMatch.Groups(1).Value, nTable)
+ End If
+ If nId <> 0 AndAlso nTable <> 0 Then Exit For
+ Next
+ m_DoorList.Add(New Door(nId, Path.GetFileName(FileList(nFileIndex)), nTable, CurrFileLength))
+ End If
+ Next
+ WriteBackup()
+ End Sub
+
+ 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()
+
+ Dim TempDoorList As ObservableCollection(Of Door) = New ObservableCollection(Of Door)((From JsonDoor In JsonDoorList
+ Select New Door(JsonDoor)).ToList())
+ 'For Each CurrDoor In TempDoorList
+ ' If CurrDoor.nState >= Door.PartProgramStates.READY_FOR_PRODUCTION AndAlso CurrDoor.nState < Door.PartProgramStates.MACHINE_1_END Then
+ ' CurrDoor.SetState(Door.PartProgramStates.VERIFIED, False)
+ ' End If
+ 'Next
+ 'WriteBackup()
+ m_DoorList = TempDoorList
+ 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, 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 WriteCSVTimer_Tick(sender As Object, e As EventArgs)
+ 'SaveCSV()
+ 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.PartProgramStates.VERIFIED, Door.PartProgramStates.VERIFICATION_FAILED))
+ ' ' elimino file generati
+ ' Dim sGenDDFDirPath As String = ""
+ ' GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
+ ' Dim sDoorFileName As String = Path.GetFileNameWithoutExtension(CurrRequestDoor.sFileName) & "_" & 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")
+ ' 'If ArgumentsResult.nResult = 0 Then
+ ' File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".log")
+ ' 'End If
+ ' ''File.Delete(sGenDDFDirPath & "\" & CurrRequestDoor.sDDFName & ".nge")
+ ' File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".nge")
+ ' 'File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".sest")
+ ' 'File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.sest")
+ ' 'Dim SestFiles() As String = System.IO.Directory.GetFiles(sGenDDFDirPath & "\", sDoorFileName & "*.sest")
+ ' 'For Each FilePath In SestFiles
+ ' ' File.Delete(FilePath)
+ ' 'Next
+ ' ''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
+ ' ' verifico se ci sono altre porte dello stesso tipo da aggiornare
+ ' If m_AssociationList.ContainsKey(CurrRequestDoor.nId) Then
+ ' Dim SameDoorList As List(Of Integer) = m_AssociationList(CurrRequestDoor.nId)
+ ' For Each CurrDoorId In SameDoorList
+ ' Dim CurrDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = CurrDoorId)
+ ' If Not IsNothing(CurrDoor) Then
+ ' If CopyGenDdfFile(CurrRequestDoor, CurrDoor) Then
+ ' CurrDoor.SetState(If(ArgumentsResult.nResult = 0, Door.PartProgramStates.VERIFIED, Door.PartProgramStates.VERIFICATION_FAILED))
+ ' End If
+ ' End If
+ ' Next
+ ' End If
+ ' WriteBackup()
+ ' ArgumentsResult = m_ExecProcessManager.ArgumentsResultDequeue
+ 'End While
+ '' aggiorno grafica
+ 'If m_nExecutedArgsCount <> m_ExecProcessManager.nExecutedArgsCounter Then
+ ' m_nExecutedArgsCount = m_ExecProcessManager.nExecutedArgsCounter
+ ' m_nExecIncrement = 0
+ 'ElseIf m_ExecProcessManager.nCalculatingProcesses > 0 Then
+ ' m_nExecIncrement += 1
+ 'End If
+ 'If Not bExecButton_IsEnabled AndAlso m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.RUNNING Then
+ ' NotifyPropertyChanged(NameOf(dExecPercentage))
+ ' NotifyPropertyChanged(NameOf(sExecPercentage))
+ 'End If
+ 'If Not bExecButton_IsEnabled AndAlso m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then
+ ' SetExecButtonIsEnabled(True)
+ 'End If
+ 'NotifyPropertyChanged(NameOf(ExecPercentage_Visibility))
+ End Sub
+
+ Friend Function GetNextDoor() As Door
+ Dim NextDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nState = Door.PartProgramStates.READY_FOR_PRODUCTION)
+ If Not IsNothing(NextDoor) Then
+ Map.refSupervisorFunction.PlgOutLog("GetNextDoor: door " & NextDoor.nId & " sent to NC")
+ NextDoor.SetState(Door.PartProgramStates.SENT_TO_NC)
+ WriteBackup()
+ End If
+ Return NextDoor
+ End Function
+
+ Friend Function NewDoorId() As Integer
+ Dim nId As Integer = 1
+ If m_DoorList.Count > 0 Then
+ Dim nMaxId As Integer = m_DoorList.Max(Of Integer)(Function(x) x.nId)
+ nId = nMaxId + 1
+ End If
+ Return nId
+ End Function
+
+ Friend Sub ResetStateAfterReset()
+ 'For Each Door In m_DoorList
+ ' If Door.nState > Door.PartProgramStates.VERIFIED AndAlso Door.nState < Door.PartProgramStates.MACHINE_1_END Then
+ ' Door.SetState(Door.PartProgramStates.VERIFIED, False)
+ ' End If
+ 'Next
+ End Sub
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+#Region "Copy"
+
+ Public ReadOnly Property Copy_Command As ICommand
+ Get
+ If m_cmdCopy Is Nothing Then
+ m_cmdCopy = New Command(AddressOf CopyCmd)
+ End If
+ Return m_cmdCopy
+ End Get
+ End Property
+
+ Public Sub CopyCmd(CurrDoor As Door)
+ If IsNothing(CurrDoor) Then Return
+ Dim nId As Integer = NewDoorId()
+ Dim CopyDoor As Door = CurrDoor.Copy(nId)
+ If Not IsNothing(CopyDoor) Then
+ m_DoorList.Add(CurrDoor.Copy(nId))
+ End If
+ End Sub
+
+
+#End Region ' CopyDoor
+
+#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(CurrDoor As Object)
+ If IsNothing(CurrDoor) Then Return
+ Dim nOldIndex As Integer = m_DoorList.IndexOf(CurrDoor)
+ If nOldIndex = 0 Then Return
+ If m_DoorList(nOldIndex - 1).nState >= Door.PartProgramStates.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(CurrDoor As Door)
+ If IsNothing(CurrDoor) OrElse CurrDoor.nState >= Door.PartProgramStates.READY_FOR_PRODUCTION Then Return
+ Dim nOldIndex As Integer = m_DoorList.IndexOf(CurrDoor)
+ 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(CurrDoor As Door)
+ If m_DoorList.Count = 0 OrElse IsNothing(CurrDoor) Then Return
+ Dim bReset As Boolean = True
+ 'If Not LuaGetGlobVar("bReset", bReset) OrElse Not bReset Then
+ ' If (SelDoor.nState >= Door.PartProgramStates.READY_FOR_PRODUCTION AndAlso SelDoor.nState < Door.PartProgramStates.MACHINE_1_END) Then Return
+ 'End If
+ If MessageBox.Show("Sei sicuro di voler cancellare la porta selezionata?", "Avviso", MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.Yes Then
+ ' cancello file
+ Dim sPartProgramDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "PartProgramDir", "", sPartProgramDirPath)
+ Try
+ File.Delete(sPartProgramDirPath & "\" & CurrDoor.sFileName)
+ Catch ex As Exception
+
+ End Try
+ 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
+ Dim bReset As Boolean = True
+ 'If Not LuaGetGlobVar("bReset", bReset) OrElse Not bReset Then
+ ' MessageBox.Show("Impossibile cancellare tutte le porte!" & Environment.NewLine & "La macchina deve essere in stato Reset per poter cancellare tutte le porte!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
+ ' Return
+ 'End If
+ '' verifico che tutte le porte siano in stato prodotto o da non produrre
+ 'Dim bAllProduced As Boolean = True
+ 'For Each CsvDoor In m_DoorList
+ ' If CsvDoor.nState <> PartProgramStates.MACHINE_1_END AndAlso CsvDoor.nState <> PartProgramStates.PRODUCED AndAlso CsvDoor.nState <> PartProgramStates.NOTPRODUCE AndAlso CsvDoor.nState <> PartProgramStates.VERIFICATION_FAILED AndAlso CsvDoor.nState <> PartProgramStates.VERIFIED Then
+ ' bAllProduced = False
+ ' End If
+ 'Next
+ 'If Not bAllProduced Then
+ ' MessageBox.Show("Impossibile cancellare tutte le porte!" & Environment.NewLine & "Per cancellare tutte le porte, devono essere tutte non in lavorazione!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
+ ' Return
+ 'End If
+ If MessageBox.Show("Sei sicuro di voler cancellare tutte le porte?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
+ For PartProgramIndex = m_DoorList.Count - 1 To 0 Step -1
+ ' cancello file
+ Dim sPartProgramDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "PartProgramDir", "", sPartProgramDirPath)
+ Try
+ File.Delete(sPartProgramDirPath & "\" & m_DoorList(PartProgramIndex).sFileName)
+ Catch ex As Exception
+
+ End Try
+ m_DoorList.RemoveAt(PartProgramIndex)
+ Next
+ WriteBackup()
+ '' cancello backup lua per ripartire pulito
+ 'Try
+ ' Dim sBackupDirPath As String = ""
+ ' GetPluginPrivateProfileString(S_GENERAL, K_BACKUPDIR, "", sBackupDirPath)
+ ' Dim sLuaBackupFilePath As String = sBackupDirPath & "\LuaBackup.json"
+ ' File.Delete(sLuaBackupFilePath)
+ 'Catch ex As Exception
+ ' Map.refSupervisorFunction.PlgOutLog("Fallita cancellazione del file LuaBackup!")
+ 'End Try
+ 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(CurrDoor As Door)
+ ProduceDoor(CurrDoor)
+ WriteBackup()
+ End Sub
+
+ Public Sub ProduceDoor(DoorToProduce As Door, Optional bWriteBackup As Boolean = True)
+ If IsNothing(DoorToProduce) Then Return
+ ' la sposto dopo l'ultima da produrre
+ Dim nNewIndex As Integer = m_DoorList.IndexOf(m_DoorList.FirstOrDefault(Function(x) x.nState < Door.PartProgramStates.READY_FOR_PRODUCTION))
+ Dim nOldIndex As Integer = m_DoorList.IndexOf(DoorToProduce)
+ m_DoorList.Move(nOldIndex, nNewIndex)
+ DoorToProduce.SetState(Door.PartProgramStates.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)
+ If CurrDoor.nState <> Door.PartProgramStates.MACHINE_START AndAlso CurrDoor.nState <> Door.PartProgramStates.PRODUCED Then
+ ProduceDoor(CurrDoor, False)
+ End If
+ 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
+
+ Public Sub ResetProductionQueue()
+ For Each Door In m_DoorList
+ If Door.nState = Door.PartProgramStates.READY_FOR_PRODUCTION OrElse Door.nState = Door.PartProgramStates.SENT_TO_NC Then
+ Door.SetState(Door.PartProgramStates.NULL)
+ End If
+ Next
+ m_bResetList = True
+ End Sub
+
+#End Region ' ResetProductionQueue
+
+#End Region ' COMMANDS
+
+End Class
+
+Public Class Door
+ Inherits VMBase
+
+ Public Enum SWINGTYPE As Integer
+ UNDEFINED = 0
+ RIGHT = 1
+ LEFT = 2
+ End Enum
+
+ Private Shared m_refWriteBackup As Action
+
+ Public Enum PartProgramStates As Integer
+ NULL = 0
+ READY_FOR_PRODUCTION = 1
+ SENT_TO_NC = 2
+ MACHINE_START = 3
+ PRODUCED = 4
+ NOTPRODUCE = 10
+ End Enum
+
+ Private m_nId As Integer
+ Public ReadOnly Property nId As Integer
+ Get
+ Return m_nId
+ End Get
+ End Property
+
+ Private m_sFileName As String
+ Public Property sFileName As String
+ Get
+ Return m_sFileName
+ End Get
+ Set(value As String)
+ m_sFileName = value
+ End Set
+ End Property
+ Public ReadOnly Property sFileNameWithoutExtension As String
+ Get
+ Return If(String.IsNullOrWhiteSpace(m_sFileName), "", Path.GetFileNameWithoutExtension(m_sFileName))
+ End Get
+ End Property
+
+ Private m_nTable As Integer
+ Public ReadOnly Property nTable As Integer
+ Get
+ Return m_nTable
+ End Get
+ End Property
+
+ Private m_dFileDimension As Double
+ Public ReadOnly Property dFileDimension As Double
+ Get
+ Return m_dFileDimension
+ End Get
+ End Property
+ Public ReadOnly Property sFileDimension As String
+ Get
+ Return DoubleToString(m_dFileDimension / 1000, 2) & "Kb"
+ End Get
+ End Property
+
+ Private m_nState As PartProgramStates = PartProgramStates.NULL
+ Public ReadOnly Property nState As PartProgramStates
+ Get
+ Return m_nState
+ End Get
+ End Property
+ Friend Sub SetState(value As PartProgramStates, 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_dtMachiningStart As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtMachiningStart As DateTime
+ Get
+ Return m_dtMachiningStart
+ End Get
+ End Property
+ Public ReadOnly Property sMachiningStart As String
+ Get
+ Return ConvertDateTimeToString(m_dtMachiningStart)
+ End Get
+ End Property
+ Friend Sub SetMachiningStart(dtMachiningStart As DateTime)
+ m_dtMachiningStart = dtMachiningStart
+ NotifyPropertyChanged(NameOf(sMachiningStart))
+ End Sub
+ 'Friend Sub SetMachiningStart(Machining1Start As Long)
+ ' m_dtMachiningStart = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining1Start).ToLocalTime()
+ ' NotifyPropertyChanged(NameOf(sMachiningStart))
+ 'End Sub
+
+ Private m_dtMachiningEnd As DateTime = DateTime.MinValue
+ Friend ReadOnly Property dtMachiningEnd As DateTime
+ Get
+ Return m_dtMachiningEnd
+ End Get
+ End Property
+ Public ReadOnly Property sMachiningEnd As String
+ Get
+ Return ConvertDateTimeToString(m_dtMachiningEnd)
+ End Get
+ End Property
+ Friend Sub SetMachiningEnd(dtMachiningEnd As DateTime)
+ m_dtMachiningEnd = dtMachiningEnd
+ NotifyPropertyChanged(NameOf(sMachiningEnd))
+ NotifyPropertyChanged(NameOf(sMachiningTime))
+ End Sub
+
+ Public ReadOnly Property sMachiningTime As String
+ Get
+ If m_dtMachiningStart = DateTime.MinValue OrElse m_dtMachiningEnd = DateTime.MinValue Then Return String.Format("{0:c}", TimeSpan.Zero)
+ Return String.Format("{0:c}", (m_dtMachiningEnd - m_dtMachiningStart))
+ End Get
+ End Property
+
+#End Region ' Statistics
+
+ Public ReadOnly Property Background As SolidColorBrush
+ Get
+ Select Case m_nState
+ Case PartProgramStates.NULL
+ Return Application.Current.FindResource("Omag_LightGray")
+ Case PartProgramStates.READY_FOR_PRODUCTION
+ Return Dictionary.Effector_LightBlue_Status
+ Case PartProgramStates.NOTPRODUCE
+ Return Dictionary.Effector_Yellow_Status
+ Case PartProgramStates.MACHINE_START
+ Return Dictionary.Effector_Blue_Status
+ Case PartProgramStates.PRODUCED
+ Return Dictionary.Effector_Gray_Status
+ Case Else
+ Return Brushes.LightGray
+ End Select
+ End Get
+ End Property
+
+ Public ReadOnly Property Foreground As SolidColorBrush
+ Get
+ Select Case m_nState
+ Case PartProgramStates.NULL
+ Return Brushes.White
+ Case PartProgramStates.NOTPRODUCE
+ Return Dictionary.Effector_Yellow_Status
+ Case PartProgramStates.MACHINE_START
+ Return Dictionary.Effector_Blue_Status
+ Case PartProgramStates.PRODUCED
+ Return Dictionary.Effector_Gray_Status
+ Case Else
+ Return Brushes.White
+ End Select
+ End Get
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdMoveUp As ICommand
+ Private m_cmdMoveDown As ICommand
+ Private m_cmdNotProduce As ICommand
+ Private m_cmdCopyDoor As ICommand
+ 'Private m_cmdMultipleCopyDoor As ICommand
+ Private m_cmdDelete As ICommand
+
+#Region "CONSTRUCTOR"
+
+ Sub New(nId As Integer, sFileName As String, nTable As Integer, dFileDimension As Double)
+ m_nId = nId
+ m_sFileName = sFileName
+ m_nTable = nTable
+ m_dFileDimension = dFileDimension
+ End Sub
+
+ Sub New(JsonDoor As JsonDoor)
+ m_nId = JsonDoor.nId
+ m_sFileName = JsonDoor.sFileName
+ m_nTable = JsonDoor.nTable
+ m_dFileDimension = JsonDoor.dFileDimension
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Friend Function Copy(nId As Integer) As Door
+ Dim sPartProgramDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "PartProgramDir", "", sPartProgramDirPath)
+ Dim nCopyIndex As Integer = 1
+ Dim sFileExtension As String = Path.GetExtension(m_sFileName)
+ Dim sFileName As String = Path.GetFileNameWithoutExtension(m_sFileName)
+ While File.Exists(sPartProgramDirPath & "\" & sFileName & "_" & nCopyIndex & sFileExtension)
+ nCopyIndex += 1
+ End While
+ Dim bFileCopy As Boolean = False
+ Try
+ File.Copy(sPartProgramDirPath & "\" & m_sFileName, sPartProgramDirPath & "\" & sFileName & "_" & nCopyIndex & sFileExtension)
+ bFileCopy = True
+ Catch ex As Exception
+
+ End Try
+ If bFileCopy Then
+ Return New Door(nId, sFileName & "_" & nCopyIndex & sFileExtension, m_nTable, m_dFileDimension)
+ Else Return Nothing
+ End If
+ End Function
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+#Region "NotProduce"
+
+ Public ReadOnly Property NotProduce_Command As ICommand
+ Get
+ If m_cmdNotProduce Is Nothing Then
+ m_cmdNotProduce = New Command(AddressOf NotProduce)
+ End If
+ Return m_cmdNotProduce
+ End Get
+ End Property
+
+ Public Sub NotProduce()
+ SetState(If(nState = Door.PartProgramStates.NULL, Door.PartProgramStates.NOTPRODUCE, Door.PartProgramStates.NULL))
+ End Sub
+
+#End Region ' NotProduceDoor
+
+#End Region ' COMMANDS
+
+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
+ Friend Sub SetValue(value As String)
+ m_sValue = value
+ End Sub
+
+ Sub New(sHeader As String, sValue As String)
+ m_sHeader = sHeader
+ m_sValue = sValue
+ End Sub
+
+End Class
+
+Public Class StateToSelColorConverter
+ 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 PartProgramStates Then Return Brushes.Aqua
+ 'Select Case value
+ ' Case PartProgramStates.LOADED_FROM_CSV
+ ' Return Dictionary.Effector_White_SelStatus
+ ' Case PartProgramStates.VERIFIED
+ ' Return Dictionary.Effector_Green_SelStatus
+ ' Case PartProgramStates.VERIFICATION_FAILED
+ ' Return Dictionary.Effector_Red_SelStatus
+ ' Case PartProgramStates.SKIPPED, PartProgramStates.NOTPRODUCE
+ ' Return Dictionary.Effector_Yellow_SelStatus
+ ' Case PartProgramStates.READY_FOR_PRODUCTION, PartProgramStates.ON_LOAD_STATION
+ ' Return Dictionary.Effector_LightBlue_SelStatus
+ ' Case PartProgramStates.MACHINE_1_START
+ ' Return Dictionary.Effector_Blue_SelStatus
+ ' Case PartProgramStates.MACHINE_1_END, PartProgramStates.PRODUCED
+ ' Return Dictionary.Effector_Gray_SelStatus
+ ' Case Else
+ ' Return Dictionary.Effector_White_SelStatus
+ '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 DDTListToBooleanConverter
+ 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 ObservableCollection(Of String) Then Return False
+ Return DirectCast(value, ObservableCollection(Of String)).Count = 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
\ No newline at end of file
diff --git a/Effector.Plugin.StoneCut/Effector.Plugin.StoneCut.vbproj b/Effector.Plugin.StoneCut/Effector.Plugin.StoneCut.vbproj
new file mode 100644
index 0000000..91c4196
--- /dev/null
+++ b/Effector.Plugin.StoneCut/Effector.Plugin.StoneCut.vbproj
@@ -0,0 +1,228 @@
+
+
+
+ Debug
+ AnyCPU
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}
+ Effector.Plugin.StoneCut
+ Effector.Plugin.StoneCut
+ Library
+ v4.7.2
+ Custom
+ true
+ {7C77F537-8235-40AB-B24A-4E71CFB96D2C}
+
+
+
+
+ true
+ full
+ true
+ true
+ true
+ bin\Debug\
+ Effector.Plugin.StoneCut.xml
+ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314
+
+
+ pdbonly
+ false
+ false
+ true
+ false
+ true
+ bin\Release\
+ Effector.Plugin.StoneCut.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
+
+
+ ..\..\Effector.Plugin.Lib\Effector.Plugin.Lib\bin\Debug\Effector.Plugin.Lib.dll
+
+
+ ..\..\..\EgwWPFBaseLib\EgwWPFBaseLib\bin\Debug\EgwWPFBaseLib.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
+
+
+
+ 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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\pre-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)
+
+
+ copy $(TargetPath) c:\EgtData\Effector\Plugin\Effector.Plugin.StoneCut\Effector.Plugin.StoneCut.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.StoneCut/FiveLakesUI.xaml b/Effector.Plugin.StoneCut/FiveLakesUI.xaml
new file mode 100644
index 0000000..45cdceb
--- /dev/null
+++ b/Effector.Plugin.StoneCut/FiveLakesUI.xaml
@@ -0,0 +1,7 @@
+
+
+
diff --git a/Effector.Plugin.StoneCut/FiveLakesUI.xaml.vb b/Effector.Plugin.StoneCut/FiveLakesUI.xaml.vb
new file mode 100644
index 0000000..7af1406
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/FiveLakesUIVM.vb b/Effector.Plugin.StoneCut/FiveLakesUIVM.vb
new file mode 100644
index 0000000..52943ab
--- /dev/null
+++ b/Effector.Plugin.StoneCut/FiveLakesUIVM.vb
@@ -0,0 +1,61 @@
+Imports System.ComponentModel.Composition
+Imports Effector.Plugin.Interface
+Imports Effector.Plugin.Lib
+
+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.StoneCut"
+ ' Impostazione direttorio di configurazione
+ m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
+ ' Impostazione path Ini file
+ PluginIniFile.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.StoneCut/LUA/LuaManager.vb b/Effector.Plugin.StoneCut/LUA/LuaManager.vb
new file mode 100644
index 0000000..32eff9c
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/LUA/Lua_Aux.vb b/Effector.Plugin.StoneCut/LUA/Lua_Aux.vb
new file mode 100644
index 0000000..bd2e7b5
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/LUA/Lua_General.vb b/Effector.Plugin.StoneCut/LUA/Lua_General.vb
new file mode 100644
index 0000000..d59ca34
--- /dev/null
+++ b/Effector.Plugin.StoneCut/LUA/Lua_General.vb
@@ -0,0 +1,214 @@
+Imports System.IO
+Imports KeraLua
+Imports Effector.Plugin.Lib
+
+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_PlgSetChangeState As LuaFunction = AddressOf Lua_PlgSetChangeState
+ Friend func_PlgGetNextDoor As LuaFunction = AddressOf Lua_PlgGetNextDoor
+ 'Friend func_PlgOpenRestartWnd As LuaFunction = AddressOf Lua_PlgOpenRestartWnd
+ Friend func_PlgMessageWnd As LuaFunction = AddressOf Lua_PlgMessageWnd
+ Friend func_PlgListReset As LuaFunction = AddressOf Lua_PlgListReset
+ 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
+ Dim sPartProgramDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, "PartProgramDir", "", sPartProgramDirPath)
+ ' restituisco il risultato
+ LuaSetParam(state, NextDoor.nId)
+ LuaSetParam(state, sPartProgramDirPath & "\" & NextDoor.sFileName)
+ Return 2
+ End If
+ Return 0
+ End Function
+
+ 'Private Function Lua_PlgOpenRestartWnd(ByVal p As IntPtr) As Integer
+ ' Dim state = Lua.FromIntPtr(p)
+ ' LuaClearStack(state)
+ ' Dim RestartWnd As New RestartWndV(Application.Current.MainWindow, New RestartWndVM())
+ ' RestartWnd.ShowDialog()
+ ' Return 0
+ 'End Function
+
+ Private Function Lua_PlgMessageWnd(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ Dim sMsg As String = ""
+ LuaCheckParam(state, 1, sMsg)
+ LuaClearStack(state)
+ MessageBox.Show(sMsg, "", MessageBoxButton.OK)
+ 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()
+ 'Map.refDoorListPageVM.ResetStateAfterReset()
+ Map.refDoorListPageVM.WriteBackup()
+ Return 0
+ End Function
+
+ Private Function Lua_PlgListReset(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ LuaClearStack(state)
+ If Map.refDoorListPageVM.bResetList Then
+ Map.refDoorListPageVM.ResetResetList()
+ state.PushBoolean(True)
+ Return 1
+ Else
+ Return 0
+ End If
+ End Function
+
+
+ Private Function Lua_PlgSetChangeState(ByVal p As IntPtr) As Integer
+ Dim state = Lua.FromIntPtr(p)
+ Dim nState As Integer = 0
+ LuaGetParam(state, 1, nState)
+ LuaClearStack(state)
+ If nState = 1 Then
+ Dim CurrDoor As Door = Map.refDoorListPageVM.DoorList.FirstOrDefault(Function(x) x.nState = Door.PartProgramStates.SENT_TO_NC)
+ If Not IsNothing(CurrDoor) Then
+ Dim Now As DateTime = DateTime.Now
+ ' verifico se fine precedente impostata
+ Dim nIndex As Integer = Map.refDoorListPageVM.DoorList.IndexOf(CurrDoor)
+ If nIndex > 0 Then
+ Dim PrevDoor As Door = Map.refDoorListPageVM.DoorList(nIndex - 1)
+ If Not IsNothing(PrevDoor) AndAlso PrevDoor.nState = Door.PartProgramStates.MACHINE_START Then
+ PrevDoor.SetState(Door.PartProgramStates.PRODUCED)
+ PrevDoor.SetMachiningEnd(Now - TimeSpan.FromSeconds(1))
+ End If
+ End If
+ CurrDoor.SetState(Door.PartProgramStates.MACHINE_START)
+ CurrDoor.SetMachiningStart(Now)
+ End If
+ ElseIf nState = 2 Then
+ Dim CurrDoor As Door = Map.refDoorListPageVM.DoorList.FirstOrDefault(Function(x) x.nState = Door.PartProgramStates.MACHINE_START)
+ If Not IsNothing(CurrDoor) Then
+ CurrDoor.SetState(Door.PartProgramStates.PRODUCED)
+ CurrDoor.SetMachiningEnd(DateTime.Now())
+ End If
+ End If
+ Map.refDoorListPageVM.WriteBackup()
+ 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("PlgMessageWnd", func_PlgMessageWnd)
+ state.Register("PlgSetChangeState", func_PlgSetChangeState)
+ state.Register("PlgListReset", func_PlgListReset)
+ state.Register("PlgMachineReset", func_PlgMachineReset)
+ Return True
+ End Function
+
+End Module
diff --git a/Effector.Plugin.StoneCut/MachinePage/MachinePageV.xaml b/Effector.Plugin.StoneCut/MachinePage/MachinePageV.xaml
new file mode 100644
index 0000000..50de9be
--- /dev/null
+++ b/Effector.Plugin.StoneCut/MachinePage/MachinePageV.xaml
@@ -0,0 +1,656 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Effector.Plugin.StoneCut/MachinePage/MachinePageV.xaml.vb b/Effector.Plugin.StoneCut/MachinePage/MachinePageV.xaml.vb
new file mode 100644
index 0000000..76c4d6d
--- /dev/null
+++ b/Effector.Plugin.StoneCut/MachinePage/MachinePageV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class MachinePageV
+
+End Class
diff --git a/Effector.Plugin.StoneCut/MachinePage/MachinePageVM.vb b/Effector.Plugin.StoneCut/MachinePage/MachinePageVM.vb
new file mode 100644
index 0000000..142fe8a
--- /dev/null
+++ b/Effector.Plugin.StoneCut/MachinePage/MachinePageVM.vb
@@ -0,0 +1,1021 @@
+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.StoneCut.Variable
+Imports Effector.Plugin.Interface
+Imports Effector.Plugin.Lib
+
+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_dDdfCalcValue As Double = 0
+ Public ReadOnly Property dDdfCalcValue As Double
+ Get
+ Return m_dDdfCalcValue
+ End Get
+ End Property
+
+ 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
+
+ Private m_bErrorReset As Boolean = False
+ Public ReadOnly Property bErrorReset As Boolean
+ Get
+ Return m_bErrorReset
+ 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)})
+ m_VariableList = New ObservableCollection(Of Variable)({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.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.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.INTEGER, "@P1000_END", "1353", 1),
+ New Variable(Variable.VariableTypes.INTEGER, "@P2000_END", "1354", 1)})
+ AddHandler m_VarTimer.Tick, AddressOf VarTimer_Tick
+ m_VarTimer.Interval = New TimeSpan(100)
+ m_VarTimer.Start()
+ Dim sResourcesDirPath As String = ""
+ GetPluginPrivateProfileString(S_GENERAL, K_RESOURCESDIR, "", sResourcesDirPath)
+ m_sMachineImagePath = sResourcesDirPath & "\Machine.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 variabile ErrorReset da lua
+ 'LuaGetGlobVar("ERROR_RESET", m_bErrorReset)
+ 'NotifyPropertyChanged(NameOf(bErrorReset))
+ '' 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) 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
+ 'End If
+ '' leggo stato calcolo da lua
+ 'Dim nState As Integer = -1
+ 'If LuaGetGlobVar("MACHINE1.DDfCalcState", nState) Then
+ ' SetDDfCalcState(nState)
+ ' If nState = 1 Then
+ ' m_dDdfCalcValue += 100 / 250
+ ' m_dDdfCalcValue = Math.Min(100, m_dDdfCalcValue)
+ ' ElseIf m_dDdfCalcValue <> 0 Then
+ ' m_dDdfCalcValue = 0
+ ' End If
+ ' NotifyPropertyChanged(NameOf(dDdfCalcValue))
+ ' NotifyPropertyChanged(NameOf(nDDfCalcState))
+ '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 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, 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 Not IsNothing(Door) AndAlso nDoorState <> Door.nProdState Then
+ ' Door.SetProdState(nDoorState)
+ ' If lLoadTime > 0 Then Door.SetLoadTime(lLoadTime)
+ ' If lMachining1Start > 0 Then Door.SetMachiningStart(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 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
+ If nVerifyFromVarAddress = 1362 Then
+ Dim MachineStateVar As Variable = VariableList.FirstOrDefault(Function(x) x.nMachine = nVerifyFromMachineIndex AndAlso x.sName = "@STATE")
+ If 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_03")
+ Dim EndDoorPresence As Variable = m_VariableList.FirstOrDefault(Function(x) x.nMachine = nMachineIndex AndAlso x.sName = "@WP_PR_01")
+ 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 AndAlso Sent1.nValue = 1 Then
+ If nStartStop = 1 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
+ If nStartStop = 2 Then
+ nState = 3
+ Else Return
+ End If
+ Case 3
+ 'If nStartStop = 1 AndAlso StartDoorPresence.dValue = 1 AndAlso Sent2.nValue = 1 Then
+ If nStartStop = 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
+ If nStartStop = 2 Then
+ nState = 5
+ Else Return
+ End If
+ Case 5
+ 'If nStartStop = 1 AndAlso StartDoorPresence.dValue = 1 AndAlso Sent1.nValue = 1 Then
+ If nStartStop = 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_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 ConvertDateTimeToString(m_dtLoadTime)
+ End Get
+ End Property
+
+ Private m_dtMachining1Start As DateTime
+ Public ReadOnly Property sMachining1Start As String
+ Get
+ Return ConvertDateTimeToString(m_dtMachining1Start)
+ End Get
+ End Property
+
+ Private m_dtMachining1End As DateTime
+ Public ReadOnly Property sMachining1End As String
+ Get
+ Return ConvertDateTimeToString(m_dtMachining1End)
+ End Get
+ End Property
+
+ Private m_dtMachining2Start As DateTime
+ Public ReadOnly Property sMachining2Start As String
+ Get
+ Return ConvertDateTimeToString(m_dtMachining2Start)
+ End Get
+ End Property
+
+ Private m_dtMachining2End As DateTime
+ Public ReadOnly Property sMachining2End As String
+ Get
+ Return ConvertDateTimeToString(m_dtMachining2End)
+ End Get
+ End Property
+
+ Private m_dtUnloadTime As DateTime
+ Public ReadOnly Property sUnloadTime As String
+ Get
+ Return ConvertDateTimeToString(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, 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_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 BooleanToVisibilityConverter
+ 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 Boolean) Then Return Visibility.Hidden
+ Return If(value, Visibility.Visible, Visibility.Hidden)
+ 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.StoneCut/MainMenu/MainMenuV.xaml b/Effector.Plugin.StoneCut/MainMenu/MainMenuV.xaml
new file mode 100644
index 0000000..8daaf8b
--- /dev/null
+++ b/Effector.Plugin.StoneCut/MainMenu/MainMenuV.xaml
@@ -0,0 +1,7 @@
+
+
diff --git a/Effector.Plugin.StoneCut/MainMenu/MainMenuV.xaml.vb b/Effector.Plugin.StoneCut/MainMenu/MainMenuV.xaml.vb
new file mode 100644
index 0000000..55df891
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/MainMenu/MainMenuVM.vb b/Effector.Plugin.StoneCut/MainMenu/MainMenuVM.vb
new file mode 100644
index 0000000..8fd4f46
--- /dev/null
+++ b/Effector.Plugin.StoneCut/MainMenu/MainMenuVM.vb
@@ -0,0 +1,30 @@
+Imports Effector.Plugin.Lib
+
+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.StoneCut/MultipleCopyWnd/MultipleCopyWndV.xaml b/Effector.Plugin.StoneCut/MultipleCopyWnd/MultipleCopyWndV.xaml
new file mode 100644
index 0000000..202601f
--- /dev/null
+++ b/Effector.Plugin.StoneCut/MultipleCopyWnd/MultipleCopyWndV.xaml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Effector.Plugin.StoneCut/MultipleCopyWnd/MultipleCopyWndV.xaml.vb b/Effector.Plugin.StoneCut/MultipleCopyWnd/MultipleCopyWndV.xaml.vb
new file mode 100644
index 0000000..4c4923d
--- /dev/null
+++ b/Effector.Plugin.StoneCut/MultipleCopyWnd/MultipleCopyWndV.xaml.vb
@@ -0,0 +1,19 @@
+Public Class MultipleCopyWndV
+
+ Private WithEvents m_MultipleCopyWndVM As MultipleCopyWndVM
+
+ Sub New(Owner As Window, MultipleCopyWndVM As MultipleCopyWndVM)
+ 'MyBase.New(Owner)
+ Me.Owner = Owner
+ ' This call is required by the designer.
+ InitializeComponent()
+ Me.DataContext = MultipleCopyWndVM
+ ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ m_MultipleCopyWndVM = MultipleCopyWndVM
+ End Sub
+
+ Private Sub CloseWindow(bDialogResult As Boolean) Handles m_MultipleCopyWndVM.m_CloseWindow
+ Me.DialogResult = bDialogResult
+ End Sub
+
+End Class
diff --git a/Effector.Plugin.StoneCut/MultipleCopyWnd/MultipleCopyWndVM.vb b/Effector.Plugin.StoneCut/MultipleCopyWnd/MultipleCopyWndVM.vb
new file mode 100644
index 0000000..8295d3f
--- /dev/null
+++ b/Effector.Plugin.StoneCut/MultipleCopyWnd/MultipleCopyWndVM.vb
@@ -0,0 +1,66 @@
+Public Class MultipleCopyWndVM
+ Inherits VMBase
+
+ Friend Event m_CloseWindow(bDialogResult As Boolean)
+
+ Private m_nCopyNumber As Integer
+ Public ReadOnly Property nCopyNumber As Integer
+ Get
+ Return m_nCopyNumber
+ End Get
+ End Property
+ Public Property sCopyNumber As String
+ Get
+ Return m_nCopyNumber.ToString()
+ End Get
+ Set(value As String)
+ If Not Integer.TryParse(value, m_nCopyNumber) Then
+ MessageBox.Show("Valore non impostabile come quantita' di porte!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
+ NotifyPropertyChanged(sCopyNumber)
+ End If
+ End Set
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdOk As ICommand
+ Private m_cmdCancel As ICommand
+
+#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()
+ If m_nCopyNumber > 0 Then RaiseEvent m_CloseWindow(True)
+ End Sub
+
+#End Region ' Ok
+
+#Region "Cancel"
+
+ Public ReadOnly Property Cancel_Command As ICommand
+ Get
+ If m_cmdCancel Is Nothing Then
+ m_cmdCancel = New Command(AddressOf Cancel)
+ End If
+ Return m_cmdCancel
+ End Get
+ End Property
+
+ Public Sub Cancel()
+ RaiseEvent m_CloseWindow(False)
+ End Sub
+
+#End Region ' Cancel
+
+#End Region ' COMMANDS
+
+End Class
diff --git a/Effector.Plugin.StoneCut/My Project/AssemblyInfo.vb b/Effector.Plugin.StoneCut/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..e429af8
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/My Project/Resources.Designer.vb b/Effector.Plugin.StoneCut/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..e7ecddc
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/My Project/Resources.resx b/Effector.Plugin.StoneCut/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/My Project/Settings.Designer.vb b/Effector.Plugin.StoneCut/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..f694ab7
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut.My.MySettings
+ Get
+ Return Global.Effector.Plugin.StoneCut.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Effector.Plugin.StoneCut/My Project/Settings.settings b/Effector.Plugin.StoneCut/My Project/Settings.settings
new file mode 100644
index 0000000..40ed9fd
--- /dev/null
+++ b/Effector.Plugin.StoneCut/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Effector.Plugin.StoneCut/ProcessManager/ProcessManagerV.xaml b/Effector.Plugin.StoneCut/ProcessManager/ProcessManagerV.xaml
new file mode 100644
index 0000000..7e97755
--- /dev/null
+++ b/Effector.Plugin.StoneCut/ProcessManager/ProcessManagerV.xaml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Effector.Plugin.StoneCut/ProcessManager/ProcessManagerV.xaml.vb b/Effector.Plugin.StoneCut/ProcessManager/ProcessManagerV.xaml.vb
new file mode 100644
index 0000000..20886ee
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/ProcessManager/ProcessManagerVM.vb b/Effector.Plugin.StoneCut/ProcessManager/ProcessManagerVM.vb
new file mode 100644
index 0000000..7d34942
--- /dev/null
+++ b/Effector.Plugin.StoneCut/ProcessManager/ProcessManagerVM.vb
@@ -0,0 +1,52 @@
+Imports System.Windows.Threading
+Imports System.Collections.ObjectModel
+
+Public Class ProcessManagerVM
+ Inherits VMBase
+
+ 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
+
+ Sub New(ExecProcessManager As ExecProcessManager)
+ m_ExecProcessManager = ExecProcessManager
+ 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))
+ End Sub
+
+End Class
+
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/Add.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/Add.png
new file mode 100644
index 0000000..b634987
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/Add.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/Copy.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/Copy.png
new file mode 100644
index 0000000..add0b01
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/Copy.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/Delete.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/Delete.png
new file mode 100644
index 0000000..539802f
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/Delete.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/DeleteAll.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/DeleteAll.png
new file mode 100644
index 0000000..0d89b5b
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/DeleteAll.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/DeleteCsv.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/DeleteCsv.png
new file mode 100644
index 0000000..5096a59
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/DeleteCsv.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/MoveDown.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/MoveDown.png
new file mode 100644
index 0000000..8769109
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/MoveDown.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/MoveUp.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/MoveUp.png
new file mode 100644
index 0000000..46606d5
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/MoveUp.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/MultipleCopy.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/MultipleCopy.png
new file mode 100644
index 0000000..6be8813
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/MultipleCopy.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/NotProduce.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/NotProduce.png
new file mode 100644
index 0000000..63f6a8d
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/NotProduce.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/OpenCsv.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/OpenCsv.png
new file mode 100644
index 0000000..c5e3518
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/OpenCsv.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/OpenProduction.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/OpenProduction.png
new file mode 100644
index 0000000..38b9aea
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/OpenProduction.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/Produce.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/Produce.png
new file mode 100644
index 0000000..3b5e99f
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/Produce.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/ProduceAll.old.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/ProduceAll.old.png
new file mode 100644
index 0000000..322244c
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/ProduceAll.old.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/ProduceAll.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/ProduceAll.png
new file mode 100644
index 0000000..ebd13b7
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/ProduceAll.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/ResetProduction.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/ResetProduction.png
new file mode 100644
index 0000000..48976c9
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/ResetProduction.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/SaveCsv.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/SaveCsv.png
new file mode 100644
index 0000000..d085eee
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/SaveCsv.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/SkipDoor.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/SkipDoor.png
new file mode 100644
index 0000000..ef66656
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/SkipDoor.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/DoorListPage/Verify.png b/Effector.Plugin.StoneCut/Resources/DoorListPage/Verify.png
new file mode 100644
index 0000000..e1305e8
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/DoorListPage/Verify.png differ
diff --git a/Effector.Plugin.StoneCut/Resources/Fonts/Roboto-Light.ttf b/Effector.Plugin.StoneCut/Resources/Fonts/Roboto-Light.ttf
new file mode 100644
index 0000000..d43e943
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/Fonts/Roboto-Light.ttf differ
diff --git a/Effector.Plugin.StoneCut/Resources/Fonts/Roboto-Regular.ttf b/Effector.Plugin.StoneCut/Resources/Fonts/Roboto-Regular.ttf
new file mode 100644
index 0000000..7d9a6c4
Binary files /dev/null and b/Effector.Plugin.StoneCut/Resources/Fonts/Roboto-Regular.ttf differ
diff --git a/Effector.Plugin.StoneCut/RestartWnd/RestartWndV.xaml b/Effector.Plugin.StoneCut/RestartWnd/RestartWndV.xaml
new file mode 100644
index 0000000..0bc95f4
--- /dev/null
+++ b/Effector.Plugin.StoneCut/RestartWnd/RestartWndV.xaml
@@ -0,0 +1,272 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Effector.Plugin.StoneCut/RestartWnd/RestartWndV.xaml.vb b/Effector.Plugin.StoneCut/RestartWnd/RestartWndV.xaml.vb
new file mode 100644
index 0000000..4f5f238
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/RestartWnd/RestartWndVM.vb b/Effector.Plugin.StoneCut/RestartWnd/RestartWndVM.vb
new file mode 100644
index 0000000..126ece7
--- /dev/null
+++ b/Effector.Plugin.StoneCut/RestartWnd/RestartWndVM.vb
@@ -0,0 +1,339 @@
+Imports Effector.Plugin.Lib
+Imports Newtonsoft.Json
+Imports System.Collections.ObjectModel
+Imports System.Globalization
+Imports System.IO
+
+Public Class RestartWndVM
+ Inherits VMBase
+
+ Friend Event m_CloseWindow(bDialogResult As Boolean)
+
+ ' Definizione comandi
+ Private m_cmdOk As ICommand
+
+ 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
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ 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
+ If GetVariableFromName(1, "@WP_PR_0" & nPositionIndex.ToString()).dValue <> 0 Then
+ ' verifico indice
+ Dim nCircindex As Integer = GetVariableFromName(1, "@DOORN_S" & nPositionIndex.ToString()).nValue
+ 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"
+
+ Private Function GetVariableFromName(nMachIndex As Integer, sName As String) As Variable
+ Return Map.refMachinePageVM.VariableList.FirstOrDefault(Function(x) x.nMachine = nMachIndex AndAlso x.sName = sName)
+ 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
+
+#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 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.sFileName
+ '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.StoneCut/StatisticsPage/StatisticsPageV.xaml b/Effector.Plugin.StoneCut/StatisticsPage/StatisticsPageV.xaml
new file mode 100644
index 0000000..a70fe83
--- /dev/null
+++ b/Effector.Plugin.StoneCut/StatisticsPage/StatisticsPageV.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/Effector.Plugin.StoneCut/StatisticsPage/StatisticsPageV.xaml.vb b/Effector.Plugin.StoneCut/StatisticsPage/StatisticsPageV.xaml.vb
new file mode 100644
index 0000000..2113c27
--- /dev/null
+++ b/Effector.Plugin.StoneCut/StatisticsPage/StatisticsPageV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class StatisticsPageV
+
+End Class
diff --git a/Effector.Plugin.StoneCut/StatisticsPage/StatisticsPageVM.vb b/Effector.Plugin.StoneCut/StatisticsPage/StatisticsPageVM.vb
new file mode 100644
index 0000000..209e57c
--- /dev/null
+++ b/Effector.Plugin.StoneCut/StatisticsPage/StatisticsPageVM.vb
@@ -0,0 +1,3 @@
+Public Class StatisticsPageVM
+
+End Class
diff --git a/Effector.Plugin.StoneCut/Utility/Command.vb b/Effector.Plugin.StoneCut/Utility/Command.vb
new file mode 100644
index 0000000..f9e3baf
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/Utility/Dictionary.xaml b/Effector.Plugin.StoneCut/Utility/Dictionary.xaml
new file mode 100644
index 0000000..8b7c5d8
--- /dev/null
+++ b/Effector.Plugin.StoneCut/Utility/Dictionary.xaml
@@ -0,0 +1,317 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ None
+
+
+
+ 30
+ 2
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Effector.Plugin.StoneCut/Utility/Dictionary.xaml.vb b/Effector.Plugin.StoneCut/Utility/Dictionary.xaml.vb
new file mode 100644
index 0000000..b1f9dca
--- /dev/null
+++ b/Effector.Plugin.StoneCut/Utility/Dictionary.xaml.vb
@@ -0,0 +1,232 @@
+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 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_Effector_LightBlue As SolidColorBrush = Application.Current.FindResource("Effector_LightBlue")
+ Public Shared ReadOnly Property Effector_LightBlue As SolidColorBrush
+ Get
+ Return m_Effector_LightBlue
+ End Get
+ End Property
+
+ Private Shared m_Effector_Blue As SolidColorBrush = Application.Current.FindResource("Effector_Blue")
+ Public Shared ReadOnly Property Effector_Blue As SolidColorBrush
+ Get
+ Return m_Effector_Blue
+ End Get
+ End Property
+
+ Private Shared m_Effector_DarkBlue As SolidColorBrush = Application.Current.FindResource("Effector_DarkBlue")
+ Public Shared ReadOnly Property Effector_DarkBlue As SolidColorBrush
+ Get
+ Return m_Effector_DarkBlue
+ End Get
+ End Property
+
+ Private Shared m_Effector_LightBlue_Status As SolidColorBrush = Application.Current.FindResource("Effector_LightBlue_Status")
+ Public Shared ReadOnly Property Effector_LightBlue_Status As SolidColorBrush
+ Get
+ Return m_Effector_LightBlue_Status
+ End Get
+ End Property
+
+ Private Shared m_Effector_Blue_Status As SolidColorBrush = Application.Current.FindResource("Effector_Blue_Status")
+ Public Shared ReadOnly Property Effector_Blue_Status As SolidColorBrush
+ Get
+ Return m_Effector_Blue_Status
+ End Get
+ End Property
+
+ Private Shared m_Effector_Red_Status As SolidColorBrush = Application.Current.FindResource("Effector_Red_Status")
+ Public Shared ReadOnly Property Effector_Red_Status As SolidColorBrush
+ Get
+ Return m_Effector_Red_Status
+ End Get
+ End Property
+
+ Private Shared m_Effector_Green_Status As SolidColorBrush = Application.Current.FindResource("Effector_Green_Status")
+ Public Shared ReadOnly Property Effector_Green_Status As SolidColorBrush
+ Get
+ Return m_Effector_Green_Status
+ End Get
+ End Property
+
+ Private Shared m_Effector_Gray_Status As SolidColorBrush = Application.Current.FindResource("Effector_Gray_Status")
+ Public Shared ReadOnly Property Effector_Gray_Status As SolidColorBrush
+ Get
+ Return m_Effector_Gray_Status
+ End Get
+ End Property
+
+ Private Shared m_Effector_Yellow_Status As SolidColorBrush = Application.Current.FindResource("Effector_Yellow_Status")
+ Public Shared ReadOnly Property Effector_Yellow_Status As SolidColorBrush
+ Get
+ Return m_Effector_Yellow_Status
+ End Get
+ End Property
+
+ Private Shared m_Effector_LightBlue_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_LightBlue_SelStatus")
+ Public Shared ReadOnly Property Effector_LightBlue_SelStatus As SolidColorBrush
+ Get
+ Return m_Effector_LightBlue_SelStatus
+ End Get
+ End Property
+
+ Private Shared m_Effector_Blue_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_Blue_SelStatus")
+ Public Shared ReadOnly Property Effector_Blue_SelStatus As SolidColorBrush
+ Get
+ Return m_Effector_Blue_SelStatus
+ End Get
+ End Property
+
+ Private Shared m_Effector_Red_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_Red_SelStatus")
+ Public Shared ReadOnly Property Effector_Red_SelStatus As SolidColorBrush
+ Get
+ Return m_Effector_Red_SelStatus
+ End Get
+ End Property
+
+ Private Shared m_Effector_Green_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_Green_SelStatus")
+ Public Shared ReadOnly Property Effector_Green_SelStatus As SolidColorBrush
+ Get
+ Return m_Effector_Green_SelStatus
+ End Get
+ End Property
+
+ Private Shared m_Effector_Gray_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_Gray_SelStatus")
+ Public Shared ReadOnly Property Effector_Gray_SelStatus As SolidColorBrush
+ Get
+ Return m_Effector_Gray_SelStatus
+ End Get
+ End Property
+
+ Private Shared m_Effector_Yellow_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_Yellow_SelStatus")
+ Public Shared ReadOnly Property Effector_Yellow_SelStatus As SolidColorBrush
+ Get
+ Return m_Effector_Yellow_SelStatus
+ End Get
+ End Property
+
+ Private Shared m_Effector_White_SelStatus As SolidColorBrush = Application.Current.FindResource("Effector_White_SelStatus")
+ Public Shared ReadOnly Property Effector_White_SelStatus As SolidColorBrush
+ Get
+ Return m_Effector_White_SelStatus
+ End Get
+ End Property
+
+
+
+
+
+ 'Private Shared m_Omag_Black As SolidColorBrush = Application.Current.FindResource("Omag_Black")
+ 'Public Shared ReadOnly Property Omag_Black As SolidColorBrush
+ ' Get
+ ' Return m_Omag_Black
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Omag_DarkGray As SolidColorBrush = Application.Current.FindResource("Omag_DarkGray")
+ 'Public Shared ReadOnly Property Omag_DarkGray As SolidColorBrush
+ ' Get
+ ' Return m_Omag_DarkGray
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Omag_LightGray As SolidColorBrush = Application.Current.FindResource("Omag_LightGray")
+ 'Public Shared ReadOnly Property Omag_LightGray As SolidColorBrush
+ ' Get
+ ' Return m_Omag_LightGray
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Effector_Orange As SolidColorBrush = Application.Current.FindResource("Effector_Orange")
+ 'Public Shared ReadOnly Property Effector_Orange As SolidColorBrush
+ ' Get
+ ' Return m_Effector_Orange
+ ' End Get
+ 'End Property
+
+ 'Private Shared m_Icarus_LightBlue As SolidColorBrush = Application.Current.FindResource("Effector_LightBlue_Color")
+ '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_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.StoneCut/Utility/ExecProcessManager.vb b/Effector.Plugin.StoneCut/Utility/ExecProcessManager.vb
new file mode 100644
index 0000000..df79ec7
--- /dev/null
+++ b/Effector.Plugin.StoneCut/Utility/ExecProcessManager.vb
@@ -0,0 +1,711 @@
+Imports System.IO
+Imports System.Threading
+Imports MS.Internal
+Imports Effector.Plugin.StoneCut.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.StoneCut/Utility/GenInterface.vb b/Effector.Plugin.StoneCut/Utility/GenInterface.vb
new file mode 100644
index 0000000..f7bf24d
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/Utility/IdNameStruct.vb b/Effector.Plugin.StoneCut/Utility/IdNameStruct.vb
new file mode 100644
index 0000000..656e028
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/Utility/IniFile.vb b/Effector.Plugin.StoneCut/Utility/IniFile.vb
new file mode 100644
index 0000000..658b230
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/Utility/JsonUtility.vb b/Effector.Plugin.StoneCut/Utility/JsonUtility.vb
new file mode 100644
index 0000000..b211a2f
--- /dev/null
+++ b/Effector.Plugin.StoneCut/Utility/JsonUtility.vb
@@ -0,0 +1,308 @@
+Imports System.Globalization
+Imports Newtonsoft.Json
+Imports Newtonsoft.Json.Converters
+Imports Effector.Plugin.StoneCut.Door
+Imports Effector.Plugin.Lib
+
+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_nTable As Integer
+ Public ReadOnly Property nTable As Integer
+ Get
+ Return m_nTable
+ End Get
+ End Property
+
+ Private m_sFileName As String
+ Public Property sFileName As String
+ Get
+ Return m_sFileName
+ End Get
+ Set(value As String)
+ m_sFileName = value
+ End Set
+ End Property
+
+ Private m_dFileDimension As Double
+ Public Property dFileDimension As Double
+ Get
+ Return m_dFileDimension
+ End Get
+ Set(value As Double)
+ m_dFileDimension = value
+ End Set
+ End Property
+
+ Private m_nState As PartProgramStates = PartProgramStates.NULL
+
+
+ Public ReadOnly Property nState As PartProgramStates
+ Get
+ Return m_nState
+ End Get
+ End Property
+
+#Region "Statistics"
+
+ Private m_dtMachiningStart As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtMachiningStart As DateTime
+ Get
+ Return m_dtMachiningStart
+ End Get
+ End Property
+
+ Private m_dtMachiningEnd As DateTime = DateTime.MinValue
+ Public ReadOnly Property dtMachiningEnd As DateTime
+ Get
+ Return m_dtMachiningEnd
+ End Get
+ End Property
+
+#End Region ' Statistics
+
+
+ Sub New(nId As Integer, sFileName As String, nTable As Integer, dFileDimension As Double)
+ m_nId = nId
+ m_sFileName = sFileName
+ m_nTable = nTable
+ m_dFileDimension = dFileDimension
+ End Sub
+
+ Sub New(nListIndex As Integer, Door As Door)
+ m_nListIndex = nListIndex
+ m_nId = Door.nId
+ m_sFileName = Door.sFileName
+ m_nTable = Door.nTable
+ m_dFileDimension = Door.dFileDimension
+ 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.sFileName
+ '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.StoneCut/Utility/Map.vb b/Effector.Plugin.StoneCut/Utility/Map.vb
new file mode 100644
index 0000000..56fb96d
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/Utility/StringConversion.vb b/Effector.Plugin.StoneCut/Utility/StringConversion.vb
new file mode 100644
index 0000000..0a07106
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/Utility/VMBase.vb b/Effector.Plugin.StoneCut/Utility/VMBase.vb
new file mode 100644
index 0000000..b2d5ce6
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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.StoneCut/packages.config b/Effector.Plugin.StoneCut/packages.config
new file mode 100644
index 0000000..03464bd
--- /dev/null
+++ b/Effector.Plugin.StoneCut/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/Effector.Plugin.StoneCut/pre-build.ps1 b/Effector.Plugin.StoneCut/pre-build.ps1
new file mode 100644
index 0000000..3a61655
--- /dev/null
+++ b/Effector.Plugin.StoneCut/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/EffectorD32.exe b/Exe/EffectorD32.exe
new file mode 100644
index 0000000..416d8b3
Binary files /dev/null and b/Exe/EffectorD32.exe differ
diff --git a/Exe/EffectorR32.exe b/Exe/EffectorR32.exe
new file mode 100644
index 0000000..8c73740
Binary files /dev/null and b/Exe/EffectorR32.exe differ
diff --git a/Exe/EffectorR64.exe b/Exe/EffectorR64.exe
new file mode 100644
index 0000000..07a4dcb
Binary files /dev/null and b/Exe/EffectorR64.exe differ
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