SarmaxWall :
- migliorata gestione trasmissione - aggiunti messaggi vari.
This commit is contained in:
@@ -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
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
ItemsSource="{Binding ItemList}"/>
|
||||
|
||||
<Border Name="MessageBrd" Grid.Row="2" BorderThickness="0,1,0,0" BorderBrush="Gray">
|
||||
<TextBlock Name="MessageTxBx" FontSize="15" VerticalAlignment="Center"
|
||||
<TextBlock Name="MessageTxBl" FontSize="15" VerticalAlignment="Center"
|
||||
TextWrapping="Wrap" HorizontalAlignment="Center" />
|
||||
</Border>
|
||||
|
||||
|
||||
+6
-6
@@ -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
|
||||
|
||||
+4
-4
@@ -91,7 +91,7 @@
|
||||
|
||||
<UniformGrid Grid.Column="0" Grid.Row="8" Grid.ColumnSpan="3" Columns="2">
|
||||
<TextBlock Name="LayerThicknessLbl" Grid.ColumnSpan="3" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center" FontSize="15" TextWrapping="WrapWithOverflow" Width="75"
|
||||
HorizontalAlignment="Center" FontSize="15" TextWrapping="WrapWithOverflow" Width="80"
|
||||
TextAlignment="Center" />
|
||||
<TextBox Name="LayerThicknessTxBx" Grid.Column="1" Grid.Row="5" Style="{StaticResource NumericKeyboard}"
|
||||
FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" Width="60"
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
<UniformGrid Grid.Column="0" Grid.Row="9" Grid.ColumnSpan="3" Columns="2">
|
||||
<TextBlock Name="PlankNumFirstLayerLbl" Grid.ColumnSpan="3" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center" FontSize="15" TextWrapping="WrapWithOverflow" Width="75"
|
||||
HorizontalAlignment="Center" FontSize="15" TextWrapping="WrapWithOverflow" Width="80"
|
||||
TextAlignment="Center" />
|
||||
<TextBox Name="PlankNumFirstLayerTxBx" Grid.Column="1" Grid.Row="5" Style="{StaticResource NumericKeyboard}"
|
||||
FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" Width="60"
|
||||
@@ -110,8 +110,8 @@
|
||||
</Grid>
|
||||
|
||||
<Border Name="MessageBrd" Grid.Row="1" BorderThickness="0,1,0,0" BorderBrush="Gray">
|
||||
<TextBlock Name="MessageTxBx" FontSize="15" VerticalAlignment="Center"
|
||||
TextWrapping="Wrap" HorizontalAlignment="Center" />
|
||||
<TextBlock Name="MessageTxBl" FontSize="15" VerticalAlignment="Center"
|
||||
TextWrapping="WrapWithOverflow" HorizontalAlignment="Center" />
|
||||
</Border>
|
||||
|
||||
|
||||
|
||||
+108
-17
@@ -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
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 1.8 KiB |
Reference in New Issue
Block a user