- migliorata visualizzazione finestra restart

- aggiornata versione
This commit is contained in:
Emmanuele Sassi
2025-08-06 11:18:01 +02:00
parent e9d71da793
commit 3f11963c4f
3 changed files with 163 additions and 39 deletions
@@ -55,5 +55,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.7.6.1")>
<Assembly: AssemblyFileVersion("2.7.6.1")>
<Assembly: AssemblyVersion("2.7.8.1")>
<Assembly: AssemblyFileVersion("2.7.8.1")>
@@ -3,12 +3,16 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Lib="clr-namespace:Effector.Plugin.Lib;assembly=Effector.Plugin.Lib"
xmlns:local="clr-namespace:Effector.Plugin.FiveLakes"
ShowInTaskbar="False"
IsMinimizable="False"
IsClosable="False"
Title="{Binding sTitle}">
<Window.Resources>
<local:StringToVisibilityConverter x:Key="StringToVisibilityConverter"/>
<local:DoorToVisibilityConverter x:Key="DoorToVisibilityConverter"/>
<local:StateToVisibilityConverter x:Key="StateToVisibilityConverter"/>
<local:VariableNameToVisibilityConverter x:Key="VariableNameToVisibilityConverter"/>
<local:ListEmptyToVisibilityConverter x:Key="ListEmptyToVisibilityConverter"/>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
@@ -205,29 +209,108 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ItemsControl Grid.Row="2"
ItemsSource="{Binding DoorToBeFixedList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding nId}"
TextAlignment="Center"/>
<ComboBox Grid.Row="1"
ItemsSource="{Binding StateList}"
SelectedItem="{Binding SelState}"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock Text="Doors not found on machine!"
FontWeight="Bold"
Visibility="{Binding DoorToBeFixedList, Converter={StaticResource ListEmptyToVisibilityConverter}}"
HorizontalAlignment="Center"
Margin="0,0,0,10"/>
<ItemsControl Grid.Row="1"
ItemsSource="{Binding DoorToBeFixedList}"
HorizontalAlignment="Center">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,0"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="{StaticResource Effector_LightBlue}"
BorderThickness="2"
CornerRadius="10"
Padding="5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="0"
Grid.Row="0"
Text="Id"
Margin="0,0,0,5"/>
<TextBlock Grid.Column="2"
Grid.Row="0"
Text="{Binding nId}"
TextAlignment="Right"/>
<TextBlock Grid.Column="0"
Grid.Row="2"
Text="Old State"
Margin="0,0,0,5"/>
<TextBlock Grid.Column="2"
Grid.Row="2"
Text="{Binding nOldState}"
TextAlignment="Right"/>
<TextBlock Grid.Column="0"
Grid.Row="3"
Text="DDF Name"
Margin="0,0,0,5"/>
<TextBlock Grid.Column="2"
Grid.Row="3"
Text="{Binding sDDFName}"
TextAlignment="Right"/>
<TextBlock Grid.Column="0"
Grid.Row="4"
Text="CSV Name"
Margin="0,0,0,5"/>
<TextBlock Grid.Column="2"
Grid.Row="4"
Text="{Binding sCSVName}"
TextAlignment="Right"/>
<TextBlock Grid.Column="0"
Grid.Row="5"
Text="New State"
Margin="0,0,0,5"/>
<ComboBox Grid.Column="2"
Grid.Row="5"
ItemsSource="{Binding StateList}"
SelectedItem="{Binding SelState}"
HorizontalAlignment="Right"/>
</Grid>
</Border>
<!--<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center">
<TextBlock Text="Id"/>
<TextBlock Text="{Binding nId}"
Margin="10,0,0,0"/>
</StackPanel>
<ComboBox Grid.Row="1"
ItemsSource="{Binding StateList}"
SelectedItem="{Binding SelState}"/>
</Grid>-->
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Grid>
<StackPanel Grid.Row="1"
Orientation="Horizontal"
@@ -5,6 +5,7 @@ Imports System.Globalization
Imports System.IO
Imports System.Reflection
Imports Effector.Plugin.Lib
Imports Effector.Plugin.FiveLakes.Door
Public Class RestartWndVM
Inherits VMBase
@@ -83,22 +84,23 @@ Public Class RestartWndVM
m_nMachineIndex = nMachineIndex
m_sTitle = "Machine " & m_nMachineIndex
If Map.refSupervisorFunction.PlgGetPrivateProfileInt(S_NC, K_NC_SIMULATE, 0) > 0 Then
'For nIndex = 0 To 4
' Dim dValue As Double = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORPRESENCE & "M" & m_nMachineIndex & "P" & nIndex, 0)
' WriteVariableValueToName(nMachineIndex, "@WP_PR_0" & nIndex.ToString(), dValue)
' Dim nValue As Integer = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORINDEX & "M" & m_nMachineIndex & "P" & nIndex, 0)
' WriteVariableValueToName(nMachineIndex, "@DOORN_S" & nIndex.ToString(), nValue)
'Next
For nIndex = 0 To 4
Dim dValue As Double = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORPRESENCE & "M1P" & nIndex, 0)
WriteVariableValueToName(1, "@WP_PR_0" & nIndex.ToString(), dValue)
Dim nValue As Integer = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORINDEX & "M1P" & nIndex, 0)
WriteVariableValueToName(1, "@DOORN_S" & nIndex.ToString(), nValue)
dValue = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORPRESENCE & "M2P" & nIndex, 0)
WriteVariableValueToName(2, "@WP_PR_0" & nIndex.ToString(), dValue)
nValue = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORINDEX & "M2P" & nIndex, 0)
WriteVariableValueToName(2, "@DOORN_S" & nIndex.ToString(), nValue)
Dim dValue As Double = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORPRESENCE & "M" & m_nMachineIndex & "P" & nIndex, 0)
WriteVariableValueToName(nMachineIndex, "@WP_PR_0" & nIndex.ToString(), dValue)
Dim nValue As Integer = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORINDEX & "M" & m_nMachineIndex & "P" & nIndex, 0)
WriteVariableValueToName(nMachineIndex, "@DOORN_S" & nIndex.ToString(), nValue)
Next
' scrive tutte le variabili dell'intera linea
'For nIndex = 0 To 4
' Dim dValue As Double = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORPRESENCE & "M1P" & nIndex, 0)
' WriteVariableValueToName(1, "@WP_PR_0" & nIndex.ToString(), dValue)
' Dim nValue As Integer = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORINDEX & "M1P" & nIndex, 0)
' WriteVariableValueToName(1, "@DOORN_S" & nIndex.ToString(), nValue)
' dValue = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORPRESENCE & "M2P" & nIndex, 0)
' WriteVariableValueToName(2, "@WP_PR_0" & nIndex.ToString(), dValue)
' nValue = GetPluginPrivateProfileDouble(S_DEBUG, K_DOORINDEX & "M2P" & nIndex, 0)
' WriteVariableValueToName(2, "@DOORN_S" & nIndex.ToString(), nValue)
'Next
End If
' riporto lista porte su log
@@ -558,6 +560,21 @@ Public Class VariableNameToVisibilityConverter
End Class
Public Class ListEmptyToVisibilityConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
If IsNothing(value) OrElse Not TypeOf value Is IList Then Return Visibility.Collapsed
Dim List As IList = DirectCast(value, IList)
Return If(List.Count > 0, Visibility.Visible, Visibility.Collapsed)
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
Public Class DoorToBeFixed
Private m_nId As Integer = -1
@@ -567,6 +584,27 @@ Public Class DoorToBeFixed
End Get
End Property
Private m_sDDFName As String
Public ReadOnly Property sDDFName As String
Get
Return m_sDDFName
End Get
End Property
Private m_nOldState As DoorStates
Public ReadOnly Property nOldState As DoorStates
Get
Return m_nOldState
End Get
End Property
Private m_sCSVName As String
Public ReadOnly Property sCSVName As String
Get
Return m_sCSVName
End Get
End Property
Private m_StateList As New ObservableCollection(Of Door.DoorStates)
Public ReadOnly Property StateList As ObservableCollection(Of Door.DoorStates)
Get
@@ -586,6 +624,9 @@ Public Class DoorToBeFixed
Sub New(Door As Door, nMachineIndex As Integer)
m_nId = Door.nId
m_sDDFName = Door.sDDFName
m_nOldState = Door.nState
m_sCSVName = Door.sCSVName
If nMachineIndex = 1 Then
m_StateList = New ObservableCollection(Of Door.DoorStates)({Door.DoorStates.READY_FOR_PRODUCTION, Door.DoorStates.NOTPRODUCE})
ElseIf nMachineIndex = 2 Then