Merge branch 'develop'

This commit is contained in:
Emmanuele Sassi
2024-12-20 16:51:06 +01:00
52 changed files with 8478 additions and 0 deletions
+330
View File
@@ -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
+51
View File
@@ -0,0 +1,51 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Effector.Plugin.Interface", "..\Effector\Effector.Plugin.Interface\Effector.Plugin.Interface.vbproj", "{7D14D864-2BDC-4785-80F4-320164C2D5E4}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Effector.Plugin.FiveLakes", "Effector.Plugin.FiveLakes\Effector.Plugin.FiveLakes.vbproj", "{7C77F537-8235-40AB-B24A-4E71CFB96D2C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x64.ActiveCfg = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x64.Build.0 = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x86.ActiveCfg = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x86.Build.0 = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|Any CPU.Build.0 = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x64.ActiveCfg = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x64.Build.0 = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x86.ActiveCfg = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x86.Build.0 = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x64.ActiveCfg = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x64.Build.0 = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x86.ActiveCfg = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x86.Build.0 = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|Any CPU.Build.0 = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x64.ActiveCfg = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x64.Build.0 = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x86.ActiveCfg = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F9D87F62-BDA1-4B0C-BE15-C43A682829E8}
EndGlobalSection
EndGlobal
+65
View File
@@ -0,0 +1,65 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Effector.Main", "..\Effector.Main\Effector.Main\Effector.Main.vbproj", "{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Effector.Plugin.Interface", "..\Effector.Main\Effector.Plugin.Interface\Effector.Plugin.Interface.vbproj", "{7D14D864-2BDC-4785-80F4-320164C2D5E4}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Effector.Plugin.FiveLakes", "Effector.Plugin.FiveLakes\Effector.Plugin.FiveLakes.vbproj", "{7C77F537-8235-40AB-B24A-4E71CFB96D2C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|Any CPU.ActiveCfg = Debug|x86
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|Any CPU.Build.0 = Debug|x86
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|x64.ActiveCfg = Debug|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|x64.Build.0 = Debug|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|x86.ActiveCfg = Debug|x86
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|x86.Build.0 = Debug|x86
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|Any CPU.ActiveCfg = Release|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|Any CPU.Build.0 = Release|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|x64.ActiveCfg = Release|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|x64.Build.0 = Release|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|x86.ActiveCfg = Release|x86
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|x86.Build.0 = Release|x86
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x64.ActiveCfg = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x64.Build.0 = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x86.ActiveCfg = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x86.Build.0 = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|Any CPU.Build.0 = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x64.ActiveCfg = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x64.Build.0 = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x86.ActiveCfg = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x86.Build.0 = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x64.ActiveCfg = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x64.Build.0 = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x86.ActiveCfg = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x86.Build.0 = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|Any CPU.Build.0 = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x64.ActiveCfg = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x64.Build.0 = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x86.ActiveCfg = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F9D87F62-BDA1-4B0C-BE15-C43A682829E8}
EndGlobalSection
EndGlobal
@@ -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
@@ -0,0 +1,42 @@
'----------------------------------------------------------------------------
' EgalTech 2015-2024
'----------------------------------------------------------------------------
' File : ConstIni.vb Data : 08.05.24 Versione : 2.6e1
' Contenuto : Modulo costanti sezione e chiavi per file Ini.
'
'
'
' Modifiche : 08.05.24 ES Creazione modulo.
'
'
'----------------------------------------------------------------------------
Module ConstIni
Public Const INI_FILE_NAME As String = "Effector.Plugin.FiveLakes.ini"
Public Const S_GENERAL As String = "General"
Public Const K_BACKUPDIR As String = "BackupDir"
Public Const K_RESOURCESDIR As String = "ResourcesDir"
Public Const K_DDFDIR As String = "DDFDir"
Public Const K_GENDDFDIR As String = "GenDDFDir"
Public Const S_CSV As String = "CSV"
Public Const K_DDFNAME As String = "DDFName"
Public Const K_QUANTITY As String = "Quantity"
Public Const K_HEIGHT As String = "Height"
Public Const K_WIDTH As String = "Width"
Public Const K_THICKNESS As String = "Thickness"
Public Const K_DELIMITER As String = "Delimiter"
Public Const S_DEBUG As String = "Debug"
Public Const K_VARIABLELIST As String = "VariableList"
Public Const K_VARIABLEONDRAW As String = "VariableOnDraw"
Public Const K_MACHINECOMMANDS As String = "MachineCommands"
Public Const K_DOORCIRCLIST As String = "DoorCircList"
Public Const K_DOORPRESENCE As String = "DoorPresence"
Public Const K_DOORINDEX As String = "DoorIndex"
Public Const S_NC As String = "NC"
Public Const K_NC_SIMULATE As String = "NcSimulate"
End Module
@@ -0,0 +1,104 @@
<Grid x:Class="DoorListPageV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<Button Content="CSV"
ToolTip="Open CSV file"
Command="{Binding OpenCSV_Command}"
IsEnabled="{Binding bExecButton_IsEnabled}"/>
<Button Content="Skip Door"
ToolTip="Skip Door"
Command="{Binding SkipDoor_Command}"/>
<Button Content="↑"
ToolTip="Move Up"
Command="{Binding MoveUp_Command}"/>
<Button Content="↓"
ToolTip="Move Down"
Command="{Binding MoveDown_Command}"/>
<Button Content="Delete"
ToolTip="Delete"
Command="{Binding Delete_Command}"/>
<Button Content="Delete All"
ToolTip="Delete All"
Command="{Binding DeleteAll_Command}"/>
<Button Content="Produce"
ToolTip="Send to production"
Command="{Binding Produce_Command}"/>
<Button Content="Produce All"
ToolTip="Send all to production"
Command="{Binding ProduceAll_Command}"/>
<Button Content="Reset Production Queue"
ToolTip="Take all the door ready for production back to Verify state"
Command="{Binding ResetProductionQueue_Command}"/>
<Button Content="Verify"
ToolTip="Verify all the doors that are in state Not Verified"
Command="{Binding Verify_Command}"
IsEnabled="{Binding bExecButton_IsEnabled}"/>
</StackPanel>
<DataGrid Grid.Row="1"
ItemsSource="{Binding DoorList}"
SelectedItem="{Binding SelDoor}"
AutoGenerateColumns="False"
CanUserSortColumns="False"
SelectionMode="Single">
<DataGrid.Columns>
<DataGridTextColumn Header=""
Binding="{Binding nId}"
Width="Auto"/>
<DataGridTextColumn Header="Line"
Binding="{Binding nCSVLine}"
Width="Auto"/>
<DataGridTextColumn Header="DDF"
Binding="{Binding sDDFName}"
Width="Auto"/>
<!--<DataGridTextColumn Header="Quantity"
Binding="{Binding nQuantity}"
Width="Auto"/>-->
<DataGridTextColumn Header="State"
Binding="{Binding nState}"
Width="Auto"/>
<DataGridTextColumn Header="Height"
Binding="{Binding dHeight}"
Width="Auto"/>
<DataGridTextColumn Header="Width"
Binding="{Binding dWidth}"
Width="Auto"/>
<DataGridTextColumn Header="Thickness"
Binding="{Binding dThickness}"
Width="Auto"/>
<DataGridTextColumn Header="Csv"
Binding="{Binding sCSVName}"
Width="Auto"/>
<DataGridTextColumn Header="Production State"
Binding="{Binding nProdState}"
Width="Auto"/>
<DataGridTextColumn Header="Load Time"
Binding="{Binding sLoadTime}"
Width="Auto"/>
<DataGridTextColumn Header="Machining 1 Start"
Binding="{Binding sMachining1Start}"
Width="Auto"/>
<DataGridTextColumn Header="Machining 1 End"
Binding="{Binding sMachining1End}"
Width="Auto"/>
<DataGridTextColumn Header="Machining 2 Start"
Binding="{Binding sMachining2Start}"
Width="Auto"/>
<DataGridTextColumn Header="Machining 2 End"
Binding="{Binding sMachining2End}"
Width="Auto"/>
<DataGridTextColumn Header="Unload Time"
Binding="{Binding sUnloadTime}"
Width="Auto"/>
</DataGrid.Columns>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="{Binding Background}"/>
</Style>
</DataGrid.RowStyle>
</DataGrid>
</Grid>
@@ -0,0 +1,3 @@
Public Class DoorListPageV
End Class
@@ -0,0 +1,939 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports Newtonsoft.Json
Imports System.Windows.Threading
Imports System.Text.RegularExpressions
Public Class DoorListPageVM
Inherits VMBase
Private m_BackupTimer As New DispatcherTimer
Private m_RefreshGraphicsTimer As New DispatcherTimer
Private m_ExecProcessManager As ExecProcessManager
Private m_DoorList As New ObservableCollection(Of Door)
Public ReadOnly Property DoorList As ObservableCollection(Of Door)
Get
Return m_DoorList
End Get
End Property
Private m_SelDoor As Door
Public Property SelDoor As Door
Get
Return m_SelDoor
End Get
Set(value As Door)
m_SelDoor = value
End Set
End Property
Private m_bExecButton_IsEnabled As Boolean = True
Public ReadOnly Property bExecButton_IsEnabled As Boolean
Get
Return m_bExecButton_IsEnabled
End Get
End Property
Private Sub SetExecButtonIsEnabled(bValue As Boolean)
m_bExecButton_IsEnabled = bValue
NotifyPropertyChanged(NameOf(bExecButton_IsEnabled))
End Sub
Private m_nModifyIndex As Integer = 0
Private m_nBackupindex As Integer = 0
Private m_bWritingBackup As Boolean = False
' Definizione comandi
Private m_cmdOpenCSV As ICommand
Private m_cmdSkipDoor As ICommand
Private m_cmdMoveUp As ICommand
Private m_cmdMoveDown As ICommand
Private m_cmdDelete As ICommand
Private m_cmdDeleteAll As ICommand
Private m_cmdProduce As ICommand
Private m_cmdProduceAll As ICommand
Private m_cmdResetProductionQueue As ICommand
Private m_cmdVerify As ICommand
#Region "CONSTRUCTOR"
Sub New()
' imposto riferimento in Map
Map.SetRefDoorListPageVM(Me)
Dim sBackupDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "BackupDir", "", sBackupDirPath)
Dim sBackupFilePath As String = sBackupDirPath & "\Backup.json"
Read(sBackupFilePath)
m_BackupTimer.Interval = New TimeSpan(0, 0, 1)
AddHandler m_BackupTimer.Tick, AddressOf BackupTimer_Tick
m_RefreshGraphicsTimer.Interval = New TimeSpan(0, 0, 1)
AddHandler m_RefreshGraphicsTimer.Tick, AddressOf RefreshGraphicsTimer_Tick
m_BackupTimer.Start()
m_RefreshGraphicsTimer.Start()
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Function ExecCAMProcess(sDDFName As String) As Boolean
' lancio esecuzione programma
Dim sCamExePath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "CAMExePath", "", sCamExePath)
Dim sMainLuaPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "MainLUA", "", sMainLuaPath)
Dim sGenDDFDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
Dim sDDFFilePath As String = sGenDDFDirPath & "\" & sDDFName
Return Map.refSupervisorFunction.PlgExecProcess(sCamExePath, sMainLuaPath, sDDFFilePath)
End Function
Friend Function ExecCAMProcessAsync(sDDFName As String) As Boolean
' lancio esecuzione programma
Dim sCamExePath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "CAMExePath", "", sCamExePath)
Dim sMainLuaPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "MainLUA", "", sMainLuaPath)
Dim sGenDDFDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
Dim sDDFFilePath As String = sGenDDFDirPath & "\" & sDDFName
Return Map.refSupervisorFunction.PlgExecProcessAsync(sCamExePath, sMainLuaPath, sDDFFilePath)
End Function
Public Sub Read(FilePath As String)
If Not File.Exists(FilePath) Then Return
Dim sReadedFile As String = File.ReadAllText(FilePath)
Dim JsonDoorList As List(Of JsonDoor) = JsonConvert.DeserializeObject(Of List(Of JsonDoor))(sReadedFile)
JsonDoorList = JsonDoorList.OrderBy(Of Integer)(Function(x) x.nListIndex).ToList()
m_DoorList = New ObservableCollection(Of Door)((From JsonDoor In JsonDoorList
Select New Door(JsonDoor)).ToList())
End Sub
Public Sub Write(FilePath As String)
Dim JsonDoorList As New List(Of JsonDoor)
For nDoorIndex As Integer = 0 To m_DoorList.Count - 1
JsonDoorList.Add(New JsonDoor(nDoorIndex + 1, m_DoorList(nDoorIndex)))
Next
Dim JsonFromWindow As String = JsonConvert.SerializeObject(JsonDoorList, Formatting.Indented)
If File.Exists(FilePath) Then
Dim sBackupFilePath As String = Path.ChangeExtension(FilePath, ".bck")
If File.Exists(sBackupFilePath) Then
Try
File.Delete(sBackupFilePath)
Catch ex As Exception
Map.refSupervisorFunction.PlgOutLog("Error! Impossible deleting backup file!")
End Try
End If
Try
File.Move(FilePath, sBackupFilePath)
Catch ex As Exception
Map.refSupervisorFunction.PlgOutLog("Error! Impossible renaming backup file!")
End Try
End If
File.WriteAllText(FilePath, JsonFromWindow)
End Sub
Private Sub WriteBackupCmd()
If m_bWritingBackup Then Return
m_bWritingBackup = True
m_nBackupindex = m_nModifyIndex
Dim sBackupDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_BACKUPDIR, "", sBackupDirPath)
Dim sBackupFilePath As String = sBackupDirPath & "\Backup.json"
Write(sBackupFilePath)
m_bWritingBackup = False
End Sub
Friend Sub WriteBackup()
m_nModifyIndex += 1
End Sub
Private Sub BackupTimer_Tick(sender As Object, e As EventArgs)
If m_nBackupindex < m_nModifyIndex Then
WriteBackupCmd()
End If
End Sub
Private Sub RefreshGraphicsTimer_Tick(sender As Object, e As EventArgs)
If IsNothing(m_ExecProcessManager) Then Return
' ciclo su coda risultati
Dim ArgumentsResult As ProcessArgsResult = m_ExecProcessManager.ArgumentsResultDequeue
While Not IsNothing(ArgumentsResult)
' aggiorno risultato sulla porta
Dim CurrRequestDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nId = ArgumentsResult.ProcessArgs.nId)
If Not IsNothing(CurrRequestDoor) Then
CurrRequestDoor.SetState(If(ArgumentsResult.nResult = 0, Door.DoorStates.VERIFIED, Door.DoorStates.VERIFICATION_FAILED))
' elimino file generati
Dim sGenDDFDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
Dim sDoorFileName As String = CurrRequestDoor.sDDFName & "_" & CurrRequestDoor.nId
Try
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".tok")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.tok")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".cnc")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_a.cnc")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_b.cnc")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.cnc")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2_a.cnc")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".html")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.html")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".log")
File.Delete(sGenDDFDirPath & "\" & CurrRequestDoor.sDDFName & ".nge")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".nge")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".sest")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.sest")
File.Delete(sGenDDFDirPath & "\" & CurrRequestDoor.sDDFName & ".txt")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & ".txt")
File.Delete(sGenDDFDirPath & "\" & sDoorFileName & "_2.txt")
Catch ex As Exception
End Try
End If
WriteBackup()
ArgumentsResult = m_ExecProcessManager.ArgumentsResultDequeue
End While
If Not bExecButton_IsEnabled AndAlso m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then
SetExecButtonIsEnabled(True)
End If
End Sub
Friend Function GetNextDoor() As Door
Dim NextDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.nState = Door.DoorStates.READY_FOR_PRODUCTION)
If Not IsNothing(NextDoor) Then
Map.refSupervisorFunction.PlgOutLog("GetNextDoor: door " & NextDoor.nId & " set at ON_LOAD_STATION")
NextDoor.SetState(Door.DoorStates.ON_LOAD_STATION)
WriteBackup()
End If
Return NextDoor
End Function
Public Sub ResetProductionQueue()
For Each Door In m_DoorList
If Door.nState = Door.DoorStates.READY_FOR_PRODUCTION Then
Door.SetState(Door.DoorStates.VERIFIED, False)
End If
Next
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "OpenCSV"
Public ReadOnly Property OpenCSV_Command As ICommand
Get
If m_cmdOpenCSV Is Nothing Then
m_cmdOpenCSV = New Command(AddressOf OpenCSV)
End If
Return m_cmdOpenCSV
End Get
End Property
Public Sub OpenCSV()
Dim sDir As String = String.Empty
'GetMainPrivateProfileString(S_GENERAL, K_LASTIMPDIR, "", sDir)
Dim OpenFileDialog As New Microsoft.Win32.OpenFileDialog() With {
.DefaultExt = ".csv",
.Filter = "CSV (*.csv)|*.csv",
.InitialDirectory = If(Directory.Exists(sDir), sDir, ""),
.CheckFileExists = True,
.ValidateNames = True}
If OpenFileDialog.ShowDialog() Then
Dim sCSVPath As String = OpenFileDialog.FileName
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(sCSVPath)
MyReader.TextFieldType = FileIO.FieldType.Delimited
Dim sDelimiter As String = ""
GetPluginPrivateProfileString(S_CSV, K_DELIMITER, ";", sDelimiter)
MyReader.SetDelimiters(sDelimiter)
' leggo intestazione
Dim Headers As String() = MyReader.ReadFields()
Dim sDDFName As String = ""
Dim sQuantityName As String = ""
Dim sHeightName As String = ""
Dim sWidthName As String = ""
Dim sThicknessName As String = ""
GetPluginPrivateProfileString(S_CSV, K_DDFNAME, K_DDFNAME, sDDFName)
GetPluginPrivateProfileString(S_CSV, K_QUANTITY, "", sQuantityName)
GetPluginPrivateProfileString(S_CSV, K_HEIGHT, "", sHeightName)
GetPluginPrivateProfileString(S_CSV, K_WIDTH, "", sWidthName)
GetPluginPrivateProfileString(S_CSV, K_THICKNESS, "", sThicknessName)
Dim nDDFNameIndex As Integer = Array.IndexOf(Headers, sDDFName)
Dim nQuantityNameIndex As Integer = Array.IndexOf(Headers, sQuantityName)
Dim nHeightNameIndex As Integer = Array.IndexOf(Headers, sHeightName)
Dim nWidthNameIndex As Integer = Array.IndexOf(Headers, sWidthName)
Dim nThicknessNameIndex As Integer = Array.IndexOf(Headers, sThicknessName)
If nDDFNameIndex = -1 Then
Dim sMessage As String = "Error! DDFName column not found! Csv file will not be read!"
' egtoutlog(sMessage)
MessageBox.Show(sMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
Dim Values As String()
Dim nLineIndex As Integer = 1
Dim sLineErrorList As String = ""
While Not MyReader.EndOfData
Try
Values = MyReader.ReadFields()
Dim nQuantity As Integer = 1
If nQuantityNameIndex >= 0 AndAlso nQuantityNameIndex < Values.Count Then
If Not Integer.TryParse(Values(nQuantityNameIndex), nQuantity) OrElse nQuantity < 1 Then
nQuantity = 1
Dim sLine As String = ""
For nValueIndex = 0 To Values.Count - 1
sLine &= Values(nValueIndex) & If(nValueIndex < Values.Count, ";", "")
Next
sLineErrorList &= "Quantity not readable in line " & sLine & ". This line will be skipped"
Continue While
End If
End If
Dim dWidth As Double = 0
If nWidthNameIndex >= 0 AndAlso nWidthNameIndex < Values.Count Then
If Not StringToDouble(Values(nWidthNameIndex), dWidth) OrElse dWidth < 0 Then
dWidth = 0
End If
End If
Dim dHeight As Double = 0
If nHeightNameIndex >= 0 AndAlso nHeightNameIndex < Values.Count Then
If Not StringToDouble(Values(nHeightNameIndex), dHeight) OrElse dHeight < 0 Then
dHeight = 0
End If
End If
Dim dThickness As Double = 0
If nThicknessNameIndex >= 0 AndAlso nThicknessNameIndex < Values.Count Then
If Not StringToDouble(Values(nThicknessNameIndex), dThickness) OrElse dThickness < 0 Then
dThickness = 0
End If
End If
For nQuantityIndex = 1 To nQuantity
Dim nId As Integer = 1
If m_DoorList.Count > 0 Then
Dim nMaxId As Integer = m_DoorList.Max(Of Integer)(Function(x) x.nId)
'If nMaxId < 100 Then
nId = nMaxId + 1
'End If
End If
Dim NewDoor As New Door(nId, nLineIndex, Values(nDDFNameIndex), Path.GetFileName(sCSVPath),
1, dWidth, dHeight, dThickness, Headers, Values)
m_DoorList.Add(NewDoor)
Next
nLineIndex += 1
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
Dim sMessage As String = "Line " & ex.Message & "is not valid and will be skipped."
' egtoutlog(sMessage)
sLineErrorList &= Environment.NewLine & ex.Message
End Try
End While
If Not String.IsNullOrWhiteSpace(sLineErrorList) Then
MessageBox.Show("The following lines are not valid and have been skipped:" & sLineErrorList, "Error", MessageBoxButton.OK, MessageBoxImage.Error)
End If
End Using
Dim sCamExePath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "CAMExePath", "", sCamExePath)
Dim sMainLuaPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "MainPipeLUA", "", sMainLuaPath)
Dim bStartExecProcessManager As Boolean = False
If IsNothing(m_ExecProcessManager) Then
bStartExecProcessManager = True
m_ExecProcessManager = New ExecProcessManager(sCamExePath, """" & sMainLuaPath & """")
AddHandler m_ExecProcessManager.m_AllArgsProcessed, AddressOf ExecProcessManager_AllArgsProcessed
m_ExecProcessManager.SetMaxCamInstances(3)
End If
Dim sDDFDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_DDFDIR, "", sDDFDirPath)
Dim sGenDDFDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_GENDDFDIR, "", sGenDDFDirPath)
For Each Door In m_DoorList
If Door.nState = Door.DoorStates.LOADED_FROM_CSV Then
Dim sDDFFilePath As String = sDDFDirPath & "\" & Door.sDDFName & ".ddf"
Dim sGenDDFFilePath As String = sGenDDFDirPath & "\" & Door.sDDFName & "_" & Door.nId & ".ddf"
Try
File.Copy(sDDFFilePath, sGenDDFFilePath, True)
Catch ex As Exception
Map.refSupervisorFunction.PlgOutLog("Error: Copy file from " & sDDFFilePath & " to " & sGenDDFFilePath & " failed!")
End Try
m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sGenDDFFilePath))
End If
Next
If bStartExecProcessManager OrElse m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then
m_ExecProcessManager.StartExecutionThread()
SetExecButtonIsEnabled(False)
End If
End If
WriteBackup()
End Sub
Public Sub ExecProcessManager_AllArgsProcessed()
m_ExecProcessManager.StopExecutionThread()
End Sub
Public Sub ExecProcessManager_PostProcess(ProcessArgsResult As ProcessArgsResult)
' verifico file di risultati
Dim sDDFDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "DDFDir", "", sDDFDirPath)
Dim sDDFFilePath As String = sDDFDirPath & "\" & ProcessArgsResult.ProcessArgs.sArgs
Dim sTxtFilePath As String = Path.ChangeExtension(sDDFDirPath, ".txt")
If Not File.Exists(sTxtFilePath) Then
ProcessArgsResult.SetResult(-1)
Return
End If
Dim TxtFileLines As String() = File.ReadAllLines(sTxtFilePath)
For nLineIndex As Integer = 0 To TxtFileLines.Count - 1
Dim Match As Match = Regex.Match(TxtFileLines(nLineIndex), "\s*Err\s*=\s*(\d*)\s*")
If Not IsNothing(Match) AndAlso Not IsNothing(Match.Groups(1)) Then
Dim sResult As String = Match.Groups(1).Value
Dim nResult As Integer = -2
If Integer.TryParse(sResult, nResult) Then
ProcessArgsResult.SetResult(nResult)
Else
ProcessArgsResult.SetResult(-2)
End If
End If
Next
End Sub
#End Region ' OpenCSV
#Region "SkipDoor"
Public ReadOnly Property SkipDoor_Command As ICommand
Get
If m_cmdSkipDoor Is Nothing Then
m_cmdSkipDoor = New Command(AddressOf SkipDoor)
End If
Return m_cmdSkipDoor
End Get
End Property
Public Sub SkipDoor()
If IsNothing(SelDoor) OrElse (SelDoor.nState <> Door.DoorStates.VERIFIED AndAlso SelDoor.nState <> Door.DoorStates.SKIPPED) Then Return
SelDoor.SetState(If(SelDoor.nState = Door.DoorStates.VERIFIED, Door.DoorStates.SKIPPED, Door.DoorStates.VERIFIED))
WriteBackup()
End Sub
#End Region ' SkipDoor
#Region "MoveUp"
Public ReadOnly Property MoveUp_Command As ICommand
Get
If m_cmdMoveUp Is Nothing Then
m_cmdMoveUp = New Command(AddressOf MoveUp)
End If
Return m_cmdMoveUp
End Get
End Property
Public Sub MoveUp()
If IsNothing(SelDoor) Then Return
Dim nOldIndex As Integer = m_DoorList.IndexOf(SelDoor)
If nOldIndex = 0 Then Return
If m_DoorList(nOldIndex - 1).nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Return
m_DoorList.Move(nOldIndex, nOldIndex - 1)
WriteBackup()
End Sub
#End Region ' MoveUp
#Region "MoveDown"
Public ReadOnly Property MoveDown_Command As ICommand
Get
If m_cmdMoveDown Is Nothing Then
m_cmdMoveDown = New Command(AddressOf MoveDown)
End If
Return m_cmdMoveDown
End Get
End Property
Public Sub MoveDown()
If IsNothing(SelDoor) OrElse SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Return
Dim nOldIndex As Integer = m_DoorList.IndexOf(SelDoor)
If nOldIndex = m_DoorList.Count - 1 Then Return
m_DoorList.Move(nOldIndex, nOldIndex + 1)
WriteBackup()
End Sub
#End Region ' MoveDown
#Region "Delete"
Public ReadOnly Property Delete_Command As ICommand
Get
If m_cmdDelete Is Nothing Then
m_cmdDelete = New Command(AddressOf Delete)
End If
Return m_cmdDelete
End Get
End Property
Public Sub Delete()
If IsNothing(SelDoor) OrElse SelDoor.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Return
If MessageBox.Show("Are you sure you want to delete the selected door?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
m_DoorList.Remove(SelDoor)
WriteBackup()
End If
End Sub
#End Region ' Delete
#Region "DeleteAll"
Public ReadOnly Property DeleteAll_Command As ICommand
Get
If m_cmdDeleteAll Is Nothing Then
m_cmdDeleteAll = New Command(AddressOf DeleteAll)
End If
Return m_cmdDeleteAll
End Get
End Property
Public Sub DeleteAll()
If m_DoorList.Count = 0 Then Return
If MessageBox.Show("Are you sure you want to delete all the doors?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
For nDoorIndex = m_DoorList.Count - 1 To 0 Step -1
Dim Door As Door = m_DoorList(nDoorIndex)
If Door.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Continue For
m_DoorList.Remove(Door)
Next
WriteBackup()
End If
End Sub
#End Region ' DeleteAll
#Region "Produce"
Public ReadOnly Property Produce_Command As ICommand
Get
If m_cmdProduce Is Nothing Then
m_cmdProduce = New Command(AddressOf Produce)
End If
Return m_cmdProduce
End Get
End Property
Public Sub Produce()
ProduceDoor(m_SelDoor)
WriteBackup()
End Sub
Public Sub ProduceDoor(DoorToProduce As Door, Optional bWriteBackup As Boolean = True)
If IsNothing(DoorToProduce) OrElse DoorToProduce.nState = Door.DoorStates.SKIPPED OrElse
DoorToProduce.nState = Door.DoorStates.VERIFICATION_FAILED OrElse
DoorToProduce.nState >= Door.DoorStates.READY_FOR_PRODUCTION Then Return
' la sposto dopo l'ultima da produrre
Dim nNewIndex As Integer = m_DoorList.IndexOf(m_DoorList.FirstOrDefault(Function(x) x.nState < Door.DoorStates.READY_FOR_PRODUCTION))
Dim nOldIndex As Integer = m_DoorList.IndexOf(DoorToProduce)
m_DoorList.Move(nOldIndex, nNewIndex)
DoorToProduce.SetState(Door.DoorStates.READY_FOR_PRODUCTION, bWriteBackup)
End Sub
#End Region ' Produce
#Region "ProduceAll"
Public ReadOnly Property ProduceAll_Command As ICommand
Get
If m_cmdProduceAll Is Nothing Then
m_cmdProduceAll = New Command(AddressOf ProduceAll)
End If
Return m_cmdProduceAll
End Get
End Property
Public Sub ProduceAll()
If m_DoorList.Count = 0 Then Return
For nDoorIndex = 0 To m_DoorList.Count - 1
Dim CurrDoor As Door = m_DoorList(nDoorIndex)
ProduceDoor(CurrDoor, False)
Next
WriteBackup()
End Sub
#End Region ' ProduceAll
#Region "ResetProductionQueue"
Public ReadOnly Property ResetProductionQueue_Command As ICommand
Get
If m_cmdResetProductionQueue Is Nothing Then
m_cmdResetProductionQueue = New Command(AddressOf ResetProductionQueueCmd)
End If
Return m_cmdResetProductionQueue
End Get
End Property
Public Sub ResetProductionQueueCmd()
ResetProductionQueue()
WriteBackup()
End Sub
#End Region ' ResetProductionQueue
#Region "Verify"
Public ReadOnly Property Verify_Command As ICommand
Get
If m_cmdVerify Is Nothing Then
m_cmdVerify = New Command(AddressOf Verify)
End If
Return m_cmdVerify
End Get
End Property
Public Sub Verify()
Dim sCamExePath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "CAMExePath", "", sCamExePath)
Dim sMainLuaPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "MainPipeLUA", "", sMainLuaPath)
Dim bStartExecProcessManager As Boolean = False
If IsNothing(m_ExecProcessManager) Then
bStartExecProcessManager = True
m_ExecProcessManager = New ExecProcessManager(sCamExePath, """" & sMainLuaPath & """")
'm_ExecProcessManager.SetPostProcess(AddressOf ExecProcessManager_PostProcess)
AddHandler m_ExecProcessManager.m_AllArgsProcessed, AddressOf ExecProcessManager_AllArgsProcessed
m_ExecProcessManager.SetMaxCamInstances(3)
End If
Dim sDDFDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "DDFDir", "", sDDFDirPath)
For Each Door In m_DoorList
If Door.nState = Door.DoorStates.LOADED_FROM_CSV Or Door.nState = Door.DoorStates.VERIFICATION_FAILED Then
Dim sDDFFilePath As String = sDDFDirPath & "\" & Door.sDDFName & ".ddf"
m_ExecProcessManager.ArgumentsEnqueue(New ProcessArgs(Door.nId, sDDFFilePath))
End If
Next
If bStartExecProcessManager OrElse m_ExecProcessManager.ExecutionThreadStatus = ExecProcessManager.ExecutionThreadStatuses.STOPPED Then
m_ExecProcessManager.StartExecutionThread()
SetExecButtonIsEnabled(False)
End If
WriteBackup()
End Sub
#End Region ' Verify
#End Region ' COMMANDS
End Class
Public Class Door
Inherits VMBase
Public Enum DoorStates As Integer
NULL = 0
LOADED_FROM_CSV = 1
VERIFIED = 10
VERIFICATION_FAILED = 11
SKIPPED = 20
READY_FOR_PRODUCTION = 30
ON_LOAD_STATION = 31
MACHINE_1_START = 33
MACHINE_1_END = 34
MACHINE_2_START = 35
MACHINE_2_END = 36
PRODUCED = 37
SCRAP = 40
End Enum
Public Enum DoorProdStates As Integer
NOT_INIT = 0
IMPORTED = 1
SENT_1 = 2
START_MACHINING_1 = 3
MACHINED_1 = 4
SENT_2 = 5
START_MACHINING_2 = 6
MACHINED_2 = 7
UNLOADED = 8
End Enum
Private m_nId As Integer
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Private m_nCSVLine As Integer
Public ReadOnly Property nCSVLine As Integer
Get
Return m_nCSVLine
End Get
End Property
Private m_sDDFName As String
Public ReadOnly Property sDDFName As String
Get
Return m_sDDFName
End Get
End Property
Private m_nQuantity As Integer
Public ReadOnly Property nQuantity As Integer
Get
Return m_nQuantity
End Get
End Property
Private m_dWidth As Double
Public ReadOnly Property dWidth As Double
Get
Return m_dWidth
End Get
End Property
Private m_dHeight As Double
Public ReadOnly Property dHeight As Double
Get
Return m_dHeight
End Get
End Property
Private m_dThickness As Double
Public ReadOnly Property dThickness As Double
Get
Return m_dThickness
End Get
End Property
Private m_sCSVName As String
Public ReadOnly Property sCSVName As String
Get
Return m_sCSVName
End Get
End Property
Private m_CustomerParameters As New List(Of CustomerParameter)
Public ReadOnly Property CustomerParameters As List(Of CustomerParameter)
Get
Return m_CustomerParameters
End Get
End Property
Private m_nState As DoorStates = DoorStates.LOADED_FROM_CSV
Public ReadOnly Property nState As DoorStates
Get
Return m_nState
End Get
End Property
Friend Sub SetState(value As DoorStates, Optional bWriteBackup As Boolean = True, Optional bUpdate As Boolean = True)
m_nState = value
If bWriteBackup Then Map.refDoorListPageVM.WriteBackup()
If bUpdate Then
NotifyPropertyChanged(NameOf(nState))
NotifyPropertyChanged(NameOf(Background))
End If
End Sub
#Region "Statistics"
Private m_nProdState As DoorProdStates = DoorProdStates.NOT_INIT
Public ReadOnly Property nProdState As DoorProdStates
Get
Return m_nProdState
End Get
End Property
Friend Sub SetProdState(value As DoorProdStates)
m_nProdState = value
Select Case value
Case DoorProdStates.SENT_1
SetState(DoorStates.ON_LOAD_STATION)
Case DoorProdStates.START_MACHINING_1
SetState(DoorStates.MACHINE_1_START)
Case DoorProdStates.MACHINED_1
SetState(DoorStates.MACHINE_1_END)
Case DoorProdStates.START_MACHINING_2
SetState(DoorStates.MACHINE_2_START)
Case DoorProdStates.MACHINED_2
SetState(DoorStates.MACHINE_2_END)
Case DoorProdStates.UNLOADED
SetState(DoorStates.PRODUCED)
End Select
NotifyPropertyChanged(NameOf(nProdState))
End Sub
Private m_dtLoadTime As DateTime = DateTime.MinValue
Friend ReadOnly Property dtLoadTime As DateTime
Get
Return m_dtLoadTime
End Get
End Property
Public ReadOnly Property sLoadTime As String
Get
Return If(m_dtLoadTime <> DateTime.MinValue, m_dtLoadTime.ToString("yy/MM/dd hh:mm:ss"), "")
End Get
End Property
Friend Sub SetLoadTime(LoadTime As Long)
m_dtLoadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(LoadTime).ToLocalTime()
NotifyPropertyChanged(NameOf(sLoadTime))
End Sub
Private m_dtMachining1Start As DateTime = DateTime.MinValue
Friend ReadOnly Property dtMachining1Start As DateTime
Get
Return m_dtMachining1Start
End Get
End Property
Public ReadOnly Property sMachining1Start As String
Get
Return If(m_dtMachining1Start <> DateTime.MinValue, m_dtMachining1Start.ToString("yy/MM/dd hh:mm:ss"), "")
End Get
End Property
Friend Sub SetMachining1Start(Machining1Start As Long)
m_dtMachining1Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining1Start).ToLocalTime()
NotifyPropertyChanged(NameOf(sMachining1Start))
End Sub
Private m_dtMachining1End As DateTime = DateTime.MinValue
Friend ReadOnly Property dtMachining1End As DateTime
Get
Return m_dtMachining1End
End Get
End Property
Public ReadOnly Property sMachining1End As String
Get
Return If(m_dtMachining1End <> DateTime.MinValue, m_dtMachining1End.ToString("yy/MM/dd hh:mm:ss"), "")
End Get
End Property
Friend Sub SetMachining1End(Machining1End As Long)
m_dtMachining1End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining1End).ToLocalTime()
NotifyPropertyChanged(NameOf(sMachining1End))
End Sub
Private m_dtMachining2Start As DateTime = DateTime.MinValue
Friend ReadOnly Property dtMachining2Start As DateTime
Get
Return m_dtMachining2Start
End Get
End Property
Public ReadOnly Property sMachining2Start As String
Get
Return If(m_dtMachining2Start <> DateTime.MinValue, m_dtMachining2Start.ToString("yy/MM/dd hh:mm:ss"), "")
End Get
End Property
Friend Sub SetMachining2Start(Machining2Start As Long)
m_dtMachining2Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining2Start).ToLocalTime()
NotifyPropertyChanged(NameOf(sMachining2Start))
End Sub
Private m_dtMachining2End As DateTime = DateTime.MinValue
Friend ReadOnly Property dtMachining2End As DateTime
Get
Return m_dtMachining2End
End Get
End Property
Public ReadOnly Property sMachining2End As String
Get
Return If(m_dtMachining2End <> DateTime.MinValue, m_dtMachining2End.ToString("yy/MM/dd hh:mm:ss"), "")
End Get
End Property
Friend Sub SetMachining2End(Machining2End As Long)
m_dtMachining2End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Machining2End).ToLocalTime()
NotifyPropertyChanged(NameOf(sMachining2End))
End Sub
Private m_dtUnloadTime As DateTime = DateTime.MinValue
Friend ReadOnly Property dtUnloadTime As DateTime
Get
Return m_dtUnloadTime
End Get
End Property
Public ReadOnly Property sUnloadTime As String
Get
Return If(m_dtUnloadTime <> DateTime.MinValue, m_dtUnloadTime.ToString("yy/MM/dd hh:mm:ss"), "")
End Get
End Property
Friend Sub SetUnloadTime(UnloadTime As Long)
m_dtUnloadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(UnloadTime).ToLocalTime()
NotifyPropertyChanged(NameOf(sUnloadTime))
End Sub
#End Region ' Statistics
Public ReadOnly Property Background As SolidColorBrush
Get
Select Case m_nState
Case DoorStates.LOADED_FROM_CSV
Return Brushes.White
Case DoorStates.VERIFICATION_FAILED
Return Brushes.Red
Case DoorStates.SKIPPED
Return Brushes.Orange
Case DoorStates.READY_FOR_PRODUCTION
Return Brushes.LightSkyBlue
Case DoorStates.ON_LOAD_STATION
Return Brushes.SkyBlue
Case DoorStates.MACHINE_1_START
Return Brushes.DodgerBlue
Case DoorStates.MACHINE_1_END
Return Brushes.Yellow
Case DoorStates.MACHINE_2_START
Return Brushes.DodgerBlue
Case DoorStates.MACHINE_2_END, DoorStates.PRODUCED
Return Brushes.LightGray
Case DoorStates.SCRAP
Return Brushes.MediumPurple
Case Else
Return Brushes.White
End Select
End Get
End Property
Sub New(nId As Integer, nCSVLine As Integer, sDDFName As String, sCSVName As String, nQuantity As Integer, dWidth As Double, dHeight As Double, dThickness As Double, HeaderList As String(), ValueList As String())
m_nId = nId
m_nCSVLine = nCSVLine
m_sDDFName = sDDFName
m_sCSVName = sCSVName
m_nQuantity = nQuantity
m_dHeight = dHeight
m_dWidth = dWidth
m_dThickness = dThickness
If Not IsNothing(HeaderList) AndAlso HeaderList.Count > 0 AndAlso Not IsNothing(ValueList) AndAlso ValueList.Count > 0 Then
For nParamIndex = 0 To Math.Max(HeaderList.Count, ValueList.Count) - 1
m_CustomerParameters.Add(New CustomerParameter(If(HeaderList.Count > nParamIndex, HeaderList(nParamIndex), ""), If(ValueList.Count > nParamIndex, ValueList(nParamIndex), "")))
Next
End If
End Sub
Sub New(JsonDoor As JsonDoor)
m_nId = JsonDoor.nId
m_nCSVLine = JsonDoor.nCSVLine
m_sDDFName = JsonDoor.sDDFName
m_sCSVName = JsonDoor.sCSVName
m_nQuantity = JsonDoor.nQuantity
m_dHeight = JsonDoor.dHeight
m_dWidth = JsonDoor.dWidth
m_dThickness = JsonDoor.dThickness
m_nState = JsonDoor.nState
m_CustomerParameters = JsonDoor.CustomerParameters
m_nProdState = JsonDoor.nProdState
m_dtLoadTime = JsonDoor.dtLoadTime
m_dtMachining1Start = JsonDoor.dtMachining1Start
m_dtMachining1End = JsonDoor.dtMachining1End
m_dtMachining2Start = JsonDoor.dtMachining2Start
m_dtMachining2End = JsonDoor.dtMachining2End
m_dtUnloadTime = JsonDoor.dtUnloadTime
End Sub
End Class
Public Class CustomerParameter
Private m_sHeader As String
Public ReadOnly Property sHeader As String
Get
Return m_sHeader
End Get
End Property
Private m_sValue As String
Public ReadOnly Property sValue As String
Get
Return m_sValue
End Get
End Property
Sub New(sHeader As String, sValue As String)
m_sHeader = sHeader
m_sValue = sValue
End Sub
End Class
@@ -0,0 +1,213 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<RootNamespace>Effector.Plugin.FiveLakes</RootNamespace>
<AssemblyName>Effector.Plugin.FiveLakes</AssemblyName>
<OutputType>Library</OutputType>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<MyType>Custom</MyType>
<Deterministic>true</Deterministic>
<ProjectGuid>{7C77F537-8235-40AB-B24A-4E71CFB96D2C}</ProjectGuid>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<IncrementalBuild>true</IncrementalBuild>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>Effector.Plugin.FiveLakes.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugSymbols>false</DebugSymbols>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<IncrementalBuild>false</IncrementalBuild>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>Effector.Plugin.FiveLakes.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="Effector.Plugin.Interface">
<HintPath>..\..\Effector.Main\Effector.Plugin.Interface\bin\Debug\Effector.Plugin.Interface.dll</HintPath>
</Reference>
<Reference Include="KeraLua, Version=1.4.1.0, Culture=neutral, PublicKeyToken=6a194c04b9c89217, processorArchitecture=MSIL">
<HintPath>..\packages\KeraLua.1.4.1\lib\net46\KeraLua.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Import Include="System.Threading.Tasks" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows" />
<Import Include="System.Windows.Controls" />
<Import Include="System.Windows.Data" />
<Import Include="System.Windows.Documents" />
<Import Include="System.Windows.Input" />
<Import Include="System.Windows.Shapes" />
<Import Include="System.Windows.Media" />
<Import Include="System.Windows.Media.Imaging" />
<Import Include="System.Windows.Navigation" />
</ItemGroup>
<ItemGroup>
<Compile Include="Constants\ConstGen.vb" />
<Compile Include="Constants\ConstIni.vb" />
<Compile Include="DoorListPage\DoorListPageV.xaml.vb">
<DependentUpon>DoorListPageV.xaml</DependentUpon>
</Compile>
<Compile Include="DoorListPage\DoorListPageVM.vb" />
<Compile Include="ProcessManager\ProcessManagerV.xaml.vb">
<DependentUpon>ProcessManagerV.xaml</DependentUpon>
</Compile>
<Compile Include="FiveLakesUI.xaml.vb">
<DependentUpon>FiveLakesUI.xaml</DependentUpon>
</Compile>
<Compile Include="FiveLakesUIVM.vb" />
<Compile Include="LUA\LuaManager.vb" />
<Compile Include="LUA\Lua_Aux.vb" />
<Compile Include="LUA\Lua_General.vb" />
<Compile Include="MachinePage\MachinePageV.xaml.vb">
<DependentUpon>MachinePageV.xaml</DependentUpon>
</Compile>
<Compile Include="MachinePage\MachinePageVM.vb" />
<Compile Include="MainMenu\MainMenuV.xaml.vb">
<DependentUpon>MainMenuV.xaml</DependentUpon>
</Compile>
<Compile Include="MainMenu\MainMenuVM.vb" />
<Compile Include="ProcessManager\ProcessManagerVM.vb" />
<Compile Include="RestartWnd\RestartWndV.xaml.vb">
<DependentUpon>RestartWndV.xaml</DependentUpon>
</Compile>
<Compile Include="RestartWnd\RestartWndVM.vb" />
<Compile Include="StatisticsPage\StatisticsPageV.xaml.vb">
<DependentUpon>StatisticsPageV.xaml</DependentUpon>
</Compile>
<Compile Include="StatisticsPage\StatisticsPageVM.vb" />
<Compile Include="Utility\Dictionary.xaml.vb">
<DependentUpon>Dictionary.xaml</DependentUpon>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Utility\Command.vb" />
<Compile Include="Utility\ExecProcessManager.vb" />
<Compile Include="Utility\GenInterface.vb" />
<Compile Include="Utility\IdNameStruct.vb" />
<Compile Include="Utility\IniFile.vb" />
<Compile Include="Utility\JsonUtility.vb" />
<Compile Include="Utility\Map.vb" />
<Compile Include="Utility\StringConversion.vb" />
<Compile Include="Utility\VMBase.vb" />
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
</EmbeddedResource>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Page Include="DoorListPage\DoorListPageV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ProcessManager\ProcessManagerV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="FiveLakesUI.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MachinePage\MachinePageV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainMenu\MainMenuV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="RestartWnd\RestartWndV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="StatisticsPage\StatisticsPageV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Utility\Dictionary.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PreBuildEvent>powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\pre-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>copy $(TargetPath) c:\EgtData\Effector\Plugin\Effector.Plugin.FiveLakes\Effector.Plugin.FiveLakes.dll
</PostBuildEvent>
</PropertyGroup>
<Import Project="..\packages\KeraLua.1.4.1\build\net46\KeraLua.targets" Condition="Exists('..\packages\KeraLua.1.4.1\build\net46\KeraLua.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>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}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\KeraLua.1.4.1\build\net46\KeraLua.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\KeraLua.1.4.1\build\net46\KeraLua.targets'))" />
</Target>
</Project>
@@ -0,0 +1,32 @@
<Grid x:Class="FiveLakesUI"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"
DataContext="{StaticResource FiveLakesUIVM}">
<TabControl SelectedIndex="{Binding SelPage}">
<TabControl.ItemContainerStyle>
<Style TargetType="TabItem">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
</TabControl.ItemContainerStyle>
<TabItem Name="DoorList"
Header="DoorList">
<local:DoorListPageV DataContext="{StaticResource DoorListVM}"/>
</TabItem>
<TabItem Name="Machine"
Header="Machine">
<local:MachinePageV DataContext="{StaticResource MachinePageVM}"/>
</TabItem>
<TabItem Name="Statistics"
Header="Statistics">
<local:StatisticsPageV DataContext="{StaticResource StatisticsPageVM}"/>
</TabItem>
</TabControl>
<!--<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding TextTest}" Background="Green"/>
<Button Grid.Column="1"
x:Name="Button1"/>-->
</Grid>
@@ -0,0 +1,31 @@
Imports System.ComponentModel.Composition
Imports Effector.Plugin.Interface
<Export(GetType(IPluginControl))>
<ExportMetadata("Name", "Project")>
Public Class FiveLakesUI
Implements IPluginControl
Private m_FiveLakesUIVM As FiveLakesUIVM
<ImportingConstructor>
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
@@ -0,0 +1,60 @@
Imports System.ComponentModel.Composition
Imports Effector.Plugin.Interface
Public Class FiveLakesUIVM
Inherits VMBase
Public Enum Pages As Integer
DOOR_LIST = 0
MACHINE_STATUS = 1
STATISTICS = 2
End Enum
Private m_sDataRoot As String
Private m_sConfigDir As String
Private m_sIniFile As String
Private m_sResourcesRoot As String
Private m_SelPage As Pages
Public Property SelPage As Integer
Get
Return m_SelPage
End Get
Set(value As Integer)
m_SelPage = value
End Set
End Property
Friend Sub SetSelPage(nPage As Pages)
m_SelPage = nPage
NotifyPropertyChanged(NameOf(SelPage))
End Sub
Private m_TextTest As String
Public ReadOnly Property TextTest As String
Get
Return m_TextTest
End Get
End Property
Friend Sub SetTextTest(sValue As String)
m_TextTest = sValue
NotifyPropertyChanged(NameOf(TextTest))
End Sub
Sub New()
' Creo riferimento a questa classe in Map
Map.BeginInit(Me)
' Impostazione path radice per i dati
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
If GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
End If
m_sDataRoot &= "\" & "Plugin\Effector.Plugin.FiveLakes"
' Impostazione direttorio di configurazione
m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
' Impostazione path Ini file
IniFile.SetIniFile(m_sConfigDir & "\" & INI_FILE_NAME)
' Impostazione path resources dir
m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR
End Sub
End Class
@@ -0,0 +1,17 @@
Imports System.ComponentModel.Composition
Imports Effector.Plugin.Interface
Imports KeraLua
<Export(GetType(IPluginLuaManager))>
<ExportMetadata("Name", "LuaManager")>
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
+686
View File
@@ -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
@@ -0,0 +1,156 @@
Imports KeraLua
Public Module Lua_General
Friend func_PlgGetNumberFromIni As LuaFunction = AddressOf Lua_PlgGetNumberFromIni
Friend func_PlgGetStringFromIni As LuaFunction = AddressOf Lua_PlgGetStringFromIni
Friend func_PlgWriteStringToIni As LuaFunction = AddressOf Lua_PlgWriteStringToIni
Friend func_PlgExecProcess As LuaFunction = AddressOf Lua_PlgExecProcess
Friend func_PlgExecProcessAsync As LuaFunction = AddressOf Lua_PlgExecProcessAsync
Friend func_PlgCheckExecProcessAsync As LuaFunction = AddressOf Lua_PlgCheckExecProcessAsync
Friend func_PlgGetNextDoor As LuaFunction = AddressOf Lua_PlgGetNextDoor
Friend func_PlgOpenRestartWnd As LuaFunction = AddressOf Lua_PlgOpenRestartWnd
Friend func_PlgMachineReset As LuaFunction = AddressOf Lua_PlgMachineReset
Private Function Lua_PlgGetNumberFromIni(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 4 parametri: sSec, sKey, dDef
Dim sSec As String = ""
Dim sKey As String = ""
Dim dDef As Integer = 0
LuaCheckParam(state, 1, sSec)
LuaCheckParam(state, 2, sKey)
LuaCheckParam(state, 3, dDef)
LuaClearStack(state)
Dim dResult As Double = GetPluginPrivateProfileDouble(sSec, sKey, dDef)
' restituisco il risultato
LuaSetParam(state, dResult)
Return 1
End Function
Private Function Lua_PlgGetStringFromIni(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 4 parametri: sSec, sKey, sDef
Dim sSec As String = ""
Dim sKey As String = ""
Dim sDef As String = 0
LuaCheckParam(state, 1, sSec)
LuaCheckParam(state, 2, sKey)
LuaCheckParam(state, 3, sDef)
LuaClearStack(state)
Dim sResult As String = ""
GetPluginPrivateProfileString(sSec, sKey, sDef, sResult)
' restituisco il risultato
LuaSetParam(state, sResult)
Return 1
End Function
Private Function Lua_PlgWriteStringToIni(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 4 parametri: sSec, sKey, sVal
Dim sSec As String = ""
Dim sKey As String = ""
Dim sVal As Integer = 0
LuaCheckParam(state, 1, sSec)
LuaCheckParam(state, 2, sKey)
LuaCheckParam(state, 3, sVal)
LuaClearStack(state)
Dim bResult As Boolean = WritePluginPrivateProfileString(sSec, sKey, sVal)
' restituisco il risultato
LuaSetParam(state, bResult)
Return 1
End Function
Private Function Lua_PlgExecProcess(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim sDDFName As String = ""
LuaCheckParam(state, 1, sDDFName)
LuaClearStack(state)
If Map.refDoorListPageVM.ExecCAMProcess(sDDFName) Then
state.PushBoolean(True)
Return 1
Else
Return 0
End If
End Function
Private Function Lua_PlgExecProcessAsync(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim sDDFName As String = ""
LuaCheckParam(state, 1, sDDFName)
LuaClearStack(state)
If Map.refDoorListPageVM.ExecCAMProcessAsync(sDDFName) Then
state.PushBoolean(True)
Return 1
Else
Return 0
End If
End Function
Private Function Lua_PlgCheckExecProcessAsync(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
LuaClearStack(state)
Dim bHasExited As Boolean = False
Dim nExitCode As Integer = -1
If Map.refSupervisorFunction.PlgCheckExecProcessAsync(bHasExited, nExitCode) Then
state.PushBoolean(bHasExited)
state.PushInteger(nExitCode)
Return 2
Else
Return 0
End If
End Function
Private Function Lua_PlgGetNextDoor(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
LuaClearStack(state)
Dim NextDoor As Door = Map.refDoorListPageVM.GetNextDoor()
If Not IsNothing(NextDoor) Then
' restituisco il risultato
LuaSetParam(state, NextDoor.nId)
' Dim sGenDDFName As String = Path.GetFileNameWithoutExtension(NextDoor.sDDFName) & "_" & NextDoor.nId & ".ddf"
LuaSetParam(state, NextDoor.sDDFName & "_" & NextDoor.nId)
Return 2
End If
Return 0
End Function
Private Function Lua_PlgOpenRestartWnd(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim nMachineIndex As Integer = 1
LuaGetParam(state, 1, nMachineIndex)
LuaClearStack(state)
Dim RestartWnd As New RestartWndV(Application.Current.MainWindow, New RestartWndVM(nMachineIndex))
Dim bRes As Boolean = RestartWnd.ShowDialog()
If Not IsNothing(bRes) Then
' restituisco il risultato
LuaSetParam(state, bRes)
Return 1
End If
Return 0
End Function
Private Function Lua_PlgMachineReset(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim nMachineIndex As Integer = 1
LuaGetParam(state, 1, nMachineIndex)
LuaClearStack(state)
Map.refDoorListPageVM.ResetProductionQueue()
Return 0
End Function
Friend Function LuaInstallGeneral(state As Lua) As Boolean
If IsNothing(state) Then Return False
state.Register("PlgGetNumberFromIni", func_PlgGetNumberFromIni)
state.Register("PlgGetStringFromIni", func_PlgGetStringFromIni)
state.Register("PlgWriteStringToIni", func_PlgWriteStringToIni)
state.Register("PlgExecProcess", func_PlgExecProcess)
state.Register("PlgExecProcessAsync", func_PlgExecProcessAsync)
state.Register("PlgCheckExecProcessAsync", func_PlgCheckExecProcessAsync)
state.Register("PlgGetNextDoor", func_PlgGetNextDoor)
state.Register("PlgOpenRestartWnd", func_PlgOpenRestartWnd)
state.Register("PlgMachineReset", func_PlgMachineReset)
Return True
End Function
End Module
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,3 @@
Public Class MachinePageV
End Class
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,32 @@
<Grid x:Class="MainMenuV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
DataContext="{StaticResource MainMenuVM}"
WindowChrome.IsHitTestVisibleInChrome="True">
<Grid.Resources>
<sys:Int32 x:Key="Door_List">0</sys:Int32>
<sys:Int32 x:Key="Machine_State">1</sys:Int32>
<sys:Int32 x:Key="Statistics">2</sys:Int32>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<RadioButton Content="Door List"
Command="{Binding Page_Command}"
CommandParameter="{StaticResource Door_List}"
IsChecked="True"
Style="{StaticResource {x:Type ToggleButton}}"/>
<RadioButton Grid.Column="1"
Content="Machine Status"
Command="{Binding Page_Command}"
CommandParameter="{StaticResource Machine_State}"
Style="{StaticResource {x:Type ToggleButton}}"/>
<RadioButton Grid.Column="2"
Content="Statistics"
Command="{Binding Page_Command}"
CommandParameter="{StaticResource Statistics}"
Style="{StaticResource {x:Type ToggleButton}}"/>
</Grid>
@@ -0,0 +1,9 @@
Imports System.ComponentModel.Composition
Imports Effector.Plugin.Interface
<Export(GetType(IPluginControl))>
<ExportMetadata("Name", "MainMenu")>
Public Class MainMenuV
Implements IPluginControl
End Class
@@ -0,0 +1,28 @@
Public Class MainMenuVM
Inherits VMBase
' Definizione comandi
Private m_cmdPage As ICommand
#Region "COMMANDS"
#Region "Page"
Public ReadOnly Property Page_Command As ICommand
Get
If m_cmdPage Is Nothing Then
m_cmdPage = New Command(AddressOf Page)
End If
Return m_cmdPage
End Get
End Property
Public Sub Page(nPage As Integer)
Map.refFiveLakesUIVM.SetSelPage(nPage)
End Sub
#End Region ' Page
#End Region ' COMMANDS
End Class
@@ -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
<Assembly: AssemblyTitle("Effector.Plugin.FiveLakes")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Windows User")>
<Assembly: AssemblyProduct("Effector.Plugin.FiveLakes")>
<Assembly: AssemblyCopyright("Copyright @ Windows User 2024")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(false)>
'In order to begin building localizable applications, set
'<UICulture>CultureYouAreCodingWith</UICulture> in your .vbproj file
'inside a <PropertyGroup>. For example, if you are using US english
'in your source files, set the <UICulture> 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.
'<Assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)>
'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)
<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("b4747d9a-5420-4702-8e86-59fa0fb1ad51")>
' 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:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
@@ -0,0 +1,62 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 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.
' </auto-generated>
'------------------------------------------------------------------------------
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.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 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.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.Effector.Plugin.FiveLakes.My.MySettings
Get
Return Global.Effector.Plugin.FiveLakes.My.MySettings.Default
End Get
End Property
End Module
End Namespace
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -0,0 +1,57 @@
<Window x:Class="ProcessManagerV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="200"
Width="300">
<StackPanel>
<Grid HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Arguments Queue Count: "/>
<TextBlock Grid.Column="1"
Text="{Binding ArgumentsQueue}"/>
<TextBlock Grid.Row="1"
Text="ResultQueue: "/>
<TextBlock Grid.Column="1"
Grid.Row="1"
Text="{Binding ResultQueue}"/>
</Grid>
<!--<DataGrid ItemsSource="{Binding ThreadList}"
AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Process Status"
Binding="{Binding ProcessStatus}"/>
<DataGridTextColumn Header="Curr Request Id"
Binding="{Binding CurrRequest.nId}"/>
<DataGridTextColumn Header="Curr Request Args"
Binding="{Binding CurrRequest.sArgs}"/>
<DataGridTextColumn Header="Process Result"
Binding="{Binding nProcResult}"/>
</DataGrid.Columns>
</DataGrid>-->
<ItemsControl ItemsSource="{Binding ThreadList}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ProcessStatus}"/>
<TextBlock Text="{Binding CurrRequest.nId}"/>
<TextBlock Text="{Binding CurrRequest.sArgs}"/>
<TextBlock Text="{Binding nProcResult}"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ProgressBar Value="{Binding dProgress_Value, Mode=OneWay}"
Minimum="0"
Maximum="{Binding dProgress_Maximum}"
Height="20"
Width="250"/>
</StackPanel>
</Window>
@@ -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
@@ -0,0 +1,70 @@
Imports System.Windows.Threading
Imports System.Collections.ObjectModel
Public Class ProcessManagerVM
Inherits VMBase
Private m_nTaskQuantity As Integer = 3
Private m_UpdateDataTimer As New DispatcherTimer
Private m_ExecProcessManager As ExecProcessManager
Public ReadOnly Property ExecProcessManager As ExecProcessManager
Get
Return m_ExecProcessManager
End Get
End Property
Public ReadOnly Property ArgumentsQueue As String
Get
Return m_ExecProcessManager.ArgumentsQueueCount.ToString()
End Get
End Property
Public ReadOnly Property ResultQueue As String
Get
Return m_ExecProcessManager.ArgumentsResultQueueCount.ToString()
End Get
End Property
Public ReadOnly Property ThreadList As ObservableCollection(Of ThreadData)
Get
If Not IsNothing(m_ExecProcessManager.ThreadDataList) Then
Return New ObservableCollection(Of ThreadData)(m_ExecProcessManager.ThreadDataList.ToList())
Else
Return New ObservableCollection(Of ThreadData)
End If
End Get
End Property
Private m_dProgress_Value As Double
Public ReadOnly Property dProgress_Value As Double
Get
Return (m_dProgress_Maximum - m_nTaskQuantity - m_ExecProcessManager.ArgumentsQueueCount) '/ m_dProgress_Maximum * 100
End Get
End Property
Private m_dProgress_Maximum As Double
Public ReadOnly Property dProgress_Maximum As Double
Get
Return m_dProgress_Maximum
End Get
End Property
Sub New(ExecProcessManager As ExecProcessManager)
m_ExecProcessManager = ExecProcessManager
m_dProgress_Maximum = m_ExecProcessManager.ArgumentsQueueCount + m_nTaskQuantity
m_UpdateDataTimer.Interval = New TimeSpan(0, 0, 1)
AddHandler m_UpdateDataTimer.Tick, AddressOf UpdateDataTimer_Tick
m_UpdateDataTimer.Start()
End Sub
Private Sub UpdateDataTimer_Tick(sender As Object, e As EventArgs)
NotifyPropertyChanged(NameOf(ArgumentsQueue))
NotifyPropertyChanged(NameOf(ResultQueue))
NotifyPropertyChanged(NameOf(ThreadList))
NotifyPropertyChanged(NameOf(dProgress_Value))
End Sub
End Class
@@ -0,0 +1,282 @@
<Window x:Class="RestartWndV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="{Binding sTitle}">
<Window.Resources>
<local:StringToVisibilityConverter x:Key="StringToVisibilityConverter"/>
<local:DoorToVisibilityConverter x:Key="DoorToVisibilityConverter"/>
<local:StateToVisibilityConverter x:Key="StateToVisibilityConverter"/>
<local:VariableNameToVisibilityConverter x:Key="VariableNameToVisibilityConverter"/>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Image Source="{Binding sMachineImagePath}"
Stretch="Uniform"/>
<!--Porte-->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*"/>
<ColumnDefinition Width="2.5*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="2.5*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="2.5*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="2.5*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="2.5*"/>
<ColumnDefinition Width="0.7*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2.15*"/>
<RowDefinition Height="0.6*"/>
<RowDefinition Height="2.15*"/>
</Grid.RowDefinitions>
<Border Grid.Column="1"
Grid.Row="1"
Visibility="{Binding nMachineIndex, Converter={StaticResource VariableNameToVisibilityConverter}, ConverterParameter=WP_PR_00}"
Style="{StaticResource Door}">
<TextBlock Text="{Binding DoorOnMachineArray[0].nId}"
Style="{StaticResource MachDrawVar_TextBlock}"/>
</Border>
<Border Grid.Column="3"
Grid.Row="1"
Visibility="{Binding nMachineIndex, Converter={StaticResource VariableNameToVisibilityConverter}, ConverterParameter=WP_PR_01}"
Style="{StaticResource Door}">
<TextBlock Text="{Binding DoorOnMachineArray[1].nId}"
Style="{StaticResource MachDrawVar_TextBlock}"/>
</Border>
<Border Grid.Column="5"
Grid.Row="1"
Visibility="{Binding nMachineIndex, Converter={StaticResource VariableNameToVisibilityConverter}, ConverterParameter=WP_PR_02}"
Style="{StaticResource Door}">
<TextBlock Text="{Binding DoorOnMachineArray[2].nId}"
Style="{StaticResource MachDrawVar_TextBlock}"/>
</Border>
<Border Grid.Column="7"
Grid.Row="1"
Visibility="{Binding nMachineIndex, Converter={StaticResource VariableNameToVisibilityConverter}, ConverterParameter=WP_PR_03}"
Style="{StaticResource Door}">
<TextBlock Text="{Binding DoorOnMachineArray[3].nId}"
Style="{StaticResource MachDrawVar_TextBlock}"/>
</Border>
<Border Grid.Column="9"
Grid.Row="1"
Visibility="{Binding nMachineIndex, Converter={StaticResource VariableNameToVisibilityConverter}, ConverterParameter=WP_PR_04}"
Style="{StaticResource Door}">
<TextBlock Text="{Binding DoorOnMachineArray[4].nId}"
Style="{StaticResource MachDrawVar_TextBlock}"/>
</Border>
</Grid>
<!--Descrizione porte-->
<ItemsControl Grid.Row="1"
ItemsSource="{Binding DoorOnMachineArray}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="5"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Visibility="{Binding Converter={StaticResource DoorToVisibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="0"
Grid.Row="0"
Text="Id"/>
<TextBlock Grid.Column="1"
Grid.Row="0"
Text="{Binding nId}"/>
<TextBlock Grid.Column="0"
Grid.Row="1"
Text="Circular Index"/>
<TextBlock Grid.Column="1"
Grid.Row="1"
Text="{Binding nCircIndex}"/>
<TextBlock Grid.Column="0"
Grid.Row="2"
Text="State"/>
<TextBlock Grid.Column="1"
Grid.Row="2"
Text="{Binding nState}"/>
<TextBlock Grid.Column="0"
Grid.Row="3"
Text="DDF Name"/>
<TextBlock Grid.Column="1"
Grid.Row="3"
Text="{Binding sDDFName}"/>
<TextBlock Grid.Column="0"
Grid.Row="4"
Text="CSV Name"/>
<TextBlock Grid.Column="1"
Grid.Row="4"
Text="{Binding sCSVName}"/>
<!--<TextBlock Grid.Column="0"
Grid.Row="5"
Text="DoorCode"/>
<TextBlock Grid.Column="1"
Grid.Row="5"
Text="{Binding sDoorCode}"/>
<TextBlock Grid.Column="0"
Grid.Row="6"
Text="DoorDescription"/>
<TextBlock Grid.Column="1"
Grid.Row="6"
Text="{Binding sDoorDescription}"/>
<TextBlock Grid.Column="0"
Grid.Row="7"
Text="M1 CN Path"/>
<TextBlock Grid.Column="1"
Grid.Row="7"
Text="{Binding sM1CNPath}"/>
<TextBlock Grid.Column="0"
Grid.Row="8"
Text="M2 CN Path"/>
<TextBlock Grid.Column="1"
Grid.Row="8"
Text="{Binding sM2CNPath}"/>-->
<TextBlock Grid.Column="0"
Grid.Row="9"
Text="Load Time"/>
<TextBlock Grid.Column="1"
Grid.Row="9"
Text="{Binding sLoadTime}"/>
<TextBlock Grid.Column="0"
Grid.Row="10"
Text="Machining 1 Start"/>
<TextBlock Grid.Column="1"
Grid.Row="10"
Text="{Binding sMachining1Start}"/>
<TextBlock Grid.Column="0"
Grid.Row="11"
Text="Machining 1 End"/>
<TextBlock Grid.Column="1"
Grid.Row="11"
Text="{Binding sMachining1End}"/>
<TextBlock Grid.Column="0"
Grid.Row="12"
Text="Machining 2 Start"/>
<TextBlock Grid.Column="1"
Grid.Row="12"
Text="{Binding sMachining2Start}"/>
<TextBlock Grid.Column="0"
Grid.Row="13"
Text="Machining 2 End"/>
<TextBlock Grid.Column="1"
Grid.Row="13"
Text="{Binding sMachining2End}"/>
<TextBlock Grid.Column="0"
Grid.Row="14"
Text="UnloadTime"/>
<TextBlock Grid.Column="1"
Grid.Row="14"
Text="{Binding sUnloadTime}"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
<!--<ItemsControl ItemsSource="{Binding RestartDoorList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="1"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Visibility="{Binding nState, Converter={StaticResource StateToVisibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="0"
Grid.Row="0"
Text="Id"/>
<TextBlock Grid.Column="1"
Grid.Row="0"
Text="{Binding nId}"/>
<TextBlock Grid.Column="0"
Grid.Row="1"
Text="Circular Index"/>
<TextBlock Grid.Column="1"
Grid.Row="1"
Text="{Binding nCircIndex}"/>
<TextBlock Grid.Column="0"
Grid.Row="2"
Text="State"/>
<TextBlock Grid.Column="1"
Grid.Row="2"
Text="{Binding nState}"/>
<ComboBox Grid.Column="1"
Grid.Row="2"
ItemsSource="{Binding DoorStateList}"
SelectedItem="{Binding SelDoorState}"/>
<TextBlock Grid.Column="0"
Grid.Row="3"
Text="DDF Name"/>
<TextBlock Grid.Column="1"
Grid.Row="3"
Text="{Binding sDDFName}"/>
<TextBlock Grid.Column="0"
Grid.Row="4"
Text="CSV Name"/>
<TextBlock Grid.Column="1"
Grid.Row="4"
Text="{Binding sCSVName}"/>
<TextBlock Text="Id"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>-->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Button Content="Ok"
Command="{Binding Ok_Command}"/>
<Button Grid.Column="1"
Content="Empty Line"
Command="{Binding Empty_Command}"/>
</Grid>
</Grid>
</Window>
@@ -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
@@ -0,0 +1,435 @@
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Imports System.Collections.ObjectModel
Imports System.Globalization
Imports System.IO
Imports System.Reflection
Public Class RestartWndVM
Inherits VMBase
Friend Event m_CloseWindow(bDialogResult As Boolean)
Private m_sTitle As String = ""
Public ReadOnly Property sTitle As String
Get
Return m_sTitle
End Get
End Property
Private m_nMachineIndex As Integer = 1
Public ReadOnly Property nMachineIndex As Integer
Get
Return m_nMachineIndex
End Get
End Property
Private m_RestartDoorList As ObservableCollection(Of RestartDoor)
Public ReadOnly Property RestartDoorList As ObservableCollection(Of RestartDoor)
Get
Return m_RestartDoorList
End Get
End Property
Private m_sMachineImagePath As String
Public ReadOnly Property sMachineImagePath As String
Get
Return m_sMachineImagePath
End Get
End Property
'Private m_DoorOnMachineArray(4) As RestartDoor
'Public ReadOnly Property DoorOnMachineArray As RestartDoor()
' Get
' Return m_DoorOnMachineArray
' End Get
'End Property
Private m_DoorOnMachineArray As New ObservableCollection(Of RestartDoor)
Public ReadOnly Property DoorOnMachineArray As ObservableCollection(Of RestartDoor)
Get
Return m_DoorOnMachineArray
End Get
End Property
Public ReadOnly Property VariableList As ObservableCollection(Of Variable)
Get
Return Map.refMachinePageVM.VariableList
End Get
End Property
' Definizione comandi
Private m_cmdOk As ICommand
Private m_cmdEmpty As ICommand
#Region "CONSTRUCTOR"
Sub New(nMachineIndex As Integer)
m_nMachineIndex = nMachineIndex
m_sTitle = "Machine " & m_nMachineIndex
If Map.refSupervisorFunction.PlgGetPrivateProfileInt(S_NC, K_NC_SIMULATE, 0) > 0 Then
For nIndex = 0 To 4
Dim dValue As Double = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORPRESENCE & "M" & m_nMachineIndex & "P" & nIndex, 0)
WriteVariableValueToName(nMachineIndex, "@WP_PR_0" & nIndex.ToString(), dValue)
Dim nValue As Integer = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORINDEX & "M" & m_nMachineIndex & "P" & nIndex, 0)
WriteVariableValueToName(nMachineIndex, "@DOORN_S" & nIndex.ToString(), nValue)
Next
End If
Dim sBackupFilePath As String = ""
GetPluginPrivateProfileString("General", "BackupDir", "", sBackupFilePath)
sBackupFilePath &= "\LuaBackup.json"
Dim JsonLuaDoorList As List(Of JsonLuaDoor)
If File.Exists(sBackupFilePath) Then
Dim sReadedFile As String = File.ReadAllText(sBackupFilePath)
JsonLuaDoorList = JsonConvert.DeserializeObject(Of List(Of JsonLuaDoor))(sReadedFile)
JsonLuaDoorList = JsonLuaDoorList.OrderBy(Of Integer)(Function(x) x.nCircIndex).ToList()
End If
' creo posti in lista descrizioni
For nIndex As Integer = 0 To 4
m_DoorOnMachineArray.Add(Nothing)
Next
' leggo presenze porta
For nPositionIndex As Integer = 4 To 0 Step -1
Dim dWPValue As Double = 0
GetVariableValueFromName(nMachineIndex, "@WP_PR_0" & nPositionIndex.ToString(), dWPValue)
If dWPValue <> 0 Then
' verifico indice
Dim nCircindex As Integer = 0
GetVariableValueFromName(nMachineIndex, "@DOORN_S" & nPositionIndex.ToString(), nCircindex)
If nCircindex <> 0 Then
m_DoorOnMachineArray(nPositionIndex) = New RestartDoor(JsonLuaDoorList(nCircindex - 1))
End If
End If
Next
NotifyPropertyChanged(NameOf(DoorOnMachineArray))
'If File.Exists(sBackupFilePath) Then
' Dim sReadedFile As String = File.ReadAllText(sBackupFilePath)
' Dim JsonLuaDoorList As List(Of JsonLuaDoor) = JsonConvert.DeserializeObject(Of List(Of JsonLuaDoor))(sReadedFile)
' JsonLuaDoorList = JsonLuaDoorList.OrderBy(Of Integer)(Function(x) x.nCircIndex).ToList()
' m_RestartDoorList = New ObservableCollection(Of RestartDoor)((From JsonLuaDoor In Map.refDoorListPageVM.DoorList
' Select New RestartDoor(JsonLuaDoor)).ToList())
' For JsonLuaDoorIndex = 0 To JsonLuaDoorList.Count - 1
' Dim JsonLuaDoor As JsonLuaDoor = JsonLuaDoorList(JsonLuaDoorIndex)
' Dim RestartDoor As RestartDoor = m_RestartDoorList.FirstOrDefault(Function(x) x.nId = JsonLuaDoor.nId)
' If Not IsNothing(RestartDoor) Then
' RestartDoor.Update(JsonLuaDoor)
' End If
' Next
'End If
' se macchina 1
Dim sResourcesDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_RESOURCESDIR, "", sResourcesDirPath)
m_sMachineImagePath = sResourcesDirPath & "\Multiax-C1223Ripartenza.png"
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Public Shared Function GetVariableValueFromName(nMachIndex As Integer, sName As String, ByRef nValue As Integer) As Boolean
Dim Variable As Variable = Map.refMachinePageVM.VariableList.FirstOrDefault(Function(x) x.nMachine = nMachIndex AndAlso x.sName = sName)
If IsNothing(Variable) Then Return False
Dim nIndex As Integer = 0
If Not Integer.TryParse(Variable.sIndex, nIndex) Then Return False
Return Map.refSupervisorFunction.ComReadShortVar(nIndex, nValue, nMachIndex)
End Function
Public Shared Function GetVariableValueFromName(nMachIndex As Integer, sName As String, ByRef dValue As Double) As Boolean
Dim Variable As Variable = Map.refMachinePageVM.VariableList.FirstOrDefault(Function(x) x.nMachine = nMachIndex AndAlso x.sName = sName)
If IsNothing(Variable) Then Return False
Dim nIndex As Integer = 0
If Not Integer.TryParse(Variable.sIndex, nIndex) Then Return False
Return Map.refSupervisorFunction.ComReadDoubleVar(nIndex, dValue, nMachIndex)
End Function
Public Shared Function WriteVariableValueToName(nMachIndex As Integer, sName As String, nValue As Integer) As Boolean
Dim Variable As Variable = Map.refMachinePageVM.VariableList.FirstOrDefault(Function(x) x.nMachine = nMachIndex AndAlso x.sName = sName)
If IsNothing(Variable) Then Return False
Dim nIndex As Integer = 0
If Not Integer.TryParse(Variable.sIndex, nIndex) Then Return False
Return Map.refSupervisorFunction.ComWriteShortVar(nIndex, nValue, nMachIndex)
End Function
Public Shared Function WriteVariableValueToName(nMachIndex As Integer, sName As String, dValue As Double) As Boolean
Dim Variable As Variable = Map.refMachinePageVM.VariableList.FirstOrDefault(Function(x) x.nMachine = nMachIndex AndAlso x.sName = sName)
If IsNothing(Variable) Then Return False
Dim nIndex As Integer = 0
If Not Integer.TryParse(Variable.sIndex, nIndex) Then Return False
Return Map.refSupervisorFunction.ComWriteDoubleVar(nIndex, dValue, nMachIndex)
End Function
#End Region ' METHODS
#Region "COMMANDS"
#Region "Ok"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok()
RaiseEvent m_CloseWindow(True)
End Sub
#End Region ' Ok
#Region "Empty"
Public ReadOnly Property Empty_Command As ICommand
Get
If m_cmdEmpty Is Nothing Then
m_cmdEmpty = New Command(AddressOf Empty)
End If
Return m_cmdEmpty
End Get
End Property
Public Sub Empty()
Map.refDoorListPageVM.ResetProductionQueue()
Map.refDoorListPageVM.WriteBackup()
RaiseEvent m_CloseWindow(False)
End Sub
#End Region ' Empty
#End Region ' COMMANDS
End Class
Public Class StateToVisibilityConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
If IsNothing(value) OrElse Not TypeOf value Is Integer Then Return Visibility.Collapsed
Return If(value > 0, Visibility.Visible, Visibility.Collapsed)
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
Public Class VariableNameToVisibilityConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
If IsNothing(value) OrElse Not TypeOf value Is Integer Then Return Visibility.Collapsed
If IsNothing(parameter) OrElse Not TypeOf parameter Is String OrElse String.IsNullOrWhiteSpace(parameter) Then Return Visibility.Collapsed
Dim nMachineIndex As Integer = 0
If Not Integer.TryParse(value, nMachineIndex) Then Return Visibility.Collapsed
Dim dWPValue As Double = 0
RestartWndVM.GetVariableValueFromName(nMachineIndex, "@" & parameter, dWPValue)
Return If(dWPValue = 1 OrElse dWPValue = 2 OrElse dWPValue = 3, Visibility.Visible, Visibility.Collapsed)
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
Public Class RestartDoor
Inherits VMBase
Private m_nId As Integer = -1
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Private m_nCircIndex As Integer = -1
Public ReadOnly Property nCircIndex As Integer
Get
Return m_nCircIndex
End Get
End Property
Private m_nState As Integer = 0
Public ReadOnly Property nState As Integer
Get
Return m_nState
End Get
End Property
Private m_DoorStateList As New List(Of IdNameStruct)({New IdNameStruct(0, "Not On Machine"),
New IdNameStruct(1, "Imported"),
New IdNameStruct(2, "On Load"),
New IdNameStruct(3, "On Machine 1"),
New IdNameStruct(4, "On Medium Station"),
New IdNameStruct(6, "On Machine 2"),
New IdNameStruct(7, "On Unload"),
New IdNameStruct(8, "Produced"),
New IdNameStruct(100, "Scrap")})
Public ReadOnly Property DoorStateList As List(Of IdNameStruct)
Get
Return m_DoorStateList
End Get
End Property
Public Property SelDoorState As IdNameStruct
Get
Return m_DoorStateList.FirstOrDefault(Function(x) x.Id = m_nState)
End Get
Set(value As IdNameStruct)
m_nState = value.Id
End Set
End Property
Private m_sDoorCode As String = ""
Public ReadOnly Property sDoorCode As String
Get
Return m_sDoorCode
End Get
End Property
Private m_sDoorDescription As String = ""
Public ReadOnly Property sDoorDescription As String
Get
Return m_sDoorDescription
End Get
End Property
Private m_sDDFName As String = ""
Public ReadOnly Property sDDFName As String
Get
Return m_sDDFName
End Get
End Property
Private m_sCSVName As String = ""
Public ReadOnly Property sCSVName As String
Get
Return m_sCSVName
End Get
End Property
Private m_sM1CNPath As String = ""
Public ReadOnly Property sM1CNPath As String
Get
Return m_sM1CNPath
End Get
End Property
Private m_sM2CNPath As String = ""
Public ReadOnly Property sM2CNPath As String
Get
Return m_sM2CNPath
End Get
End Property
Private m_dtLoadTime As DateTime
Public ReadOnly Property sLoadTime As String
Get
Return m_dtLoadTime.ToString("yy/MM/dd HH:mm:ss")
End Get
End Property
Private m_dtMachining1Start As DateTime
Public ReadOnly Property sMachining1Start As String
Get
Return m_dtMachining1Start.ToString("yy/MM/dd HH:mm:ss")
End Get
End Property
Private m_dtMachining1End As DateTime
Public ReadOnly Property sMachining1End As String
Get
Return m_dtMachining1End.ToString("yy/MM/dd HH:mm:ss")
End Get
End Property
Private m_dtMachining2Start As DateTime
Public ReadOnly Property sMachining2Start As String
Get
Return m_dtMachining2Start.ToString("yy/MM/dd HH:mm:ss")
End Get
End Property
Private m_dtMachining2End As DateTime
Public ReadOnly Property sMachining2End As String
Get
Return m_dtMachining2End.ToString("yy/MM/dd HH:mm:ss")
End Get
End Property
Private m_dtUnloadTime As DateTime
Public ReadOnly Property sUnloadTime As String
Get
Return m_dtUnloadTime.ToString("yy/MM/dd HH:mm:ss")
End Get
End Property
Sub New(Id As Integer, IndiceCirc As Integer, Stato As Integer, CodicePorta As String, DescrizionePorta As String, NomeDDF As String, NomeCSV As String,
CN_macchina_1 As String, CN_macchina_2 As String, tempo_carico As Long, tempo_inizio_lav_1 As Long, tempo_fine_lav_1 As Long, tempo_inizio_lav_2 As Long,
tempo_fine_lav_2 As Long, tempo_scarico As Long)
m_nId = Id
m_nCircIndex = IndiceCirc
m_nState = Stato
m_sDoorCode = CodicePorta
m_sDoorDescription = DescrizionePorta
m_sDDFName = NomeDDF
m_sCSVName = NomeCSV
m_sM1CNPath = CN_macchina_1
m_sM2CNPath = CN_macchina_2
m_dtLoadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(tempo_carico).ToLocalTime()
m_dtMachining1Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(tempo_inizio_lav_1).ToLocalTime()
m_dtMachining1End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(tempo_fine_lav_1).ToLocalTime()
m_dtMachining2Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(tempo_inizio_lav_2).ToLocalTime()
m_dtMachining2End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(tempo_fine_lav_2).ToLocalTime()
m_dtUnloadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(tempo_scarico).ToLocalTime()
End Sub
Sub New(Door As Door)
m_nId = Door.nId
m_nCircIndex = 0
m_nState = 0
m_sDDFName = Door.sDDFName
m_sCSVName = Door.sCSVName
m_sM1CNPath = ""
m_sM2CNPath = ""
m_dtLoadTime = DateTime.MinValue
m_dtMachining1Start = DateTime.MinValue
m_dtMachining1End = DateTime.MinValue
m_dtMachining2Start = DateTime.MinValue
m_dtMachining2End = DateTime.MinValue
m_dtUnloadTime = DateTime.MinValue
End Sub
Friend Sub New(JsonLuaDoor As JsonLuaDoor)
m_nId = JsonLuaDoor.nId
m_nCircIndex = JsonLuaDoor.nCircIndex
m_nState = JsonLuaDoor.nState
m_sDDFName = JsonLuaDoor.sDDFName
m_sCSVName = JsonLuaDoor.sCSVName
m_sM1CNPath = JsonLuaDoor.sM1CNPath
m_sM2CNPath = JsonLuaDoor.sM2CNPath
m_dtLoadTime = JsonLuaDoor.dtLoadTime
m_dtMachining1Start = JsonLuaDoor.dtMachining1Start
m_dtMachining1End = JsonLuaDoor.dtMachining1End
m_dtMachining2Start = JsonLuaDoor.dtMachining2Start
m_dtMachining2End = JsonLuaDoor.dtMachining2End
m_dtUnloadTime = JsonLuaDoor.dtUnloadTime
End Sub
End Class
@@ -0,0 +1,12 @@
<UserControl x:Class="StatisticsPageV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
</Grid>
</UserControl>
@@ -0,0 +1,3 @@
Public Class StatisticsPageV
End Class
@@ -0,0 +1,3 @@
Public Class StatisticsPageVM
End Class
@@ -0,0 +1,69 @@
''' <summary>
''' 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'.
''' </summary>
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"
''' <summary>
''' Creates a new command that can always execute.
''' </summary>
''' <param name="execute">The execution logic.</param>
Public Sub New(ByVal execute As Action(Of Object))
Me.New(execute, Nothing)
End Sub
''' <summary>
''' Creates a new command.
''' </summary>
''' <param name="execute">The execution logic.</param>
''' <param name="canExecute">The execution status logic.</param>
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"
<DebuggerStepThrough> _
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
@@ -0,0 +1,110 @@
<ResourceDictionary x:Class="Dictionary"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
>
<!--
Assign a Key to every Panel ViewModel to use
it in xaml file(ProjectView.xaml).
-->
<local:FiveLakesUIVM x:Key="FiveLakesUIVM"/>
<local:MainMenuVM x:Key="MainMenuVM"/>
<local:DoorListPageVM x:Key="DoorListVM"/>
<local:MachinePageVM x:Key="MachinePageVM"/>
<local:StatisticsPageVM x:Key="StatisticsPageVM"/>
<!--Colori predefiniti-->
<SolidColorBrush x:Key="EgaltechBlue1" Color="#FF4D84C4" />
<SolidColorBrush x:Key="EgaltechBlue2" Color="#FF7096CE" />
<SolidColorBrush x:Key="EgaltechBlue3" Color="#FF90ABD9" />
<SolidColorBrush x:Key="EgaltechBlue4" Color="#FFB2C3E4" />
<SolidColorBrush x:Key="EgaltechWhite" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="EgaltechGray" Color="#FF585858" />
<SolidColorBrush x:Key="EgaltechLightGray" Color="LightGray" />
<SolidColorBrush x:Key="EgaltechUltralightGray" Color="#FFF2F2F2" />
<SolidColorBrush x:Key="EgaltechGreen" Color="#FF00FF00" />
<SolidColorBrush x:Key="Roller" Color="#FF585858" />
<SolidColorBrush x:Key="TableFrame" Color="LightGray" />
<SolidColorBrush x:Key="Structure" Color="#61b0ff" />
<SolidColorBrush x:Key="Bridge" Color="LightBlue" />
<SolidColorBrush x:Key="Shuttle" Color="DarkGray" />
<!--#92908d-->
<Color x:Key="Icarus_Gray_Color" R="146" G="144" B="141" A="255"/>
<SolidColorBrush x:Key="Icarus_Gray" Color="{StaticResource Icarus_Gray_Color}" />
<!--#3c89c9-->
<Color x:Key="Icarus_LightBlue_Color" R="60" G="137" B="201" A="255"/>
<SolidColorBrush x:Key="Icarus_LightBlue" Color="{StaticResource Icarus_LightBlue_Color}" />
<!--#2e5a81-->
<Color x:Key="Icarus_Blue_Color" R="46" G="90" B="129" A="255"/>
<SolidColorBrush x:Key="Icarus_Blue" Color="{StaticResource Icarus_Blue_Color}" />
<!--#50A388-->
<Color x:Key="Icarus_Green_Color" R="80" G="163" B="136" A="255"/>
<SolidColorBrush x:Key="Icarus_Green" Color="{StaticResource Icarus_Green_Color}" />
<!--#BC373E-->
<Color x:Key="Icarus_Orange_Color" R="188" G="55" B="62" A="255"/>
<SolidColorBrush x:Key="Icarus_Orange" Color="{StaticResource Icarus_Orange_Color}" />
<!--#A74C77-->
<Color x:Key="Icarus_Purple_Color" R="167" G="76" B="119" A="255"/>
<SolidColorBrush x:Key="Icarus_Purple" Color="{StaticResource Icarus_Purple_Color}" />
<!--Colori per EgtWPFLib5-->
<SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3"/>
<!--Risorsa che toglie le animazioni dai menù popup per evitare che i menù mru di scelta dei file rimangano aperti se il file è grosso -->
<!--o viene eseguito un lua che non aggiorna l'interfaccia-->
<PopupAnimation x:Key="{x:Static SystemParameters.MenuPopupAnimationKey}">None</PopupAnimation>
<!--convertert per visibilita' stringa di testo con misure in StatusBar--><!--
<PrintApp:StringToVisibilityConverter x:Key="StringToVisibilityConverter"/>-->
<GridLength x:Key="TitleBarHeight">30</GridLength>
<Thickness x:Key="WindowBorder_Thickness">2</Thickness>
<sys:Double x:Key="WindowBorder_Height">2</sys:Double>
<!--Stili per disegno macchina con porte-->
<Style x:Key="Table" TargetType="Border">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="2"/>
</Style>
<Style x:Key="Door" TargetType="Border">
<Setter Property="BorderBrush" Value="SaddleBrown"/>
<Setter Property="BorderThickness" Value="5"/>
<Setter Property="Background" Value="SandyBrown"/>
</Style>
<Style x:Key="CutOutScrap" TargetType="Border">
<Setter Property="Margin" Value="35,10,10,10"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="SandyBrown"/>
</Style>
<Style x:Key="Advancement_Button" TargetType="Button">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
</Style>
<Style x:Key="Sensor" TargetType="Ellipse">
<Setter Property="Height" Value="{Binding ActualWidth, RelativeSource={RelativeSource Self}}"/>
</Style>
<Style x:Key="MachDrawVar_TextBlock" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="MachDrawVar_CheckBox" TargetType="CheckBox">
<Setter Property="IsHitTestVisible" Value="False"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
<!--Border-->
<Style x:Key="Parameter_MachinePage_Border" TargetType="{x:Type GroupBox}">
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="DarkGray"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</ResourceDictionary>
@@ -0,0 +1,108 @@
Imports System.ComponentModel.Composition
Imports System.Globalization
Imports Effector.Plugin.Interface
<Export(GetType(IPluginControl))>
<ExportMetadata("Name", "Dictionary")>
Public Class Dictionary
Inherits ResourceDictionary
Implements IPluginControl
Public Shared ReadOnly MySceneHostVM As String = "MySceneHostVM"
#Region "Colors"
'Private m_Omag_Red As SolidColorBrush = Brushes.Red
'Public ReadOnly Property Omag_Red As SolidColorBrush
' Get
' Return m_Omag_Red
' End Get
'End Property
'Private Shared m_Button_Static_Background As SolidColorBrush = New BrushConverter().ConvertFrom("#FFDDDDDD")
'Public Shared ReadOnly Property Button_Static_Background As SolidColorBrush
' Get
' Return m_Button_Static_Background
' End Get
'End Property
'Private Shared m_TabControl_Header_Background As LinearGradientBrush = Application.Current.FindResource("TabItem.Static.Background")
'Public Shared ReadOnly Property TabControl_Header_Background As LinearGradientBrush
' Get
' Return m_TabControl_Header_Background
' End Get
'End Property
'Private Shared m_Icarus_Gray As SolidColorBrush = Application.Current.FindResource("Icarus_Gray")
'Public Shared ReadOnly Property Icarus_Gray As SolidColorBrush
' Get
' Return m_Icarus_Gray
' End Get
'End Property
'Private Shared m_Icarus_LightBlue As SolidColorBrush = Application.Current.FindResource("Icarus_LightBlue")
'Public Shared ReadOnly Property Icarus_LightBlue As SolidColorBrush
' Get
' Return m_Icarus_LightBlue
' End Get
'End Property
'Private Shared m_Icarus_Blue As SolidColorBrush = Application.Current.FindResource("Icarus_Blue")
'Public Shared ReadOnly Property Icarus_Blue As SolidColorBrush
' Get
' Return m_Icarus_Blue
' End Get
'End Property
'Private Shared m_Icarus_Green As SolidColorBrush = Application.Current.FindResource("Icarus_Green")
'Public Shared ReadOnly Property Icarus_Green As SolidColorBrush
' Get
' Return m_Icarus_Green
' End Get
'End Property
'Private Shared m_Icarus_Orange As SolidColorBrush = Application.Current.FindResource("Icarus_Orange")
'Public Shared ReadOnly Property Icarus_Orange As SolidColorBrush
' Get
' Return m_Icarus_Orange
' End Get
'End Property
'Private Shared m_Icarus_Purple As SolidColorBrush = Application.Current.FindResource("Icarus_Purple")
'Public Shared ReadOnly Property Icarus_Purple As SolidColorBrush
' Get
' Return m_Icarus_Purple
' End Get
'End Property
'<SolidColorBrush x : Key="Icarus_Gray" Color="#92908d" />
'<SolidColorBrush x : Key="Icarus_LightBlue" Color="#3c89c9" />
'<SolidColorBrush x : Key="Icarus_Blue" Color="#2e5a81" />
'<SolidColorBrush x : Key="Icarus_Green" Color="#40826d" />
'<SolidColorBrush x : Key="Icarus_Orange" Color="#C37636" />
'<SolidColorBrush x : Key="Icarus_Purple" Color="#990066" />
#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
@@ -0,0 +1,711 @@
Imports System.IO
Imports System.Threading
Imports MS.Internal
Imports Effector.Plugin.FiveLakes.ThreadData
Imports System.Windows.Threading
Public Class ExecProcessManager
Public Event m_AllArgsProcessed()
Public Enum ExecutionThreadStatuses As Integer
RUNNING = 1
STOPPED = 2
End Enum
Private Enum ProcessManagerStates
NULL = 0
OPEN = 1
CLOSE = 2
End Enum
Private m_ProcessManagerTimer As New DispatcherTimer
Private m_ProcessManagerState As ProcessManagerStates
Private m_ProcessManagerV As ProcessManagerV
Public ReadOnly Property ProcessManagerV As ProcessManagerV
Get
Return m_ProcessManagerV
End Get
End Property
' riferimento al thread principale
Private m_ExecutionThread As Thread
Private m_ExecutionThreadStatus As ExecutionThreadStatuses = ExecutionThreadStatuses.STOPPED
Public ReadOnly Property ExecutionThreadStatus As ExecutionThreadStatuses
Get
Return m_ExecutionThreadStatus
End Get
End Property
' array dei thread
Private m_ThreadList As Thread()
' array dei dati dei thread
Private m_ThreadDataList As ThreadData()
Friend ReadOnly Property ThreadDataList As ThreadData()
Get
Return m_ThreadDataList
End Get
End Property
' variabile che ferma i processi
Private m_bStopProcess As Boolean = False
' variabile che conferma chiusura dei processi
Private m_bExecutionThreadStoped As Boolean = False
' numero massimo di istanze del cam
Private m_MaxCamInstances As Integer = 1
' nome dell'eseguibile da lanciare
Private m_sProcessFileName As String = ""
' stringa di argomenti dell'eseguibile da lanciare
Private m_sProcessArguments As String = ""
' coda delle cose da eseguire
Private ArgumentsQueueLock As New Object
Private m_ArgumentsQueue As New Queue(Of ProcessArgs)
Public ReadOnly Property ArgumentsQueue As Queue(Of ProcessArgs)
Get
Return m_ArgumentsQueue
End Get
End Property
' coda dei risultati
Private ArgumentsResultQueueLock As New Object
Private m_ArgumentsResultQueue As New Queue(Of ProcessArgsResult)
Public ReadOnly Property ArgumentsResultQueue As Queue(Of ProcessArgsResult)
Get
Return m_ArgumentsResultQueue
End Get
End Property
' funzione che richiede prossimo elemento da processare
Private m_delGetNextProcessArgs As Func(Of ProcessArgs)
Public Sub SetGetNextProcessArgs(GetNextProcessArgs As Func(Of ProcessArgs))
m_delGetNextProcessArgs = GetNextProcessArgs
End Sub
' funzione di pre processing dell'elemento
Private m_delPreProcess As Func(Of ProcessArgs, ProcessArgs)
Public Sub SetPreProcess(PreProcess As Func(Of ProcessArgs, ProcessArgs))
m_delPreProcess = PreProcess
End Sub
' funzione di post processing dell'elemento
Private m_delPostProcess As Action(Of ProcessArgsResult)
Public Sub SetPostProcess(PostProcess As Action(Of ProcessArgsResult))
m_delPostProcess = PostProcess
End Sub
Sub New(sProcessFileName As String, sProcessArguments As String)
m_sProcessFileName = sProcessFileName
m_sProcessArguments = sProcessArguments
m_ProcessManagerTimer.Interval = New TimeSpan(0, 0, 1)
AddHandler m_ProcessManagerTimer.Tick, AddressOf ProcessManagerTimer_Tick
m_ProcessManagerTimer.Start()
End Sub
Private Sub ProcessManagerTimer_Tick(sender As Object, e As EventArgs)
Select Case m_ProcessManagerState
Case ProcessManagerStates.OPEN
' creo finestra statistiche processi
m_ProcessManagerV = New ProcessManagerV(Application.Current.MainWindow, New ProcessManagerVM(Me))
ProcessManagerV.Show()
m_ProcessManagerState = ProcessManagerStates.NULL
Case ProcessManagerStates.CLOSE
' chiudo finestra statistiche processi
If Not IsNothing(m_ProcessManagerV) Then
ProcessManagerV.Close()
m_ProcessManagerV = Nothing
End If
m_ProcessManagerState = ProcessManagerStates.NULL
End Select
End Sub
Public Function ArgumentsEnqueue(ProcessArgs As ProcessArgs) As Boolean
If ProcessArgs.nId <= 0 OrElse String.IsNullOrWhiteSpace(ProcessArgs.sArgs) Then Return False
SyncLock ArgumentsQueueLock
m_ArgumentsQueue.Enqueue(ProcessArgs)
End SyncLock
Return True
End Function
Public Function ArgumentsDequeue() As ProcessArgs
Dim DequeueProcessArgs As ProcessArgs = Nothing
SyncLock ArgumentsQueueLock
If m_ArgumentsQueue.Count > 0 Then
DequeueProcessArgs = m_ArgumentsQueue.Dequeue()
End If
End SyncLock
Return DequeueProcessArgs
End Function
Public Function ArgumentsQueueCount() As Integer
Dim nCount As Integer = 0
SyncLock ArgumentsQueueLock
nCount = m_ArgumentsQueue.Count
End SyncLock
Return nCount
End Function
Public Function ArgumentsResultEnqueue(ProcessArgsResult As ProcessArgsResult) As Boolean
SyncLock ArgumentsResultQueueLock
m_ArgumentsResultQueue.Enqueue(ProcessArgsResult)
End SyncLock
Return True
End Function
Public Function ArgumentsResultDequeue() As ProcessArgsResult
Dim DequeueProcessArgsResult As ProcessArgsResult = Nothing
SyncLock ArgumentsResultQueueLock
If m_ArgumentsResultQueue.Count > 0 Then
DequeueProcessArgsResult = m_ArgumentsResultQueue.Dequeue()
End If
End SyncLock
Return DequeueProcessArgsResult
End Function
Public Function ArgumentsResultQueueCount() As Integer
Dim nCount As Integer = 0
SyncLock ArgumentsResultQueueLock
nCount = m_ArgumentsResultQueue.Count
End SyncLock
Return nCount
End Function
Public Sub SetMaxCamInstances(nValue As Integer)
' Numero di core logici da utilizzare (minimo tra presenti sul PC e imposti da INI)
Dim nMaxThread As Integer = Math.Min(Environment.ProcessorCount, nValue)
m_MaxCamInstances = nMaxThread
End Sub
' funzione che avvia thread principale
Public Sub StartExecutionThread()
If m_ExecutionThreadStatus = ExecutionThreadStatuses.RUNNING Then Return
m_bStopProcess = False
m_bExecutionThreadStoped = False
m_ExecutionThread = New Thread(Sub()
ExecutionProcess()
End Sub)
m_ExecutionThread.SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
m_ExecutionThread.Start()
m_ExecutionThreadStatus = ExecutionThreadStatuses.RUNNING
' lancio apertura finestra statistiche processi
m_ProcessManagerState = ProcessManagerStates.OPEN
End Sub
Public Sub StopExecutionThread()
If m_ExecutionThreadStatus = ExecutionThreadStatuses.STOPPED Then Return
m_bStopProcess = True
While Not m_bExecutionThreadStoped
Thread.Sleep(100)
End While
If Not IsNothing(m_ExecutionThread) Then
m_ExecutionThread.Abort()
While Not m_ExecutionThread.ThreadState = ThreadState.Aborted
Thread.Sleep(100)
End While
m_ExecutionThread = Nothing
End If
m_ThreadList = Nothing
m_ExecutionThreadStatus = ExecutionThreadStatuses.STOPPED
' lancio chiusura finestra statistiche processi
m_ProcessManagerState = ProcessManagerStates.CLOSE
End Sub
' funzione di esecuzione del thread principale che gestice i processi
Private Sub ExecutionProcess()
Dim bStopMainProcess As Boolean = False
Dim nStartingProc As Integer = 0
While Not bStopMainProcess
bStopMainProcess = m_bStopProcess
' se processo fermato, fermo i thread
If bStopMainProcess Then
If Not IsNothing(m_ThreadList) AndAlso m_ThreadList.Count > 0 AndAlso Not IsNothing(m_ThreadList(0)) Then
' li fermo
m_bStopProcess = True
' verifico siano terminati
Dim bOneNotEnded As Boolean = True
While bOneNotEnded
bOneNotEnded = False
For Each Thread In m_ThreadList
If Not IsNothing(Thread) Then
If Thread.IsAlive Then
bOneNotEnded = True
End If
End If
Next
End While
' pulisco la lista
For ThreadIndex = 0 To m_ThreadList.Count - 1
m_ThreadList(ThreadIndex) = Nothing
Next
m_bStopProcess = False
End If
m_bExecutionThreadStoped = True
Return
End If
' se lista processi nulla o vuota, li faccio partire
If (IsNothing(m_ThreadList) OrElse m_ThreadList.Count = 0) Then
m_ThreadList = New Thread(m_MaxCamInstances - 1) {}
m_ThreadDataList = New ThreadData(m_MaxCamInstances - 1) {}
For nThreadIndex = 0 To m_MaxCamInstances - 1
Dim ThreadId As Integer = nThreadIndex
m_ThreadList(nThreadIndex) = New Thread(Sub()
ThreadFunction(ThreadId)
End Sub)
m_ThreadList(nThreadIndex).SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
m_ThreadList(nThreadIndex).Start()
Thread.Sleep(100)
Next
End If
' se qualche processo in stop, lo faccio ripartire
For ThreadIndex = 0 To m_ThreadList.Count - 1
If ThreadIndex < m_ThreadList.Count Then
Dim Thread = m_ThreadList(ThreadIndex)
If Not IsNothing(Thread) Then
If Thread.ThreadState = ThreadState.Stopped OrElse
Thread.ThreadState = ThreadState.Aborted OrElse
Thread.ThreadState = ThreadState.Suspended OrElse
(Not m_ThreadDataList(ThreadIndex).ProcessStatus = ProcessStatuses.TOBESTARTED AndAlso
(IsNothing(m_ThreadDataList(ThreadIndex).Process) OrElse
(Not IsNothing(m_ThreadDataList(ThreadIndex).Process) AndAlso m_ThreadDataList(ThreadIndex).Process.HasExited))) Then
' inserire un ritardo di rilancio?
' lo chiudo e rilancio
'Thread.Sleep(500)
Thread.Abort()
Thread.Sleep(100)
While Not Thread.ThreadState = ThreadState.Aborted
Thread.Sleep(100)
End While
Thread = Nothing
Dim ThreadId As Integer = ThreadIndex
m_ThreadList(ThreadIndex) = New Thread(Sub()
ThreadFunction(ThreadId)
End Sub)
m_ThreadList(ThreadIndex).SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
m_ThreadList(ThreadIndex).Start()
End If
Else
Dim ThreadId As Integer = ThreadIndex
If ThreadIndex < m_ThreadList.Count Then
m_ThreadList(ThreadIndex) = New Thread(Sub()
ThreadFunction(ThreadId)
End Sub)
m_ThreadList(ThreadIndex).SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
m_ThreadList(ThreadIndex).Start()
End If
End If
End If
Next
' verifico se coda vuota e tutti i processi hanno finito
Dim nQueueArgs As Integer = 0
SyncLock ArgumentsQueueLock
nQueueArgs = m_ArgumentsQueue.Count
End SyncLock
If nQueueArgs = 0 Then
Dim bProcessWaiting As Boolean = False
For Each ThreadData In m_ThreadDataList
If ThreadData.ProcessStatus = ProcessStatuses.WAITINGANSWER OrElse ThreadData.ProcessStatus = ProcessStatuses.ANSWERRECEIVED Then
bProcessWaiting = True
Exit For
End If
Next
If Not bProcessWaiting Then
' creo thread per lanciare evento asincrono di fine calcolo
Dim AllArgsProcessedThread = New Thread(Sub()
RaiseEvent m_AllArgsProcessed()
End Sub)
AllArgsProcessedThread.SetApartmentState(ApartmentState.STA)
AllArgsProcessedThread.Start()
End If
End If
Thread.Sleep(1000)
End While
End Sub
' funzione di esecuzione del singolo processo che comunica con il programma
Private Sub ThreadFunction(ThreadIndex As Integer)
Dim MyThreadData As New ThreadData
m_ThreadDataList(ThreadIndex) = MyThreadData
'Dim CurrThreadStat As New ThreadStat(ThreadIndex, DateTime.Now)
'HistoryThreadDataList.Add(CurrThreadStat)
'MyThreadData.SetThreadStat(CurrThreadStat)
'Dim sDrive As String = "c" ' If(ThreadIndex Mod 2 = 0, "A", "B")
'Dim sCurrDdfDir As String = sDrive & ":\EgtData\WebDoor\Ddf"
'Dim stopWatch As New Stopwatch()
'Dim lExeTime As Long = 0
'Dim lOtherTime As Long = 0
' avvio processo
Dim Proc As Process = New Process()
Proc.StartInfo.FileName = m_sProcessFileName
Proc.StartInfo.RedirectStandardInput = True
Proc.StartInfo.RedirectStandardOutput = True
Proc.StartInfo.Arguments = ThreadIndex.ToString() & " " & m_sProcessArguments
Proc.StartInfo.UseShellExecute = False
Proc.StartInfo.CreateNoWindow = True
AddHandler Proc.OutputDataReceived, AddressOf Thread_OutputDataReceived
If Proc.Start() Then
'Dim CurrPocStat As New ProcStat(DateTime.Now)
'CurrThreadStat.ProcExecutionList.Add(CurrPocStat)
Proc.BeginOutputReadLine()
MyThreadData.SetProcess(Proc)
MyThreadData.SetProcessStatus(ProcessStatuses.NULL)
'Dim nProc0Wait As Integer = 0
' ciclo per leggere coda ed eseguire
While Not m_bStopProcess AndAlso Not Proc.HasExited
Select Case MyThreadData.ProcessStatus
Case ThreadData.ProcessStatuses.NULL
'MyThreadData.SetThreadOperation(ThreadOperations.WaitingData)
' se c'e' qualcosa da processare
'Dim nNumTaskToProcess As Integer = 0
'If ThreadIndex = 0 Then
' nNumTaskToProcess = currWDC.numTask2proc
' If nNumTaskToProcess > 0 Then
' If Not m_bCheckOrder Then m_bCheckOrder = True
' Else
' If m_bCheckOrder Then m_bCheckOrder = False
' Thread.Sleep(100)
' End If
'ElseIf m_bCheckOrder Then
' nNumTaskToProcess = currWDC.numTask2proc
' If nNumTaskToProcess = 0 Then
' m_bCheckOrder = False
' End If
'End If
Dim NextProcessArgs As ProcessArgs = Nothing
If Not IsNothing(m_delGetNextProcessArgs) Then
NextProcessArgs = m_delGetNextProcessArgs()
Else
NextProcessArgs = ArgumentsDequeue()
End If
If Not IsNothing(NextProcessArgs) AndAlso NextProcessArgs.nId > 0 AndAlso Not String.IsNullOrWhiteSpace(NextProcessArgs.sArgs) Then
If Not IsNothing(m_delPreProcess) Then
NextProcessArgs = m_delPreProcess(NextProcessArgs)
End If
MyThreadData.SetCurrRequest(NextProcessArgs)
Proc.StandardInput.WriteLine(ThreadIndex & "," & NextProcessArgs.sArgs)
MyThreadData.SetProcessStatus(ThreadData.ProcessStatuses.WAITINGANSWER)
End If
'If m_bCheckOrder Then
' Dim LastRequest As Dictionary(Of String, CalcReqtDTO) = currWDC.queueList(1)
' If LastRequest.Count > 0 Then
' MyThreadData.SetThreadOperation(ThreadOperations.FoundRequest)
' Dim ConvItem As KeyValuePair(Of String, String)
' ConvItem = New KeyValuePair(Of String, String)(LastRequest.First().Key, LastRequest.First().Value.DDF)
' MyThreadData.SetCurrRequest(ConvItem)
' ' vecchia versione
' 'MyThreadData.SetCurrRequest(LastRequest.First())
' Dim Item As KeyValuePair(Of String, String) = MyThreadData.CurrRequest
' Dim bOk As Boolean = Not IsNothing(Item)
' If bOk Then
' ' avvio cronometro
' 'stopWatch.Reset()
' stopWatch.Restart()
' ' svuoto vecchio set file della porta richiesta
' Dim fileList As String() = Directory.GetFiles(sCurrDdfDir, Item.Key + ".*")
' ' elimino vecchi
' If Not IsNothing(fileList) Then
' For Each sFile In fileList
' Try
' File.Delete(sFile)
' Catch ex As Exception
' End Try
' Next
' End If
' ' scrivo ddf
' MyThreadData.SetThreadOperation(ThreadOperations.WritingDdf)
' MyThreadData.SetDdfPath(sCurrDdfDir & "\" & Item.Key & ".ddf")
' Dim sDdfPath As String = MyThreadData.sDdfPath
' Try
' File.WriteAllText(sDdfPath, Item.Value)
' Catch ex As Exception
' bOk = False
' End Try
' If bOk Then
' MyThreadData.SetThreadOperation(ThreadOperations.ProcessingDdf)
' Proc.StandardInput.WriteLine(ThreadIndex & "," & sDdfPath)
' MyThreadData.SetWaitProcAnswer(ThreadData.ProcComm.WaitingAnswer)
' End If
' End If
' Else
' Thread.Sleep(100)
' End If
'Else
' Thread.Sleep(100)
'End If
Case ThreadData.ProcessStatuses.WAITINGANSWER
Thread.Sleep(10)
Case ThreadData.ProcessStatuses.ANSWERRECEIVED
Dim NewProcessArgsResult As New ProcessArgsResult(MyThreadData.CurrRequest, MyThreadData.nProcResult)
If Not IsNothing(m_delPostProcess) Then
m_delPostProcess(NewProcessArgsResult)
End If
ArgumentsResultEnqueue(NewProcessArgsResult)
'Dim Item As ProcessArgs = MyThreadData.CurrRequest
'Dim sDdfPath As String = MyThreadData.sDdfPath
'Dim bOk As Boolean = True
'' salvo exe time...
'stopWatch.Stop()
'lExeTime = stopWatch.ElapsedMilliseconds
'stopWatch.Restart()
'Dim procResults As New List(Of CalcResultDTO)
'Dim currRes As New CalcResultDTO
'Dim fContent As String = ""
'MyThreadData.SetThreadOperation(ThreadOperations.ReadingSvg)
'' verifico esistenza file svg e lo carico
'bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "svg"), fContent)
'' !!! ToDo: inserire TIPO di richiesta secondo quanto ricevuto....
'' invio risposta
'currRes.Validated = MyThreadData.nProcResult = 0 AndAlso bOk
'currRes.DoorIdVers = Item.Key
'' per ora cablato a svg, prendere da MimeType richiesta...
'currRes.MimeType = "svg"
'' se NON fosse validato --> messo il messaggio...
'If (currRes.Validated) Then
' currRes.RawContent = fContent
'Else
' bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "txt"), fContent)
' currRes.ErrorMsg = fContent
'End If
'MyThreadData.SetThreadOperation(ThreadOperations.SendResult)
'procResults.Add(currRes)
'Dim respPut As String = currWDC.SendProcResults(procResults)
'stopWatch.Stop()
'lOtherTime = stopWatch.ElapsedMilliseconds
'CurrPocStat.IncrementDoneRequest()
'' aggiorno thread display...
'UpdateThreadList(Item.Key, lExeTime, lOtherTime)
'' cambio nomi file generati in old
'Dim OldSvg As String = Path.ChangeExtension(sDdfPath, "svg")
'Dim NewSvg As String = Path.GetDirectoryName(sDdfPath) & "\" & Path.GetFileNameWithoutExtension(sDdfPath) & "_old.svg"
'Try
' File.Delete(NewSvg)
'Catch ex As Exception
'End Try
'Try
' File.Delete(Path.ChangeExtension(NewSvg, "txt"))
'Catch ex As Exception
'End Try
'Try
' File.Delete(Path.ChangeExtension(NewSvg, "log"))
'Catch ex As Exception
'End Try
'Try
' File.Delete(Path.ChangeExtension(NewSvg, "nge"))
'Catch ex As Exception
'End Try
'Try
' File.Delete(Path.ChangeExtension(NewSvg, "ddf"))
'Catch ex As Exception
'End Try
'Try
' File.Move(OldSvg, NewSvg)
'Catch ex As Exception
'End Try
'Try
' File.Move(Path.ChangeExtension(OldSvg, "txt"), Path.ChangeExtension(NewSvg, "txt"))
'Catch ex As Exception
'End Try
'Try
' File.Move(Path.ChangeExtension(OldSvg, "log"), Path.ChangeExtension(NewSvg, "log"))
'Catch ex As Exception
'End Try
'Try
' File.Move(Path.ChangeExtension(OldSvg, "nge"), Path.ChangeExtension(NewSvg, "nge"))
'Catch ex As Exception
'End Try
'Try
' File.Move(Path.ChangeExtension(OldSvg, "ddf"), Path.ChangeExtension(NewSvg, "ddf"))
'Catch ex As Exception
'End Try
MyThreadData.SetProcessStatus(ThreadData.ProcessStatuses.NULL)
End Select
End While
' CurrPocStat.SetStopProc(DateTime.Now)
If m_bStopProcess Then
Proc.StandardInput.WriteLine("quit")
End If
End If
' CurrThreadStat.SetStopThread(DateTime.Now)
MyThreadData.SetProcess(Nothing)
' MyThreadData.SetThreadOperation(ThreadOperations.Closed)
End Sub
Private Sub Thread_OutputDataReceived(sender As Object, e As DataReceivedEventArgs)
Dim sResult As String = e.Data
If Not String.IsNullOrWhiteSpace(sResult) AndAlso sResult.StartsWith("#42315#,") Then
Dim Results() As String = sResult.Split(","c)
If Results.Count >= 2 Then
Dim nIndex As Integer = -1
Dim nResult As Integer = -1
Dim dResult As Integer = -1
If Integer.TryParse(Results(1), nIndex) AndAlso nIndex >= 0 Then
If Integer.TryParse(Results(2), nResult) AndAlso nResult >= 0 Then
m_ThreadDataList(nIndex).SetProcResult(nResult)
ElseIf StringToDouble(Results(2), dResult) AndAlso dResult >= 0 Then
nResult = Math.Floor(dResult)
m_ThreadDataList(nIndex).SetProcResult(nResult)
End If
m_ThreadDataList(nIndex).SetProcessStatus(ThreadData.ProcessStatuses.ANSWERRECEIVED)
End If
End If
End If
End Sub
End Class
Public Class ThreadData
'Enum ThreadOperations As Integer
' WaitingData = 1
' FoundRequest = 2
' WritingDdf = 3
' ProcessingDdf = 4
' ReadingSvg = 5
' SendResult = 6
' Closed = 10
'End Enum
Public Enum ProcessStatuses As Integer
NULL = 0
WAITINGANSWER = 1
ANSWERRECEIVED = 2
TOBESTARTED = 10
End Enum
Private m_ProcessStatus As ProcessStatuses = ProcessStatuses.TOBESTARTED
Public ReadOnly Property ProcessStatus As ProcessStatuses
Get
Return m_ProcessStatus
End Get
End Property
Friend Sub SetProcessStatus(value As ProcessStatuses)
m_ProcessStatus = value
End Sub
Private m_CurrRequest As ProcessArgs
Public ReadOnly Property CurrRequest As ProcessArgs
Get
Return m_CurrRequest
End Get
End Property
Friend Sub SetCurrRequest(value As ProcessArgs)
m_CurrRequest = value
End Sub
'Private m_sDdfPath As String
'Public ReadOnly Property sDdfPath As String
' Get
' Return m_sDdfPath
' End Get
'End Property
'Friend Sub SetDdfPath(value As String)
' m_sDdfPath = value
'End Sub
Private m_nProcResult As Integer
Public ReadOnly Property nProcResult As Integer
Get
Return m_nProcResult
End Get
End Property
Friend Sub SetProcResult(value As Integer)
m_nProcResult = value
End Sub
'Private m_ThreadOperation As ThreadOperations
'Public ReadOnly Property ThreadOperation As ThreadOperations
' Get
' Return m_ThreadOperation
' End Get
'End Property
'Friend Sub SetThreadOperation(value As ThreadOperations)
' m_ThreadOperation = value
'End Sub
Private m_Process As Process
Public ReadOnly Property Process As Process
Get
Return m_Process
End Get
End Property
Friend Sub SetProcess(value As Process)
m_Process = value
End Sub
'Private m_ThreadStat As ThreadStat
'Public ReadOnly Property ThreadStat As ThreadStat
' Get
' Return m_ThreadStat
' End Get
'End Property
'Friend Sub SetThreadStat(value As ThreadStat)
' m_ThreadStat = value
'End Sub
End Class
Public Class ProcessArgs
Private m_nId As Integer
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Private m_sArgs As String
Public ReadOnly Property sArgs As String
Get
Return m_sArgs
End Get
End Property
Sub New(nId As Integer, sArgs As String)
m_nId = nId
m_sArgs = sArgs
End Sub
End Class
Public Class ProcessArgsResult
Private m_ProcessArgs As ProcessArgs
Public ReadOnly Property ProcessArgs As ProcessArgs
Get
Return m_ProcessArgs
End Get
End Property
Private m_nResult As Integer
Public ReadOnly Property nResult As Integer
Get
Return m_nResult
End Get
End Property
Public Sub SetResult(nResult As Integer)
m_nResult = nResult
End Sub
Sub New(ProcessArgs As ProcessArgs, nResult As Integer)
m_ProcessArgs = ProcessArgs
m_nResult = nResult
End Sub
End Class
@@ -0,0 +1,76 @@
Imports System.Globalization
Imports System.Runtime.InteropServices
Imports System.Text
Public Module GenInterface
'-------------------------------- IniFile : Get --------------------------------------------------
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
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
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
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 ------------------------------------------------
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
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
<DllImport("user32.dll")>
Public Function ShowWindow(hWnd As IntPtr, nCmdShow As Integer) As Boolean
End Function
End Module
@@ -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
@@ -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
@@ -0,0 +1,401 @@
Imports System.Globalization
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Converters
Imports Effector.Plugin.FiveLakes.Door
Public Class JsonDoor
Private m_nListIndex As Integer
Public ReadOnly Property nListIndex As Integer
Get
Return m_nListIndex
End Get
End Property
Private m_nId As Integer
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Private m_nCSVLine As Integer
Public ReadOnly Property nCSVLine As Integer
Get
Return m_nCSVLine
End Get
End Property
Private m_sDDFName As String
Public ReadOnly Property sDDFName As String
Get
Return m_sDDFName
End Get
End Property
Private m_nQuantity As Integer
Public ReadOnly Property nQuantity As Integer
Get
Return m_nQuantity
End Get
End Property
Private m_dWidth As Double
Public ReadOnly Property dWidth As Double
Get
Return m_dWidth
End Get
End Property
Private m_dHeight As Double
Public ReadOnly Property dHeight As Double
Get
Return m_dHeight
End Get
End Property
Private m_dThickness As Double
Public ReadOnly Property dThickness As Double
Get
Return m_dThickness
End Get
End Property
Private m_sCSVName As String
Public ReadOnly Property sCSVName As String
Get
Return m_sCSVName
End Get
End Property
Private m_CustomerParameters As New List(Of CustomerParameter)
Public ReadOnly Property CustomerParameters As List(Of CustomerParameter)
Get
Return m_CustomerParameters
End Get
End Property
Private m_nState As DoorStates = DoorStates.LOADED_FROM_CSV
<JsonProperty>
<JsonConverter(GetType(StringEnumConverter))>
Public ReadOnly Property nState As DoorStates
Get
Return m_nState
End Get
End Property
#Region "Statistics"
Private m_nProdState As DoorProdStates = DoorProdStates.NOT_INIT
<JsonProperty>
<JsonConverter(GetType(StringEnumConverter))>
Public ReadOnly Property nProdState As DoorProdStates
Get
Return m_nProdState
End Get
End Property
Private m_dtLoadTime As DateTime = DateTime.MinValue
Public ReadOnly Property dtLoadTime As DateTime
Get
Return m_dtLoadTime
End Get
End Property
Private m_dtMachining1Start As DateTime = DateTime.MinValue
Public ReadOnly Property dtMachining1Start As DateTime
Get
Return m_dtMachining1Start
End Get
End Property
Private m_dtMachining1End As DateTime = DateTime.MinValue
Public ReadOnly Property dtMachining1End As DateTime
Get
Return m_dtMachining1End
End Get
End Property
Private m_dtMachining2Start As DateTime = DateTime.MinValue
Public ReadOnly Property dtMachining2Start As DateTime
Get
Return m_dtMachining2Start
End Get
End Property
Private m_dtMachining2End As DateTime = DateTime.MinValue
Public ReadOnly Property dtMachining2End As DateTime
Get
Return m_dtMachining2End
End Get
End Property
Private m_dtUnloadTime As DateTime = DateTime.MinValue
Public ReadOnly Property dtUnloadTime As DateTime
Get
Return m_dtUnloadTime
End Get
End Property
#End Region ' Statistics
<JsonConstructor>
Sub New(nListIndex As Integer, nId As Integer, nCSVLine As Integer, sDDFName As String, sCSVName As String, nQuantity As Integer, dWidth As Double, dHeight As Double, dThickness As Double, nState As DoorStates, CustomerParameters As List(Of CustomerParameter),
nProdState As DoorProdStates, dtLoadTime As DateTime, dtMachining1Start As DateTime, dtMachining1End As DateTime, dtMachining2Start As DateTime, dtMachining2End As DateTime, dtUnloadTime As DateTime)
m_nListIndex = nListIndex
m_nId = nId
m_nCSVLine = nCSVLine
m_sDDFName = sDDFName
m_sCSVName = sCSVName
m_nQuantity = nQuantity
m_dHeight = dHeight
m_dWidth = dWidth
m_dThickness = dThickness
m_nState = nState
m_CustomerParameters = CustomerParameters
m_nProdState = nProdState
m_dtLoadTime = dtLoadTime
m_dtMachining1Start = dtMachining1Start
m_dtMachining1End = dtMachining1End
m_dtMachining2Start = dtMachining2Start
m_dtMachining2End = dtMachining2End
m_dtUnloadTime = dtUnloadTime
End Sub
Sub New(nListIndex As Integer, Door As Door)
m_nListIndex = nListIndex
m_nId = Door.nId
m_nCSVLine = Door.nCSVLine
m_sDDFName = Door.sDDFName
m_sCSVName = Door.sCSVName
m_nQuantity = Door.nQuantity
m_dHeight = Door.dHeight
m_dWidth = Door.dWidth
m_dThickness = Door.dThickness
m_nState = Door.nState
m_CustomerParameters = Door.CustomerParameters
m_nProdState = Door.nProdState
m_dtLoadTime = Door.dtLoadTime
m_dtMachining1Start = Door.dtMachining1Start
m_dtMachining1End = Door.dtMachining1End
m_dtMachining2Start = Door.dtMachining2Start
m_dtMachining2End = Door.dtMachining2End
m_dtUnloadTime = Door.dtUnloadTime
End Sub
End Class
Public Class JsonLuaDoor
Inherits VMBase
Private m_nId As Integer = -1
Public ReadOnly Property nId As Integer
Get
Return m_nId
End Get
End Property
Private m_nCircIndex As Integer = -1
Public ReadOnly Property nCircIndex As Integer
Get
Return m_nCircIndex
End Get
End Property
Private m_nState As Integer = 0
Public ReadOnly Property nState As Integer
Get
Return m_nState
End Get
End Property
Private m_DoorStateList As New List(Of IdNameStruct)({New IdNameStruct(0, "Not On Machine"),
New IdNameStruct(1, "Imported"),
New IdNameStruct(2, "On Load"),
New IdNameStruct(3, "On Machine 1"),
New IdNameStruct(4, "On Medium Station"),
New IdNameStruct(6, "On Machine 2"),
New IdNameStruct(7, "On Unload"),
New IdNameStruct(8, "Produced"),
New IdNameStruct(100, "Scrap")})
Public ReadOnly Property DoorStateList As List(Of IdNameStruct)
Get
Return m_DoorStateList
End Get
End Property
Private m_SelDoorState As IdNameStruct
Public Property SelDoorState As IdNameStruct
Get
Return m_SelDoorState
End Get
Set(value As IdNameStruct)
m_SelDoorState = value
End Set
End Property
Private m_sDoorCode As String = ""
Public ReadOnly Property sDoorCode As String
Get
Return m_sDoorCode
End Get
End Property
Private m_sDoorDescription As String = ""
Public ReadOnly Property sDoorDescription As String
Get
Return m_sDoorDescription
End Get
End Property
Private m_sDDFName As String = ""
Public ReadOnly Property sDDFName As String
Get
Return m_sDDFName
End Get
End Property
Private m_sCSVName As String = ""
Public ReadOnly Property sCSVName As String
Get
Return m_sCSVName
End Get
End Property
Private m_sM1CNPath As String = ""
Public ReadOnly Property sM1CNPath As String
Get
Return m_sM1CNPath
End Get
End Property
Private m_sM2CNPath As String = ""
Public ReadOnly Property sM2CNPath As String
Get
Return m_sM2CNPath
End Get
End Property
Private m_dtLoadTime As DateTime
Public ReadOnly Property sLoadTime As String
Get
Return m_dtLoadTime.ToString("yy/MM/dd HH:mm:ss")
End Get
End Property
Public ReadOnly Property dtLoadTime As DateTime
Get
Return m_dtLoadTime
End Get
End Property
Private m_dtMachining1Start As DateTime
Public ReadOnly Property sMachining1Start As String
Get
Return m_dtMachining1Start.ToString("yy/MM/dd HH:mm:ss")
End Get
End Property
Public ReadOnly Property dtMachining1Start As DateTime
Get
Return m_dtMachining1Start
End Get
End Property
Private m_dtMachining1End As DateTime
Public ReadOnly Property sMachining1End As String
Get
Return m_dtMachining1End.ToString("yy/MM/dd HH:mm:ss")
End Get
End Property
Public ReadOnly Property dtMachining1End As DateTime
Get
Return m_dtMachining1End
End Get
End Property
Private m_dtMachining2Start As DateTime
Public ReadOnly Property sMachining2Start As String
Get
Return m_dtMachining2Start.ToString("yy/MM/dd HH:mm:ss")
End Get
End Property
Public ReadOnly Property dtMachining2Start As DateTime
Get
Return m_dtMachining2Start
End Get
End Property
Private m_dtMachining2End As DateTime
Public ReadOnly Property sMachining2End As String
Get
Return m_dtMachining2End.ToString("yy/MM/dd HH:mm:ss")
End Get
End Property
Public ReadOnly Property dtMachining2End As DateTime
Get
Return m_dtMachining2End
End Get
End Property
Private m_dtUnloadTime As DateTime
Public ReadOnly Property sUnloadTime As String
Get
Return m_dtUnloadTime.ToString("yy/MM/dd HH:mm:ss")
End Get
End Property
Public ReadOnly Property dtUnloadTime As DateTime
Get
Return m_dtUnloadTime
End Get
End Property
<JsonConstructor>
Sub New(nId As Integer, nCircIndex As Integer, nState As Integer, sDoorCode As String, sDoorDescription As String, sDDFName As String, sCSVName As String,
sM1CNPath As String, sM2CNPath As String, nLoadTime As Long, nMachining1Start As Long, nMachining1End As Long, nMachining2Start As Long,
nMachining2End As Long, nUnloadTime As Long)
m_nId = nId
m_nCircIndex = nCircIndex
m_nState = nState
m_sDoorCode = sDoorCode
m_sDoorDescription = sDoorDescription
m_sDDFName = sDDFName
m_sCSVName = sCSVName
m_sM1CNPath = sM1CNPath
m_sM2CNPath = sM2CNPath
m_dtLoadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nLoadTime).ToLocalTime()
m_dtMachining1Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nMachining1Start).ToLocalTime()
m_dtMachining1End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nMachining1End).ToLocalTime()
m_dtMachining2Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nMachining2Start).ToLocalTime()
m_dtMachining2End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nMachining2End).ToLocalTime()
m_dtUnloadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nUnloadTime).ToLocalTime()
End Sub
Sub New(Door As Door)
m_nId = Door.nId
m_nCircIndex = 0
m_nState = 0
m_sDDFName = Door.sDDFName
m_sCSVName = Door.sCSVName
m_sM1CNPath = ""
m_sM2CNPath = ""
m_dtLoadTime = DateTime.MinValue
m_dtMachining1Start = DateTime.MinValue
m_dtMachining1End = DateTime.MinValue
m_dtMachining2Start = DateTime.MinValue
m_dtMachining2End = DateTime.MinValue
m_dtUnloadTime = DateTime.MinValue
End Sub
Friend Sub Update(JsonLuaDoor As JsonLuaDoor)
m_nCircIndex = JsonLuaDoor.m_nCircIndex
m_nState = JsonLuaDoor.m_nState
m_sM1CNPath = JsonLuaDoor.m_sM1CNPath
m_sM2CNPath = JsonLuaDoor.m_sM2CNPath
m_dtLoadTime = JsonLuaDoor.m_dtLoadTime
m_dtMachining1Start = JsonLuaDoor.m_dtMachining1Start
m_dtMachining1End = JsonLuaDoor.m_dtMachining1End
m_dtMachining2Start = JsonLuaDoor.m_dtMachining2Start
m_dtMachining2End = JsonLuaDoor.m_dtMachining2End
m_dtUnloadTime = JsonLuaDoor.m_dtUnloadTime
End Sub
End Class
+473
View File
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="KeraLua" version="1.4.1" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
</packages>
+3
View File
@@ -0,0 +1,3 @@
param([string]$ProjectDir, [string]$ProjectPath);
Copy-Item -Path c:\EgtProg\Effector\Effector*.exe $ProjectDir\..\Exe
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.