|
|
|
@@ -5,6 +5,7 @@ Imports System.IO
|
|
|
|
|
Imports EgtUILib
|
|
|
|
|
Imports EgtWPFLib5
|
|
|
|
|
Imports EgtPHOTOLib
|
|
|
|
|
Imports System.Windows.Forms.Integration
|
|
|
|
|
|
|
|
|
|
Public Class MainWindowM
|
|
|
|
|
|
|
|
|
@@ -14,6 +15,12 @@ Public Class MainWindowM
|
|
|
|
|
Private m_TimerIsBusy As Boolean = False
|
|
|
|
|
Private m_RefreshTimer As New DispatcherTimer
|
|
|
|
|
|
|
|
|
|
' Per lettura modifica direttorio
|
|
|
|
|
Private fsWatch As FileSystemWatcher
|
|
|
|
|
Private m_RefreshNewFileClick As New DispatcherTimer
|
|
|
|
|
Private m_bNewFileClick As Boolean = False
|
|
|
|
|
Private m_sNewFileClickPath As String = String.Empty
|
|
|
|
|
|
|
|
|
|
Private m_sDataRoot As String = String.Empty
|
|
|
|
|
Friend ReadOnly Property sDataRoot As String
|
|
|
|
|
Get
|
|
|
|
@@ -199,11 +206,11 @@ Public Class MainWindowM
|
|
|
|
|
Dim sKey As String = String.Empty
|
|
|
|
|
EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
|
|
|
|
|
EgtSetKey(sKey)
|
|
|
|
|
Dim bNetHwKey As Boolean = ( GetMainPrivateProfileInt(S_GENERAL, K_NETKEY, 0) = 1)
|
|
|
|
|
EgtSetNetHwKey( bNetHwKey)
|
|
|
|
|
Dim bNetHwKey As Boolean = (GetMainPrivateProfileInt(S_GENERAL, K_NETKEY, 0) = 1)
|
|
|
|
|
EgtSetNetHwKey(bNetHwKey)
|
|
|
|
|
' Recupero livello e opzioni della chiave
|
|
|
|
|
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2502, 1, m_nKeyLevel) And
|
|
|
|
|
EgtGetKeyOptions(9423, 2502, 1, m_nKeyOptions)
|
|
|
|
|
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2508, 1, m_nKeyLevel) And
|
|
|
|
|
EgtGetKeyOptions(9423, 2508, 1, m_nKeyOptions)
|
|
|
|
|
' Verifico abilitazione prodotto
|
|
|
|
|
Dim bProd As Boolean = GetKeyOption(KEY_OPT.PHOTO_BASE)
|
|
|
|
|
' Inizializzazione generale di EgtInterface
|
|
|
|
@@ -301,6 +308,82 @@ Public Class MainWindowM
|
|
|
|
|
AddHandler m_RefreshTimer.Tick, AddressOf RefreshTimer_Tick
|
|
|
|
|
m_RefreshTimer.Interval = TimeSpan.FromMilliseconds(2000)
|
|
|
|
|
m_RefreshTimer.Start()
|
|
|
|
|
' sec onfigurato lancio il controllo di uno specifico direttorio per leggere quando scattare una nuova foto
|
|
|
|
|
Dim sClidkDir As String = String.Empty
|
|
|
|
|
Dim bEnableLineProduction As Boolean = GetMainPrivateProfileString(S_AUTOCLICK, K_CLICKDIR, "", sClidkDir) <> 0
|
|
|
|
|
If bEnableLineProduction Then
|
|
|
|
|
fsWatch = New FileSystemWatcher(sClidkDir) With {.EnableRaisingEvents = True}
|
|
|
|
|
'fsWatch.EnableRaisingEvents = True
|
|
|
|
|
AddHandler fsWatch.Created, AddressOf AutoClick
|
|
|
|
|
AddHandler fsWatch.Changed, AddressOf AutoClick
|
|
|
|
|
AddHandler fsWatch.Renamed, AddressOf AutoClick
|
|
|
|
|
m_bNewFileClick = False
|
|
|
|
|
AddHandler m_RefreshNewFileClick.Tick, AddressOf AutoClick_Cmd
|
|
|
|
|
m_RefreshNewFileClick.Interval = TimeSpan.FromMilliseconds(2000)
|
|
|
|
|
m_RefreshNewFileClick.Start()
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub AutoClick(ByVal sender As Object, ByVal e As FileSystemEventArgs)
|
|
|
|
|
EgtOutLog("File '" & e.FullPath & "' has been created: ready to Click")
|
|
|
|
|
m_sNewFileClickPath = e.FullPath
|
|
|
|
|
m_bNewFileClick = True
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub AutoClick_Cmd()
|
|
|
|
|
If Not m_bNewFileClick Then Return
|
|
|
|
|
' deseleziono la precedente lastra
|
|
|
|
|
If Not IsNothing(EgtPHOTOLib.PhotoMap.refProjectVM.SelSlab) Then
|
|
|
|
|
EgtPHOTOLib.PhotoMap.refProjectVM.SelSlab.IsSelected = 0
|
|
|
|
|
End If
|
|
|
|
|
' verifico se esite una lastra corrente in modifica, quindi chiedo se salvare
|
|
|
|
|
Map.refTopCommandBarVM.NewCmd(True)
|
|
|
|
|
' apro la pagina per inserire una nuova lastra, se esiste un oggetto di tipo lastra allora procedo
|
|
|
|
|
If Not IsNothing(EgtPHOTOLib.PhotoMap.refProjectVM.SelSlab) Then
|
|
|
|
|
' Autocompilazione dei campi con i dati dell'ultima lastra salvata
|
|
|
|
|
ReadLastInfoAutoClick(EgtPHOTOLib.PhotoMap.refProjectVM.SelSlab)
|
|
|
|
|
' scatto la foto
|
|
|
|
|
EgtPHOTOLib.PhotoMap.refOptionPanelVM.Photo(Nothing)
|
|
|
|
|
' notifico che è stata scattata una foto
|
|
|
|
|
Try
|
|
|
|
|
File.Delete(m_sNewFileClickPath)
|
|
|
|
|
EgtOutLog("File '" & m_sNewFileClickPath & "' has been deleted!")
|
|
|
|
|
m_bNewFileClick = False
|
|
|
|
|
Catch ex As Exception
|
|
|
|
|
EgtOutLog("File '" & m_sNewFileClickPath & "' can't be deleted! " & ex.ToString)
|
|
|
|
|
|
|
|
|
|
End Try
|
|
|
|
|
' se è stata scattata una foto provvedo a salvare l'inserimento
|
|
|
|
|
If Not m_bNewFileClick Then
|
|
|
|
|
' salvo i dati inseriti ( nel file ini e nel DB )
|
|
|
|
|
EgtPHOTOLib.PhotoMap.refOptionPanelVM.Save()
|
|
|
|
|
' ricarico la pagina
|
|
|
|
|
EgtPHOTOLib.PhotoMap.refProjectVM.SelProjectMode = ProjectSlabVM.ProjectModeOpt.DETAIL
|
|
|
|
|
EgtPHOTOLib.PhotoMap.refOptionPanelVM.Ok_IsEnabled = False
|
|
|
|
|
' stampo etichetta
|
|
|
|
|
EgtPHOTOLib.PhotoMap.refOptionPanelVM.PrintLabel()
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub ReadLastInfoAutoClick(CurrSlab As Slab)
|
|
|
|
|
Dim nIndState As Integer = 1
|
|
|
|
|
Dim sMaterial As String = ""
|
|
|
|
|
Dim dThick As Double = 0
|
|
|
|
|
Dim sWarehouse As String = ""
|
|
|
|
|
nIndState = GetMainPrivateProfileInt(S_AUTOCLICK, K_STATE, nIndState)
|
|
|
|
|
GetMainPrivateProfileString(S_AUTOCLICK, K_AUTOMATERIAL, "", sMaterial)
|
|
|
|
|
dThick = GetMainPrivateProfileDouble(S_AUTOCLICK, K_THICKNESS, 1)
|
|
|
|
|
GetMainPrivateProfileString(S_AUTOCLICK, K_WAREHAOUSE, "", sWarehouse)
|
|
|
|
|
CurrSlab.State = nIndState
|
|
|
|
|
For IndexMat As Integer = 0 To EgtPHOTOLib.PhotoMap.refProjectVM.MaterialList.Count - 1
|
|
|
|
|
If EgtPHOTOLib.PhotoMap.refProjectVM.MaterialList(IndexMat).Trim = sMaterial.Trim Then
|
|
|
|
|
CurrSlab.SetMaterial(EgtPHOTOLib.PhotoMap.refProjectVM.MaterialList(IndexMat))
|
|
|
|
|
Exit For
|
|
|
|
|
End If
|
|
|
|
|
Next
|
|
|
|
|
CurrSlab.SetThickness(dThick)
|
|
|
|
|
CurrSlab.WarehousePosition = sWarehouse
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
' per la gestione di due OmagPHOTO che accedono allo stesso SQL
|
|
|
|
|