-aggiornato finestra selezione tavola nuova macchina

This commit is contained in:
Demetrio Cassarino
2025-10-22 15:31:18 +02:00
parent fbfaad64cf
commit 4a42bd3067
6 changed files with 123 additions and 126 deletions
+4 -3
View File
@@ -117,10 +117,11 @@ Public Class MyMachGroupPanelVM
' Se macchina con più tavole, chiedo quale usare
Dim nTabInd As Integer = 1
Dim nTabCnt As Integer = CamAuto.GetTableCount()
Dim SelectTableWindowVM As New SelectTableWindowVM()
If nTabCnt > 1 And nTabCnt <= 4 Then
Dim dlg As New SelectTableWindowV(Application.Current.MainWindow, New SelectTableWindowVM(nTabCnt))
dlg.ShowDialog()
nTabInd = dlg.m_SelTable
Dim SelectTableWindowV As New SelectTableWindowV(Application.Current.MainWindow, SelectTableWindowVM)
SelectTableWindowV.ShowDialog()
nTabInd = SelectTableWindowVM.nSelectedTable
End If
EgtSetTable(GetTableName(nTabInd))
' leggo nome attrezzaggio di default
+2 -7
View File
@@ -5,8 +5,7 @@
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False"
IsMinimizable="False" WindowStartupLocation="CenterScreen"
CloseCommand="{Binding CloseCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"
IsMinimizable="False" WindowStartupLocation="CenterScreen" IsClosable="False"
Title="{Binding sTitle}" Height="150" Width="320">
<Grid>
<Grid.RowDefinitions>
@@ -53,11 +52,7 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<UniformGrid Grid.Row="1" Columns="2">
<Button Content="Ok" Margin="5" Command="{Binding OkCommand}"
<Button Grid.Row="1" Content="Ok" Margin="5" Command="{Binding OkCommand}"
Style="{StaticResource OptionPanel_TextButton}"/>
<Button Content="Cancel" Margin="5" Command="{Binding CancelCommand}"
Style="{StaticResource OptionPanel_TextButton}"/>
</UniformGrid>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
+36 -22
View File
@@ -1,5 +1,8 @@
Public Class ChangeTableVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Private m_refChanTableV As ChangeTableV
Public Enum EnumDialogResult
@@ -28,8 +31,19 @@
End Get
End Property
Private m_CurrTableList As New List(Of TableToChange)
Public ReadOnly Property CurrTableList As List(Of TableToChange)
Get
Return m_CurrTableList
End Get
End Property
' Definizione Comandi
Private m_cmdOk As ICommand
Private m_cmdCancel As ICommand
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Sub New(refV As ChangeTableV)
m_refChanTableV = refV
@@ -37,12 +51,9 @@
Initialized()
End Sub
Private m_CurrTableList As New List(Of TableToChange)
Public ReadOnly Property CurrTableList As List(Of TableToChange)
Get
Return m_CurrTableList
End Get
End Property
#End Region ' Constructor
#Region "METHODS"
Private Sub Initialized()
' recuepero l'inidce della tavola corrente
@@ -53,6 +64,12 @@
Next
End Sub
#End Region ' Methods
#Region "COMMANDS"
#Region "OkCommand"
Public ReadOnly Property OkCommand() As ICommand
Get
If m_cmdOk Is Nothing Then
@@ -62,15 +79,6 @@
End Get
End Property
Public ReadOnly Property CancelCommand() As ICommand
Get
If m_cmdCancel Is Nothing Then
m_cmdCancel = New Command(AddressOf Cancel)
End If
Return m_cmdCancel
End Get
End Property
Private Sub Ok()
' recupero l'indice della tavola impostata
For Each ItemTab As TableToChange In CurrTableList
@@ -84,17 +92,17 @@
m_refChanTableV.Close()
End Sub
Private Sub Cancel()
m_MyDialogResult = EnumDialogResult.CANCEL
' procedo alla chiusura della finetra
m_refChanTableV.Close()
End Sub
#End Region ' OkCommand
#End Region ' Commands
End Class
Public Class TableToChange
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Private Property m_sName As String = "Tab"
Public ReadOnly Property sName As String
Get
@@ -133,11 +141,17 @@ Public Class TableToChange
End Set
End Property
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Public Sub New(Name As String, Ind As Integer, IsCurrent As Boolean)
m_sName = Name & " " & Ind.ToString
m_nIndex = Ind
m_bIsActive = IsCurrent
NotifyPropertyChanged("IsActive")
NotifyPropertyChanged(NameOf(IsActive))
End Sub
#End Region ' Constructor
End Class
+47 -52
View File
@@ -2,64 +2,59 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
IsClosable="False"
IsMinimizable="False"
ShowInTaskbar="False"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
SizeToContent="WidthAndHeight"
Title="{Binding Title}"
WindowStartupLocation="CenterOwner" ResizeMode="NoResize">
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False"
IsMinimizable="False" WindowStartupLocation="CenterScreen" IsClosable="False"
Title="{Binding Title}" Height="150" Width="320">
<Grid HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="10,10,10,20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<ItemsControl ItemsSource="{Binding CurrTableList}">
<!--Definisco l'organizzazione dei comandi-->
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<!--Definisco il contenuto del comando-->
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton GroupName="TabGrp"
IsChecked="{Binding IsActive}"
Width="60" Height="60"
Style="{DynamicResource ChangeTable_ToggleButton}">
<Grid>
<!--Nome della tavole: Tab #-->
<TextBlock Text="{Binding sName}"
HorizontalAlignment="Center"
Background="Transparent">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{StaticResource Omag_LightGray}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, RelativeSource={RelativeSource AncestorType=RadioButton}}" Value="True">
<Setter Property="Foreground" Value="{StaticResource Omag_White}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<!--Rappresentazione di una tavola di lavoro-->
<Image Source="{Binding ImgTab}" Margin="0,20,0,0"/>
</Grid>
<TextBlock Text="{Binding WndMsg}"
FontSize="18"
Grid.ColumnSpan="3"
Margin="0,0,0,10" Foreground="#FFE0E0E0"/>
<Button Grid.Column="0" Grid.Row="1"
Content="1" FontSize="40"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding Table_Command}"
CommandParameter="1"
Margin="10,0,10,0" Foreground="#FFE0E0E0">
</Button>
<Button Grid.Column="1" Grid.Row="1"
Content="2" FontSize="40"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding Table_Command}"
CommandParameter="2"
Margin="10,0,10,0" Foreground="#FFE0E0E0">
</Button>
<Button Grid.Column="2" Grid.Row="1"
Content="3" FontSize="40"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding Table_Command}"
CommandParameter="3"
Visibility="{Binding Table3_Visibility}"
Margin="10,0,10,0" Foreground="#FFE0E0E0">
</Button>
<Button Grid.Column="3" Grid.Row="1"
Content="4" FontSize="40"
Style="{StaticResource OptionPanel_NestingButton}"
Command="{Binding Table_Command}"
CommandParameter="4"
Visibility="{Binding Table4_Visibility}"
Margin="10,0,10,0" Foreground="#FFE0E0E0">
</Button>
</RadioButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Grid.Row="1" Content="Ok" Margin="5"
Command="{Binding OkCommand}"
Style="{StaticResource OptionPanel_TextButton}"/>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
@@ -1,7 +1,6 @@
Public Class SelectTableWindowV
Private WithEvents m_SelectTableWindowVM As SelectTableWindowVM
Public m_SelTable As Integer
Sub New(Owner As Window, SelectTableWindowVM As SelectTableWindowVM)
MyBase.New(Owner)
@@ -13,7 +12,6 @@
End Sub
Private Sub CloseWindow(DialogResult As Integer) Handles m_SelectTableWindowVM.m_CloseWindow
m_SelTable = DialogResult
Me.DialogResult = True
End Sub
+29 -35
View File
@@ -1,5 +1,4 @@
Imports EgtUILib
Imports EgtWPFLib5
Public Class SelectTableWindowVM
Inherits VMBase
@@ -8,24 +7,18 @@ Public Class SelectTableWindowVM
Friend Event m_CloseWindow(DialogResult As Integer)
Private m_Table3_Visibility As Visibility
Public Property Table3_Visibility As Visibility
Private m_nSelectedTable As Integer = 0
Public ReadOnly Property nSelectedTable As Integer
Get
Return m_Table3_Visibility
Return m_nSelectedTable
End Get
Set(value As Visibility)
m_Table3_Visibility = value
End Set
End Property
Private m_Table4_Visibility As Visibility
Public Property Table4_Visibility As Visibility
Private m_CurrTableList As New List(Of TableToChange)
Public ReadOnly Property CurrTableList As List(Of TableToChange)
Get
Return m_Table4_Visibility
Return m_CurrTableList
End Get
Set(value As Visibility)
m_Table4_Visibility = value
End Set
End Property
#Region "Messages"
@@ -45,48 +38,49 @@ Public Class SelectTableWindowVM
#End Region
' Definizione comandi
Private m_cmdTable As ICommand
Private m_cmdOk As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New(nTableNum As Integer)
Select nTableNum
Case 2
m_Table3_Visibility = Visibility.Collapsed
m_Table4_Visibility = Visibility.Collapsed
Case 3
m_Table3_Visibility = Visibility.Visible
m_Table4_Visibility = Visibility.Collapsed
Case 4
m_Table3_Visibility = Visibility.Visible
m_Table4_Visibility = Visibility.Visible
End Select
NotifyPropertyChanged("Table3_Visibility")
NotifyPropertyChanged("Table4_Visibility")
Sub New()
' recuepero l'inidce della tavola corrente
Dim nIndeXCurrTab As Integer = GetCurrentTable()
' creo la lista delle tavole disponibili (attivo il bottone della tavola attualmente in uso)
For nInd As Integer = 0 To GetTableCount() - 1
m_CurrTableList.Add(New TableToChange("Tab", (nInd + 1), ((nInd + 1) = nIndeXCurrTab)))
Next
End Sub
#End Region ' CONSTRUCTOR
#Region "COMMANDS"
#Region "Table"
#Region "OkCommand"
Public ReadOnly Property Table_Command As ICommand
Public ReadOnly Property OkCommand() As ICommand
Get
If m_cmdTable Is Nothing Then
m_cmdTable = New Command(AddressOf Table)
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdTable
Return m_cmdOk
End Get
End Property
Public Sub Table(ByVal param As Object)
Private Sub Ok(ByVal param As Object)
' recupero l'indice della tavola impostata
For Each ItemTab As TableToChange In CurrTableList
If ItemTab.IsActive Then
m_nSelectedTable = ItemTab.nIndex
Exit For
End If
Next
' procedo alla chiusura della finetra
RaiseEvent m_CloseWindow(CInt(param))
End Sub
#End Region ' DrawCommand
#End Region ' OkCommand
#End Region ' COMMANDS