diff --git a/ConstIni.vb b/ConstIni.vb
index 526e2b5..510c53b 100644
--- a/ConstIni.vb
+++ b/ConstIni.vb
@@ -88,5 +88,6 @@ Module ConstIni
Public Const K_PLANKNUMONTOP As String = "PlankNumOnTop"
Public Const K_TRANSMITTER As String = "Transmitter"
Public Const K_GANTRIES As String = "Gantries"
+ Public Const K_SENDTIMEOUT As String = "SendTimeout"
End Module
diff --git a/OpenPageUC.xaml b/OpenPageUC.xaml
index 5b30c4b..5a34a58 100644
--- a/OpenPageUC.xaml
+++ b/OpenPageUC.xaml
@@ -28,7 +28,7 @@
ItemsSource="{Binding ItemList}"/>
-
diff --git a/OpenPageUC.xaml.vb b/OpenPageUC.xaml.vb
index cb2d432..37f902e 100644
--- a/OpenPageUC.xaml.vb
+++ b/OpenPageUC.xaml.vb
@@ -214,8 +214,8 @@ Public Class OpenPageUC
' Eseguo zoom
OpenScene.ZoomAll()
' Cancello messaggio
- MessageTxBx.Text = ""
- MessageBrd.Background = Brushes.White
+ Me.MessageTxBl.Text = ""
+ Me.MessageBrd.Background = Brushes.White
m_bFileOk = False
OkBtn.IsEnabled = False
Return True
@@ -239,12 +239,12 @@ Public Class OpenPageUC
Dim nMarkId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK)
m_bFileOk = bOk And (nMarkId <> GDB_ID.NULL)
If m_bFileOk Then
- MessageTxBx.Text = ""
- MessageBrd.Background = Brushes.White
+ Me.MessageTxBl.Text = ""
+ Me.MessageBrd.Background = Brushes.White
OkBtn.IsEnabled = True
Else
- MessageTxBx.Text = EgtMsg(MSG_OPENPAGEUC + 1) 'Progetto non valido
- MessageBrd.Background = Brushes.Tomato
+ Me.MessageTxBl.Text = EgtMsg(MSG_OPENPAGEUC + 1) 'Progetto non valido
+ Me.MessageBrd.Background = Brushes.Tomato
OkBtn.IsEnabled = False
End If
' Eseguo zoom
diff --git a/PlacePageUC.xaml b/PlacePageUC.xaml
index 5ccb3bd..1c0316d 100644
--- a/PlacePageUC.xaml
+++ b/PlacePageUC.xaml
@@ -91,7 +91,7 @@
-
+
diff --git a/PlacePageUC.xaml.vb b/PlacePageUC.xaml.vb
index d83553e..49e96a7 100644
--- a/PlacePageUC.xaml.vb
+++ b/PlacePageUC.xaml.vb
@@ -1,4 +1,7 @@
-Imports EgtUILib
+
+Imports System.Threading
+Imports System.IO
+Imports EgtUILib
Public Class PlacePageUC
@@ -253,8 +256,8 @@ Public Class PlacePageUC
Friend Sub MyDraw()
EgtDraw()
If EgtGetModified() Then
- MessageTxBx.Text = ""
- MessageBrd.Background = Brushes.White
+ Me.MessageTxBl.Text = ""
+ Me.MessageBrd.Background = Brushes.White
End If
End Sub
@@ -468,8 +471,8 @@ Public Class PlacePageUC
End Function
Private Sub InsertWallBtn_Click(sender As Object, e As RoutedEventArgs) Handles InsertWallBtn.Click
- ' Parametri di caricamento
' Ciclo di inserimento in tavola dei pezzi selezionati
+ Dim bAllOk As Boolean = True
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
' Recupero successivo selezionato
@@ -478,6 +481,7 @@ Public Class PlacePageUC
If EgtIsPart(nId) And Not IsPartInTable(nId) Then
If Not EgtPackPart(nId, 0, -m_dWidth, m_dLength, 0, m_dMinDist, False) Then
EgtDeselectObj(nId)
+ bAllOk = False
End If
End If
' Passo al successivo selezionato
@@ -487,6 +491,11 @@ Public Class PlacePageUC
m_nPartPos = IIf(EgtGetSelectedObjCount() > 0, PART_POS.IN_TABLE, PART_POS.NONE_TABLE)
' Aggiorno vista
MyDraw()
+ ' Se almeno una parete non piazzata, lo segnalo
+ If Not bAllOk Then
+ Me.MessageTxBl.Text = EgtMsg(MSG_PLACEPAGEUC + 9) 'Inserimento non riuscito
+ Me.MessageBrd.Background = Brushes.Tomato
+ End If
End Sub
Private Sub StoreWallBtn_Click(sender As Object, e As RoutedEventArgs) Handles StoreWallBtn.Click
@@ -584,7 +593,7 @@ Public Class PlacePageUC
EgtLuaSetGlobNumVar("PROC.LAYPLANKNBR", nPlankNumOnLay)
Dim dTemp As Double
EgtLuaEvalNumExpr(PlankNumFirstLayerTxBx.Text, dTemp)
- m_nPlankNumOnTop = CInt(dTemp + 0.1)
+ m_nPlankNumOnTop = CInt(dTemp + 0.10000000000000001)
WritePrivateProfileString(S_MACHINE, K_PLANKNUMONTOP, m_nPlankNumOnTop, m_MainWindow.GetIniFile())
EgtLuaSetGlobNumVar("PROC.TOPPLANKNBR", m_nPlankNumOnTop)
' eseguo
@@ -600,11 +609,11 @@ Public Class PlacePageUC
Dim nErr As Integer = 1000
EgtLuaGetGlobIntVar("PROC.ERR", nErr)
If nErr = 0 Then
- MessageTxBx.Text = EgtMsg(MSG_PLACEPAGEUC + 10) ' Generazione riuscita
- MessageBrd.Background = Brushes.Green
+ Me.MessageTxBl.Text = EgtMsg(MSG_PLACEPAGEUC + 10) ' Generazione riuscita
+ Me.MessageBrd.Background = Brushes.Green
Else
- MessageTxBx.Text = EgtMsg(MSG_PLACEPAGEUC + 11) ' Errore in generazione
- MessageBrd.Background = Brushes.Tomato
+ Me.MessageTxBl.Text = EgtMsg(MSG_PLACEPAGEUC + 11) ' Errore in generazione
+ Me.MessageBrd.Background = Brushes.Tomato
End If
' cancello variabili
EgtLuaResetGlobVar("PROC")
@@ -614,20 +623,102 @@ Public Class PlacePageUC
' path dell'eseguibile di trasmissione
Dim sExeFile As String = String.Empty
GetPrivateProfileString(S_MACHINE, K_TRANSMITTER, "", sExeFile, m_MainWindow.GetIniFile())
- ' Path del file da trasmettere
+ ' flag per ponti da pilotare
+ Dim nFlag As Integer = GetPrivateProfileInt(S_MACHINE, K_GANTRIES, 3, m_MainWindow.GetIniFile())
+ ' Path del file da trasmettere e del file di risultato
Dim nLastProj As Integer = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 1, m_MainWindow.GetIniFile())
Dim sDataFile As String = m_MainWindow.GetDataDir() & "\" & nLastProj.ToString("D4") & ".dat"
+ Dim sResFile As String = m_MainWindow.GetDataDir() & "\" & nLastProj.ToString("D4") & ".err"
+ ' Rimuovo eventuale file di errore già presente
+ Try
+ If My.Computer.FileSystem.FileExists(sResFile) Then
+ My.Computer.FileSystem.DeleteFile(sResFile)
+ End If
+ Catch ex As Exception
+ End Try
+ ' Se nessun ponte abilitato, salto tutto
+ If nFlag = 0 Then
+ Me.MessageTxBl.Text = EgtMsg(MSG_PLACEPAGEUC + 16) ' Ponti tutti disabilitati
+ Me.MessageBrd.Background = Brushes.Yellow
+ Return
+ End If
' Lancio la trasmissione
Try
- Process.Start(sExeFile, sDataFile)
- MessageTxBx.Text = EgtMsg(MSG_PLACEPAGEUC + 12) ' Lancio trasmissione riuscito
- MessageBrd.Background = Brushes.Green
+ Process.Start(sExeFile, sDataFile & " " & nFlag.ToString())
+ Me.MessageTxBl.Text = EgtMsg(MSG_PLACEPAGEUC + 12) ' Lancio trasmissione riuscito
+ Me.MessageBrd.Background = Brushes.Green
Catch ex As Exception
- MessageTxBx.Text = EgtMsg(MSG_PLACEPAGEUC + 13) ' Errore in lancio trasmissione
- MessageBrd.Background = Brushes.Tomato
+ Me.MessageTxBl.Text = EgtMsg(MSG_PLACEPAGEUC + 13) ' Errore in lancio trasmissione
+ Me.MessageBrd.Background = Brushes.Tomato
End Try
-
-
+ Dim nDummy As Integer
+ Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, _
+ New Action(Function() nDummy = 0))
+ ' Attendo la lettura del risultato
+ Dim bOk As Boolean = WaitSendResult(sResFile)
+ If bOk Then
+ Me.MessageTxBl.Text = EgtMsg(MSG_PLACEPAGEUC + 14) ' Trasmissione completata con successo
+ Me.MessageBrd.Background = Brushes.Green
+ Else
+ Me.MessageTxBl.Text = EgtMsg(MSG_PLACEPAGEUC + 15) ' Trasmissione non riuscita
+ Me.MessageBrd.Background = Brushes.Tomato
+ End If
End Sub
+ Private Function WaitSendResult(ByVal sResFile As String) As Boolean
+ ' Ciclo di ricerca foto scattata (timeout = 10)
+ Dim nTimeout As Integer = GetPrivateProfileInt(S_MACHINE, K_SENDTIMEOUT, 10, m_MainWindow.GetIniFile())
+ Dim nMaxThick = 10 * nTimeout
+ For nThick As Integer = 0 To nMaxThick
+ ' Se esiste il file di risultato
+ Dim nErr = 999
+ If VerifyResult(sResFile, nErr) Then
+ If nErr = 0 Then
+ Return True
+ Else
+ EgtOutLog("Send err=" & nErr.ToString())
+ Return False
+ End If
+ ' Altrimenti aspetto
+ Else
+ ' Aspetto 100 ms
+ Thread.Sleep(100)
+ End If
+ Next
+ EgtOutLog("Send generic error")
+ Return False
+ End Function
+
+ Private Function VerifyResult(ByVal sResFile As String, ByRef nErr As Integer) As Boolean
+ ' Se non esiste il file con il risultato
+ If Not My.Computer.FileSystem.FileExists(sResFile) Then
+ Return False
+ End If
+ ' Leggo il file
+ Dim bOk As Boolean = False
+ Try
+ ' Controllo errori nel file di info
+ Dim sLine As String = String.Empty
+ Dim sr As StreamReader = New StreamReader(sResFile)
+ Do While sr.Peek() > -1
+ sLine = sr.ReadLine()
+ sLine = sLine.Replace(" ", "")
+ If sLine.StartsWith("Err=") Then
+ If Int32.TryParse(sLine.Substring(4), nErr) Then
+ bOk = True
+ Exit Do
+ End If
+ End If
+ Loop
+ sr.Close()
+ Catch ex As Exception
+ bOk = False
+ End Try
+ Return bOk
+ End Function
+
+ Private Sub MessageTxBl_MouseDown(sender As Object, e As MouseButtonEventArgs) Handles MessageTxBl.MouseDown
+ Me.MessageTxBl.Text = ""
+ Me.MessageBrd.Background = Brushes.White
+ End Sub
End Class
diff --git a/Resources/ClockwiseRotate.png b/Resources/ClockwiseRotate.png
index 7c843bf..6305332 100644
Binary files a/Resources/ClockwiseRotate.png and b/Resources/ClockwiseRotate.png differ
diff --git a/Resources/CounterClockwiseRotate.png b/Resources/CounterClockwiseRotate.png
index 04dc462..93e3297 100644
Binary files a/Resources/CounterClockwiseRotate.png and b/Resources/CounterClockwiseRotate.png differ