Effector.Plugin.StoneCut 3.1.5.3:

- evitata partenza lettura cartella se path non impostata
- gestito caso di file gia' presente con lo stesso nome e fallimenti di copia o cancellazione file
- correzione su copia programma che veniva fatta due volte
- traduzione dei messaggi delle MessageBox
This commit is contained in:
Emmanuele Sassi
2026-05-13 15:57:40 +02:00
parent 9768e3b80d
commit c94b3c5589
2 changed files with 52 additions and 17 deletions
@@ -197,13 +197,14 @@ Public Class DoorListPageVM
' leggo path cartella dei partprogram
GetPluginPrivateProfileString(S_GENERAL, "PartProgramFolder", "", m_sPartProgramFolderPath)
If Not Directory.Exists(m_sPartProgramFolderPath) Then
MessageBox.Show("Folder not found! Folder path not configured correctly")
If Directory.Exists(m_sPartProgramFolderPath) Then
' avvio timer di copia file
AddHandler m_ReadPartProgramFolderTimer.Tick, AddressOf ReadPartProgramFolderTimer_Tick
m_ReadPartProgramFolderTimer.Interval = TimeSpan.FromSeconds(1)
m_ReadPartProgramFolderTimer.Start()
Else
MessageBox.Show(EgtMsg(12051), EgtMsg(12041), MessageBoxButton.OK, MessageBoxImage.Error)
End If
' avvio timer di copia file
AddHandler m_ReadPartProgramFolderTimer.Tick, AddressOf ReadPartProgramFolderTimer_Tick
m_ReadPartProgramFolderTimer.Interval = TimeSpan.FromSeconds(1)
m_ReadPartProgramFolderTimer.Start()
End Sub
#End Region ' CONSTRUCTOR
@@ -217,14 +218,43 @@ Public Class DoorListPageVM
GetPluginPrivateProfileString(S_GENERAL, "PartProgramDir", "", sPartProgramDirPath)
For nFileIndex = 0 To FileList.Count - 1
Dim bFileMove As Boolean = False
Dim bFileDelete As Boolean = False
Dim sNewFilePath As String = sPartProgramDirPath & "\" & Path.GetFileName(FileList(nFileIndex))
Try
File.Move(FileList(nFileIndex), sNewFilePath)
bFileMove = True
Catch ex As Exception
MessageBox.Show("Impossible loading file " & FileList(0))
End Try
If File.Exists(sNewFilePath) Then
If MessageBox.Show(String.Format(EgtMsg(12055), FileList(0)), EgtMsg(12042), MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
Try
File.Delete(sNewFilePath)
bFileDelete = True
Catch ex As Exception
MessageBox.Show(String.Format(EgtMsg(12056), FileList(0)), EgtMsg(12041), MessageBoxButton.YesNo, MessageBoxImage.Error)
End Try
If bFileDelete Then
Dim bFileOverride As Boolean = False
Try
File.Move(FileList(nFileIndex), sNewFilePath)
bFileOverride = True
Catch ex As Exception
MessageBox.Show(String.Format(EgtMsg(12052), FileList(0)), EgtMsg(12041), MessageBoxButton.OK, MessageBoxImage.Error)
End Try
If Not bFileOverride Then
' elimino riga
Dim sFileName As String = Path.GetFileName(FileList(nFileIndex))
Dim FailedDoor As Door = m_DoorList.FirstOrDefault(Function(x) x.sFileName = Path.GetFileName(sFileName))
If Not IsNothing(FailedDoor) Then
m_DoorList.Remove(FailedDoor)
End If
End If
End If
End If
Else
Try
File.Move(FileList(nFileIndex), sNewFilePath)
bFileMove = True
Catch ex As Exception
MessageBox.Show(String.Format(EgtMsg(12052), FileList(0)), EgtMsg(12041), MessageBoxButton.OK, MessageBoxImage.Error)
End Try
End If
If bFileMove Then
Dim CurrFileInfo As New FileInfo(sNewFilePath)
Dim CurrFileLength As Double = CDbl(CurrFileInfo.Length)
@@ -243,6 +273,11 @@ Public Class DoorListPageVM
If nId <> 0 AndAlso nTable <> 0 Then Exit For
Next
m_DoorList.Add(New Door(nId, Path.GetFileName(FileList(nFileIndex)), nTable, CurrFileLength))
Else
Try
File.Delete(FileList(nFileIndex))
Catch ex As Exception
End Try
End If
Next
WriteBackup()
@@ -349,7 +384,7 @@ Public Class DoorListPageVM
Dim nId As Integer = NewDoorId()
Dim CopyDoor As Door = CurrDoor.Copy(nId)
If Not IsNothing(CopyDoor) Then
m_DoorList.Add(CurrDoor.Copy(nId))
m_DoorList.Add(CopyDoor)
End If
End Sub
@@ -415,7 +450,7 @@ Public Class DoorListPageVM
'If Not LuaGetGlobVar("bReset", bReset) OrElse Not bReset Then
' If (SelDoor.nState >= Door.PartProgramStates.READY_FOR_PRODUCTION AndAlso SelDoor.nState < Door.PartProgramStates.MACHINE_1_END) Then Return
'End If
If MessageBox.Show("Sei sicuro di voler cancellare la porta selezionata?", "Avviso", MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.Yes Then
If MessageBox.Show(EgtMsg(12053), EgtMsg(12042), MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.Yes Then
' cancello file
Dim sPartProgramDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, "PartProgramDir", "", sPartProgramDirPath)
@@ -445,7 +480,7 @@ Public Class DoorListPageVM
Public Sub DeleteAll()
If m_DoorList.Count = 0 Then Return
Dim bReset As Boolean = True
If MessageBox.Show("Sei sicuro di voler cancellare tutte le porte?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
If MessageBox.Show(EgtMsg(12054), EgtMsg(12042), MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
For PartProgramIndex = m_DoorList.Count - 1 To 0 Step -1
' cancello file
Dim sPartProgramDirPath As String = ""
@@ -55,5 +55,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("3.1.5.1")>
<Assembly: AssemblyFileVersion("3.1.5.1")>
<Assembly: AssemblyVersion("3.1.5.3")>
<Assembly: AssemblyFileVersion("3.1.5.3")>