- aggiunta cancellazione completa di tutte le porte in lista

This commit is contained in:
Emmanuele Sassi
2025-10-13 19:38:11 +02:00
parent 0352b53972
commit 48699ea740
4 changed files with 67 additions and 7 deletions
@@ -25,12 +25,19 @@
Style="{StaticResource Button.Image.DoorList}"/>
</Button>
<Button ToolTip="Cancella tutte le porte del csv della porta selezionata"
Command="{Binding DeleteAll_Command}"
Command="{Binding DeleteCSV_Command}"
IsEnabled="{Binding bExecButton_IsEnabled}"
Style="{StaticResource Button.DoorList}">
<Image Source="../Resources/DoorListPage/DeleteCsv.png"
Style="{StaticResource Button.Image.DoorList}"/>
</Button>
<Button ToolTip="Cancella tutte le porte presenti in lista"
Command="{Binding DeleteAll_Command}"
IsEnabled="{Binding bExecButton_IsEnabled}"
Style="{StaticResource Button.DoorList}">
<Image Source="../Resources/DoorListPage/DeleteAll.png"
Style="{StaticResource Button.Image.DoorList}"/>
</Button>
<Button ToolTip="Mette in coda di produzione la porta selezionata"
Command="{Binding Produce_Command}"
Style="{StaticResource Button.DoorList}">
@@ -104,6 +104,7 @@ Public Class DoorListPageVM
Private m_cmdMoveUp As ICommand
Private m_cmdMoveDown As ICommand
Private m_cmdDelete As ICommand
Private m_cmdDeleteCSV As ICommand
Private m_cmdDeleteAll As ICommand
Private m_cmdProduce As ICommand
Private m_cmdProduceAll As ICommand
@@ -998,18 +999,18 @@ Public Class DoorListPageVM
#End Region ' Delete
#Region "DeleteAll"
#Region "DeleteCSV"
Public ReadOnly Property DeleteAll_Command As ICommand
Public ReadOnly Property DeleteCSV_Command As ICommand
Get
If m_cmdDeleteAll Is Nothing Then
m_cmdDeleteAll = New Command(AddressOf DeleteAll)
If m_cmdDeleteCSV Is Nothing Then
m_cmdDeleteCSV = New Command(AddressOf DeleteCSV)
End If
Return m_cmdDeleteAll
Return m_cmdDeleteCSV
End Get
End Property
Public Sub DeleteAll()
Public Sub DeleteCSV()
If m_DoorList.Count = 0 OrElse IsNothing(SelDoor) OrElse String.Compare(SelDoor.sCSVName, m_ManualAddedDoorName, True) = 0 Then Return
Dim bReset As Boolean = True
If Not LuaGetGlobVar("bReset", bReset) OrElse Not bReset Then
@@ -1040,6 +1041,55 @@ Public Class DoorListPageVM
End If
End Sub
#End Region ' DeleteCSV
#Region "DeleteAll"
Public ReadOnly Property DeleteAll_Command As ICommand
Get
If m_cmdDeleteAll Is Nothing Then
m_cmdDeleteAll = New Command(AddressOf DeleteAll)
End If
Return m_cmdDeleteAll
End Get
End Property
Public Sub DeleteAll()
If m_DoorList.Count = 0 Then Return
Dim bReset As Boolean = True
If Not LuaGetGlobVar("bReset", bReset) OrElse Not bReset Then
MessageBox.Show("Impossibile cancellare tutte le porte!" & Environment.NewLine & "La macchina deve essere in stato Reset per poter cancellare tutte le porte!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
Return
End If
' verifico che tutte le porte siano in stato prodotto o da non produrre
Dim bAllProduced As Boolean = True
For Each CsvDoor In m_DoorList
If CsvDoor.nState <> DoorStates.MACHINE_1_END AndAlso CsvDoor.nState <> DoorStates.PRODUCED AndAlso CsvDoor.nState <> DoorStates.NOTPRODUCE AndAlso CsvDoor.nState <> DoorStates.VERIFICATION_FAILED AndAlso CsvDoor.nState <> DoorStates.VERIFIED Then
bAllProduced = False
End If
Next
If Not bAllProduced Then
MessageBox.Show("Impossibile cancellare tutte le porte!" & Environment.NewLine & "Per cancellare tutte le porte, devono essere tutte non in lavorazione!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)
Return
End If
If MessageBox.Show("Sei sicuro di voler cancellare tutte le porte?", "Info", MessageBoxButton.YesNo, MessageBoxImage.Information) = MessageBoxResult.Yes Then
For CsvDoorIndex = m_DoorList.Count - 1 To 0 Step -1
Dim CsvDoor As Door = m_DoorList(CsvDoorIndex)
m_DoorList.Remove(CsvDoor)
Next
WriteBackup()
' cancello backup lua per ripartire pulito
Try
Dim sBackupDirPath As String = ""
GetPluginPrivateProfileString(S_GENERAL, K_BACKUPDIR, "", sBackupDirPath)
Dim sLuaBackupFilePath As String = sBackupDirPath & "\LuaBackup.json"
File.Delete(sLuaBackupFilePath)
Catch ex As Exception
Map.refSupervisorFunction.PlgOutLog("Fallita cancellazione del file LuaBackup!")
End Try
End If
End Sub
#End Region ' DeleteAll
#Region "Produce"
@@ -207,6 +207,9 @@
<Resource Include="Resources\DoorListPage\SkipDoor.png" />
<Resource Include="Resources\DoorListPage\Verify.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\DoorListPage\DeleteAll.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PreBuildEvent>powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\pre-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)</PreBuildEvent>
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB