Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 24ab2e0ba8 | |||
| 8aec6c87b0 |
@@ -46,6 +46,11 @@
|
|||||||
Public Const K_THREADSLEEP As String = "ThreadSleep"
|
Public Const K_THREADSLEEP As String = "ThreadSleep"
|
||||||
Public Const K_PHOTODELEY As String = "PhotoDeley"
|
Public Const K_PHOTODELEY As String = "PhotoDeley"
|
||||||
|
|
||||||
|
Public Const S_EXECLUA As String = "ExecLua"
|
||||||
|
Public Const K_DIRSCRIPT_LUA As String = "DirScript"
|
||||||
|
Public Const K_FILESCRIPT_LUA As String = "FileScript"
|
||||||
|
Public Const K_CALLFUNCTION As String = "CallFunction"
|
||||||
|
|
||||||
Public Const S_NCDATA As String = "NcData"
|
Public Const S_NCDATA As String = "NcData"
|
||||||
Public Const K_NEWVARIABLE As String = "NewVariable"
|
Public Const K_NEWVARIABLE As String = "NewVariable"
|
||||||
Public Const K_NEWCONSOLE As String = "NewConsole"
|
Public Const K_NEWCONSOLE As String = "NewConsole"
|
||||||
|
|||||||
@@ -801,19 +801,23 @@
|
|||||||
<Grid Grid.Column="0" Grid.Row="8">
|
<Grid Grid.Column="0" Grid.Row="8">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="2.5*"/>
|
<ColumnDefinition Width="2.5*"/>
|
||||||
<ColumnDefinition Width="5*"/>
|
<ColumnDefinition Width="2.5*"/>
|
||||||
<ColumnDefinition Width="2*"/>
|
<ColumnDefinition Width="4.5*"/>
|
||||||
|
<ColumnDefinition Width="1.8*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Button x:Name="SawProbingBtn"
|
<Button x:Name="SawProbingBtn"
|
||||||
Style="{DynamicResource OmagCut_YellowGradientYellowIconButton}">
|
Style="{DynamicResource OmagCut_YellowGradientYellowIconButton}">
|
||||||
<Image Source="{DynamicResource SawProbeImg}" Style="{StaticResource OmagCut_ScaleButtonIcon}"/>
|
<Image Source="{DynamicResource SawProbeImg}" Style="{StaticResource OmagCut_ScaleButtonIcon}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button x:Name="ExecLuaBtn" Grid.Column="1"
|
||||||
|
Style="{DynamicResource OmagCut_YellowGradientYellowIconButton}">
|
||||||
|
<Image Source="{DynamicResource PlayImg}" Style="{StaticResource OmagCut_ScaleButtonIcon}"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<TextBlock Name="UseLaserOriginTxBl" Grid.Column="2"
|
||||||
<TextBlock Name="UseLaserOriginTxBl" Grid.Column="1"
|
|
||||||
Style="{DynamicResource OmagCut_ToolsDBTextBlock}" />
|
Style="{DynamicResource OmagCut_ToolsDBTextBlock}" />
|
||||||
<CheckBox Name="UseLaserOriginChBx" Style="{DynamicResource OmagCut_CheckBox_Single}" Grid.Column="2"
|
<CheckBox Name="UseLaserOriginChBx" Style="{DynamicResource OmagCut_CheckBox_Single}" Grid.Column="3"
|
||||||
HorizontalAlignment="Right" Margin="10,0,10,0"/>
|
HorizontalAlignment="Right" Margin="0,0,10,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -45,6 +45,13 @@ Public Class AlarmsPageUC
|
|||||||
SawProbingBtn.Visibility = Windows.Visibility.Hidden
|
SawProbingBtn.Visibility = Windows.Visibility.Hidden
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
' Se esiste un file lua valido allora mostro il pulsante per l'esecuzione dello script
|
||||||
|
If Not String.IsNullOrEmpty(GetExecLuaFile()) And
|
||||||
|
ExecLuaBtn.Visibility = Visibility.Visible Then
|
||||||
|
Else
|
||||||
|
ExecLuaBtn.Visibility = Visibility.Hidden
|
||||||
|
End If
|
||||||
|
|
||||||
' Imposto i messaggi letti dal file dei messaggi
|
' Imposto i messaggi letti dal file dei messaggi
|
||||||
CurrSawTxBl.Text = EgtMsg(MSG_ALARMSPAGEUC + 1)
|
CurrSawTxBl.Text = EgtMsg(MSG_ALARMSPAGEUC + 1)
|
||||||
AuxiliaryToolTxBl.Text = EgtMsg(MSG_ALARMSPAGEUC + 2)
|
AuxiliaryToolTxBl.Text = EgtMsg(MSG_ALARMSPAGEUC + 2)
|
||||||
@@ -1327,4 +1334,53 @@ Public Class AlarmsPageUC
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ExecLuaBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExecLuaBtn.Click
|
||||||
|
Dim sExecFile As String = GetExecLuaFile()
|
||||||
|
Dim sCallFunction As String = GetCallFunction()
|
||||||
|
' Recupero file LUA
|
||||||
|
Dim bExec As Boolean = EgtLuaExecFile(sExecFile)
|
||||||
|
' Lancio l'esecuzione della funzione principale
|
||||||
|
bExec = bExec And EgtLuaCallFunction(sCallFunction)
|
||||||
|
' Leggo variabili
|
||||||
|
Dim nErr As Integer = 0
|
||||||
|
EgtLuaGetGlobIntVar("CMD.ERR", nErr)
|
||||||
|
' Reset lua
|
||||||
|
EgtLuaResetGlobVar("CMD")
|
||||||
|
' Verifico condizioni di errore
|
||||||
|
If nErr <> 0 And bExec Then
|
||||||
|
' Errore in tastatura lama
|
||||||
|
EgtOutLog("Error in execution file: " & sExecFile & ", calling function: " & sCallFunction & ", CMD.ERR=" & nErr, ToString)
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
' Recupero il percorso del file lua da eseguire
|
||||||
|
Private Function GetExecLuaFile() As String
|
||||||
|
Dim sDir As String = String.Empty
|
||||||
|
Dim sFile As String = String.Empty
|
||||||
|
If GetPrivateProfileString(S_EXECLUA, K_DIRSCRIPT_LUA, "", sDir, m_MainWindow.GetMachIniFile()) <> 0 And
|
||||||
|
GetPrivateProfileString(S_EXECLUA, K_FILESCRIPT_LUA, "", sFile, m_MainWindow.GetMachIniFile()) <> 0 Then
|
||||||
|
' Formatto le stringhe lette
|
||||||
|
sDir = sDir.Trim
|
||||||
|
sFile = sFile.Trim
|
||||||
|
If sDir.EndsWith("\"c) Then
|
||||||
|
sDir = sDir.Remove(sDir.LastIndexOf("\"c))
|
||||||
|
End If
|
||||||
|
If Not sFile.EndsWith(".lua") Then
|
||||||
|
sFile = sFile & ".lua"
|
||||||
|
End If
|
||||||
|
If File.Exists(sDir & "\" & sFile) Then
|
||||||
|
Return sDir & "\" & sFile
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Return String.Empty
|
||||||
|
End Function
|
||||||
|
|
||||||
|
' Recupera il nome della funzione che deve essere chiamata
|
||||||
|
Private Function GetCallFunction() As String
|
||||||
|
Dim sCallFunction As String = "CMD.CmdString"
|
||||||
|
GetPrivateProfileString(S_EXECLUA, K_CALLFUNCTION, sCallFunction, sCallFunction, m_MainWindow.GetMachIniFile())
|
||||||
|
Return sCallFunction
|
||||||
|
End Function
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user