Compare commits

...

1 Commits

Author SHA1 Message Date
Demetrio Cassarino eec592c782 -aggiunto gestione lampadina su operazione selezionta
-aggiunto info note
2025-04-03 14:26:07 +02:00
11 changed files with 247 additions and 180 deletions
+3
View File
@@ -1038,6 +1038,9 @@
<ItemGroup> <ItemGroup>
<Resource Include="Resources\DrawPanel\StmMoveVertex.png" /> <Resource Include="Resources\DrawPanel\StmMoveVertex.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Resources\TreeView\LampSel.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtCAM5\EgtCAM5R32.exe <PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtCAM5\EgtCAM5R32.exe
@@ -25,7 +25,7 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBox x:Name="Txt" Text="{Binding TextBox,UpdateSourceTrigger=PropertyChanged}" <TextBox x:Name="Txt" Text="{Binding TextBox,UpdateSourceTrigger=PropertyChanged}"
PreviewKeyDown="TextBox_PreviewKeyDown" Height="Auto" PreviewKeyDown="TextBox_PreviewKeyDown" Height="Auto"
Visibility="{Binding TextVisibility}" Margin="5,0,5,5" > Visibility="{Binding TextVisibility}" Margin="5,0,5,5">
<TextBox.InputBindings> <TextBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding DoneCommand}"/> <KeyBinding Key="Enter" Command="{Binding DoneCommand}"/>
<KeyBinding Key="S" Modifiers="Control" Command="{Binding ShowCommand}"/> <KeyBinding Key="S" Modifiers="Control" Command="{Binding ShowCommand}"/>
@@ -34,49 +34,54 @@
<Button Grid.Column="1" <Button Grid.Column="1"
Content="+" Content="+"
Command="{Binding ShowInfoItemCommand}" Command="{Binding ShowInfoItemCommand}"
Visibility="Collapsed" Visibility="{Binding ShowInfoItemVisibility}"
Width="20" Width="20"
Height="20" Height="20"
Margin="5,-1,5,0" Margin="5,-1,5,0"
VerticalAlignment="Top"/> VerticalAlignment="Top"/>
<!--Visibility="{Binding ShowInfoItemVisibility}"-->
</Grid> </Grid>
<CheckBox Content="{Binding CheckBoxText}" IsChecked="{Binding IsChecked}" <CheckBox Content="{Binding CheckBoxText}" IsChecked="{Binding IsChecked}"
Visibility="{Binding CheckVisibility}" Margin="5,0,5,5"/> Visibility="{Binding CheckVisibility}" Margin="5,0,5,5"/>
<ComboBox ItemsSource="{Binding ComboItemsList}" SelectedIndex="{Binding ComboSelectedIndex}" <ComboBox ItemsSource="{Binding ComboItemsList}" SelectedIndex="{Binding ComboSelectedIndex}"
Visibility="{Binding ComboVisibility}" Margin="5,5,5,5"/> Visibility="{Binding ComboVisibility}" Margin="5,5,5,5"/>
<ItemsControl ItemsSource="{Binding InfoList}" <ScrollViewer HorizontalScrollBarVisibility="Auto"
Visibility="{Binding InfoVisibility}" VerticalScrollBarVisibility="Auto"
Margin="5,5,0,10"> MaxHeight="190"
<ItemsControl.ItemTemplate> Margin="2,5,0,10">
<DataTemplate> <ItemsControl ItemsSource="{Binding InfoList}"
<Grid> Visibility="{Binding InfoVisibility}">
<Grid.ColumnDefinitions> <ItemsControl.ItemTemplate>
<ColumnDefinition Width="Auto"/> <DataTemplate>
<ColumnDefinition Width="1*"/> <Grid>
<ColumnDefinition Width="Auto"/> <Grid.ColumnDefinitions>
</Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/>
<TextBlock Text="{Binding Key}" <ColumnDefinition Width="1*"/>
Width="70" <ColumnDefinition Width="Auto"/>
Margin="0,6,-15,0"/> </Grid.ColumnDefinitions>
<TextBox Grid.Column="1" <TextBlock Text="{Binding Key}"
Text="{Binding Valour, UpdateSourceTrigger=PropertyChanged}" ToolTip="{Binding Key}"
Margin="0,5,5,10"> Width="70"
<TextBox.InputBindings> HorizontalAlignment="Left"
<KeyBinding Key="Enter" Command="{Binding DoneInfoCommand}"/> Margin="0,6,0,0"/>
</TextBox.InputBindings> <TextBox Grid.Column="1"
</TextBox> Text="{Binding Valour, UpdateSourceTrigger=PropertyChanged}"
<Button Grid.Column="2" Margin="8,5,2,10">
Content="-" <TextBox.InputBindings>
Command="{Binding RemoveInfoItemCommand}" <KeyBinding Key="Enter" Command="{Binding DoneInfoCommand}"/>
Width="20" </TextBox.InputBindings>
Height="20" </TextBox>
Margin="5,-2,5,5"/> <Button Grid.Column="2"
</Grid> Content="-"
</DataTemplate> Command="{Binding RemoveInfoItemCommand}"
</ItemsControl.ItemTemplate> Width="20"
</ItemsControl> Height="20"
Margin="2,-2,4,5"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<Grid Margin="5,0,5,5"> <Grid Margin="5,0,5,5">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@@ -1,6 +1,5 @@
Imports System.Collections.ObjectModel Imports System.Collections.ObjectModel
Imports EgtUILib Imports EgtUILib
Imports MS.Internal
Public Class InputExpanderVM Public Class InputExpanderVM
Inherits ViewModelBase Inherits ViewModelBase
@@ -20,7 +19,7 @@ Public Class InputExpanderVM
End Get End Get
Set(value As ObservableCollection(Of InfoItem)) Set(value As ObservableCollection(Of InfoItem))
m_tmpInfoList = value m_tmpInfoList = value
OnPropertyChanged("tmpInfoList") OnPropertyChanged(NameOf(tmpInfoList))
End Set End Set
End Property End Property
@@ -32,7 +31,7 @@ Public Class InputExpanderVM
End Get End Get
Set(value As Boolean) Set(value As Boolean)
m_IsExpanded = value m_IsExpanded = value
OnPropertyChanged("IsExpanded") OnPropertyChanged(NameOf(IsExpanded))
End Set End Set
End Property End Property
@@ -43,7 +42,7 @@ Public Class InputExpanderVM
End Get End Get
Set(value As Boolean) Set(value As Boolean)
m_IsEnabled = value m_IsEnabled = value
OnPropertyChanged("IsEnabled") OnPropertyChanged(NameOf(IsEnabled))
End Set End Set
End Property End Property
@@ -54,7 +53,7 @@ Public Class InputExpanderVM
End Get End Get
Set(value As String) Set(value As String)
m_Title = value m_Title = value
OnPropertyChanged("Title") OnPropertyChanged(NameOf(Title))
End Set End Set
End Property End Property
@@ -66,7 +65,7 @@ Public Class InputExpanderVM
End Get End Get
Set(value As String) Set(value As String)
m_TextBlock = value m_TextBlock = value
OnPropertyChanged("TextBlock") OnPropertyChanged(NameOf(TextBlock))
End Set End Set
End Property End Property
@@ -79,7 +78,7 @@ Public Class InputExpanderVM
Set(value As String) Set(value As String)
m_TextBox = value m_TextBox = value
Map.refProjectVM.NotifyInputText(value) Map.refProjectVM.NotifyInputText(value)
OnPropertyChanged("TextBox") OnPropertyChanged(NameOf(TextBox))
End Set End Set
End Property End Property
@@ -91,7 +90,7 @@ Public Class InputExpanderVM
Set(value As Visibility) Set(value As Visibility)
If value <> m_TextVisibility Then If value <> m_TextVisibility Then
m_TextVisibility = value m_TextVisibility = value
OnPropertyChanged("TextVisibility") OnPropertyChanged(NameOf(TextVisibility))
End If End If
End Set End Set
End Property End Property
@@ -103,7 +102,7 @@ Public Class InputExpanderVM
End Get End Get
Set(value As Boolean) Set(value As Boolean)
m_FocusTextBox = value m_FocusTextBox = value
OnPropertyChanged("FocusTextBox") OnPropertyChanged(NameOf(FocusTextBox))
End Set End Set
End Property End Property
@@ -115,7 +114,7 @@ Public Class InputExpanderVM
End Get End Get
Set(value As String) Set(value As String)
m_CheckBoxText = value m_CheckBoxText = value
OnPropertyChanged("CheckBoxText") OnPropertyChanged(NameOf(CheckBoxText))
End Set End Set
End Property End Property
@@ -128,7 +127,7 @@ Public Class InputExpanderVM
If value <> m_IsChecked Then If value <> m_IsChecked Then
Map.refProjectVM.SetLastBoolean(value) Map.refProjectVM.SetLastBoolean(value)
m_IsChecked = value m_IsChecked = value
OnPropertyChanged("IsChecked") OnPropertyChanged(NameOf(IsChecked))
End If End If
End Set End Set
End Property End Property
@@ -141,7 +140,7 @@ Public Class InputExpanderVM
Set(value As Visibility) Set(value As Visibility)
If value <> m_CheckVisibility Then If value <> m_CheckVisibility Then
m_CheckVisibility = value m_CheckVisibility = value
OnPropertyChanged("CheckVisibility") OnPropertyChanged(NameOf(CheckVisibility))
End If End If
End Set End Set
End Property End Property
@@ -154,7 +153,7 @@ Public Class InputExpanderVM
End Get End Get
Set(value As ObservableCollection(Of String)) Set(value As ObservableCollection(Of String))
m_ComboItemsList = value m_ComboItemsList = value
OnPropertyChanged("ComboItemsList") OnPropertyChanged(NameOf(ComboItemsList))
End Set End Set
End Property End Property
@@ -168,11 +167,11 @@ Public Class InputExpanderVM
End Get End Get
Set(value As ObservableCollection(Of InfoItem)) Set(value As ObservableCollection(Of InfoItem))
m_InfoList = value m_InfoList = value
OnPropertyChanged("InfoList") OnPropertyChanged(NameOf(InfoList))
End Set End Set
End Property End Property
Private m_ComboSelectedIndex As Integer Private m_ComboSelectedIndex As Integer = GDB_ID.NULL
Public Property ComboSelectedIndex As Integer Public Property ComboSelectedIndex As Integer
Get Get
Return m_ComboSelectedIndex Return m_ComboSelectedIndex
@@ -187,7 +186,7 @@ Public Class InputExpanderVM
' Controllo se la info è contenuta nella lista ComboItemsList ' Controllo se la info è contenuta nella lista ComboItemsList
If ComboItemsList.Contains(tmpInfoList(m_ComboSelectedIndex).sKey) Then If ComboItemsList.Contains(tmpInfoList(m_ComboSelectedIndex).sKey) Then
' Aggiungo la info alla lista per visualizzarla ' Aggiungo la info alla lista per visualizzarla
InfoList.Add(New InfoItem(tmpInfoList(m_ComboSelectedIndex).nId, tmpInfoList(m_ComboSelectedIndex).sKey, m_tmpInfoList(m_ComboSelectedIndex).sValour)) InfoList.Add(New InfoItem(tmpInfoList(m_ComboSelectedIndex).nId, tmpInfoList(m_ComboSelectedIndex).sKey, tmpInfoList(m_ComboSelectedIndex).sValour))
' Nascondo la combobox ' Nascondo la combobox
ComboVisibility = Visibility.Collapsed ComboVisibility = Visibility.Collapsed
' Rimuovo la info dalla ComboItemsList ' Rimuovo la info dalla ComboItemsList
@@ -196,9 +195,12 @@ Public Class InputExpanderVM
' Rimuovo la info dalla tmpInfoList ' Rimuovo la info dalla tmpInfoList
tmpInfoList.Remove(tmpInfoList(tmpComboSelectedIndex)) tmpInfoList.Remove(tmpInfoList(tmpComboSelectedIndex))
End If End If
OnPropertyChanged("ComboSelectedIndex") ' Rendo invisibile il pulsante per attivare la combo
OnPropertyChanged("ComboItemsList") If ComboItemsList.Count <= 0 Then ShowInfoItemVisibility = Visibility.Collapsed
OnPropertyChanged("InfoList") m_ComboSelectedIndex = GDB_ID.NULL
OnPropertyChanged(NameOf(ComboSelectedIndex))
OnPropertyChanged(NameOf(ComboItemsList))
OnPropertyChanged(NameOf(InfoList))
End Set End Set
End Property End Property
@@ -210,7 +212,7 @@ Public Class InputExpanderVM
Set(value As Visibility) Set(value As Visibility)
If value <> m_ComboVisibility Then If value <> m_ComboVisibility Then
m_ComboVisibility = value m_ComboVisibility = value
OnPropertyChanged("ComboVisibility") OnPropertyChanged(NameOf(ComboVisibility))
End If End If
End Set End Set
End Property End Property
@@ -223,7 +225,7 @@ Public Class InputExpanderVM
End Get End Get
Set(value As Visibility) Set(value As Visibility)
m_ShowBtnVisibility = value m_ShowBtnVisibility = value
OnPropertyChanged("ShowBtnVisibility") OnPropertyChanged(NameOf(ShowBtnVisibility))
End Set End Set
End Property End Property
@@ -238,7 +240,7 @@ Public Class InputExpanderVM
Set(value As Visibility) Set(value As Visibility)
If value <> m_ShowInfoItemVisibility Then If value <> m_ShowInfoItemVisibility Then
m_ShowInfoItemVisibility = value m_ShowInfoItemVisibility = value
OnPropertyChanged("ShowInfoItemVisibility") OnPropertyChanged(NameOf(ShowInfoItemVisibility))
End If End If
End Set End Set
End Property End Property
@@ -254,7 +256,7 @@ Public Class InputExpanderVM
Set(value As Visibility) Set(value As Visibility)
If value <> m_InfoVisibility Then If value <> m_InfoVisibility Then
m_InfoVisibility = value m_InfoVisibility = value
OnPropertyChanged("InfoVisibility") OnPropertyChanged(NameOf(InfoVisibility))
End If End If
End Set End Set
End Property End Property
@@ -350,7 +352,9 @@ Public Class InputExpanderVM
m_TextBox &= vbCrLf & (Item.Key & "=" & Item.Valour).Trim() & vbCrLf m_TextBox &= vbCrLf & (Item.Key & "=" & Item.Valour).Trim() & vbCrLf
Next Next
End If End If
Map.refProjectVM.Done(m_TextBox) ' Rimuovo eventuali spazi
Dim tmpTextBox As String = m_TextBox.Replace(" ", "")
Map.refProjectVM.Done(tmpTextBox)
End Sub End Sub
''' <summary> ''' <summary>
@@ -400,8 +404,6 @@ Public Class InputExpanderVM
If Title = EgtMsg(5359).ToUpper() Then If Title = EgtMsg(5359).ToUpper() Then
' Metto tmpbShow a false ' Metto tmpbShow a false
m_tmpbShow = False m_tmpbShow = False
' Rendo visibile il pulsante che mostra la lista delle info
ShowInfoItemVisibility = Visibility.Visible
' Rendo visibile la lista delle info selezionate ' Rendo visibile la lista delle info selezionate
InfoVisibility = Visibility.Visible InfoVisibility = Visibility.Visible
' Pulisco la lista tmpInfoList ' Pulisco la lista tmpInfoList
@@ -410,8 +412,10 @@ Public Class InputExpanderVM
InfoList.Clear() InfoList.Clear()
' Pulisco la lista ComboItemsList ' Pulisco la lista ComboItemsList
ComboItemsList.Clear() ComboItemsList.Clear()
' Popolo la lista ComboItemsList ' Popolo la lista InfoList
ComboInfo() GetInfoList()
' Rendo visibile il pulsante che mostra la lista delle info
ShowInfoItemVisibility = If(m_ComboItemsList.Count > 0, Visibility.Visible, Visibility.Collapsed)
End If End If
End If End If
If PrepareInputBoxParam.sCheckLabel <> "" Then If PrepareInputBoxParam.sCheckLabel <> "" Then
@@ -490,22 +494,20 @@ Public Class InputExpanderVM
ComboItemsList.Add(InfoItem.sKey) ComboItemsList.Add(InfoItem.sKey)
' Riaggiungo la info eliminata ' Riaggiungo la info eliminata
tmpInfoList.Add(InfoItem) tmpInfoList.Add(InfoItem)
' Rendo visibile il pulsante per attivare la combo
ShowInfoItemVisibility = Visibility.Visible
End Sub End Sub
''' <summary> Private Sub GetInfoList()
''' Funzione che popola la lista ComboItemsList Dim tmpInfoList As String() = Nothing
''' </summary> Dim sKeyVal() As String = Nothing
Private Sub ComboInfo() Dim Index As Integer = 0
'''''''''''''''''''''''''''''' Recuperare funzione egtgetallinfo quando sarà pronta EgtGetAllInfo(Map.refManageLayerExpanderVM.m_nObjTreeOldId, tmpInfoList)
Dim val As Integer If Not IsNothing(tmpInfoList) Then
If Not m_tmpbShow Then For Each ItemInfo As String In tmpInfoList
For Ind As Integer = 0 To 6 sKeyVal = ItemInfo.Trim().Split(New Char() {"="c})
val += Ind InfoList.Add(New InfoItem(Index, sKeyVal(0), sKeyVal(1)))
tmpInfoList.Add(New InfoItem(Ind, "A" & +Ind, val.ToString())) Index += 1
Next
For Each InfoItem As InfoItem In tmpInfoList
ComboItemsList.Add(InfoItem.sKey)
Next Next
End If End If
End Sub End Sub
@@ -103,6 +103,7 @@ Public Class LayerTreeViewItem
EgtDraw() EgtDraw()
End If End If
End If End If
Map.refProjectVM.EmitTitle()
End Set End Set
End Property End Property
@@ -5,54 +5,28 @@ Public Class DispositionOpListBoxItem
Public Property StatusAll As Boolean? Public Property StatusAll As Boolean?
Get Get
' Recupero gli indici delle operazioni della Disposizione corrente ' Ottieni gli indici delle operazioni e calcola il valore aggregato
Dim OpIndexes As List(Of Integer) = GetOpIndexes() Return GetUnifiedStatus(Function(item) item.Status)
' Ritorno il valore specificato in base agli stati delle operazioni di cui abbiamo raccolto gli indici
If OpIndexes.Count = 0 Then Return False
Dim bTemp As Boolean = DirectCast(Map.refOperationsListExpanderVM.OperationList.Item(OpIndexes(0)), MachiningOpListBoxItem).Status
For OpInDispIndex = 1 To OpIndexes.Count - 1
If DirectCast(Map.refOperationsListExpanderVM.OperationList.Item(OpIndexes(OpInDispIndex)), MachiningOpListBoxItem).Status <> bTemp Then Return Nothing
Next
Return bTemp
End Get End Get
Set(value As Boolean?) Set(value As Boolean?)
' Recupero gli indici delle operazioni della Disposizione corrente ' Aggiorna lo stato delle operazioni
Dim OpIndexes As List(Of Integer) = GetOpIndexes() UpdateAllStatus(value, Sub(item, val) item.Status = CBool(val))
If OpIndexes.Count = 0 Then NotifyPropertyChanged(NameOf(StatusAll))
NotifyPropertyChanged(NameOf(StatusAll))
Return
End If
For Each OpInDispIndex In OpIndexes
DirectCast(Map.refOperationsListExpanderVM.OperationList.Item(OpInDispIndex), MachiningOpListBoxItem).Status = If(IsNothing(value), False, CBool(value))
Next
End Set End Set
End Property End Property
Public Property OnOffAll As Boolean? Public Property OnOffAll As Boolean?
Get Get
Dim OpIndexes As List(Of Integer) = GetOpIndexes() ' Ottieni gli indici delle operazioni e calcola il valore aggregato
' Ritorno il valore specificato in base agli stati delle operazioni di cui abbiamo raccolto gli indici Return GetUnifiedStatus(Function(item) item.OnOff)
If OpIndexes.Count = 0 Then Return False
Dim bTemp As Boolean = DirectCast(Map.refOperationsListExpanderVM.OperationList.Item(OpIndexes(0)), MachiningOpListBoxItem).OnOff
For OpInDispIndex = 1 To OpIndexes.Count - 1
If DirectCast(Map.refOperationsListExpanderVM.OperationList.Item(OpIndexes(OpInDispIndex)), MachiningOpListBoxItem).OnOff <> bTemp Then Return Nothing
Next
Return bTemp
End Get End Get
Set(value As Boolean?) Set(value As Boolean?)
' Recupero gli indici delle operazioni della Disposizione corrente ' Aggiorna lo stato delle operazioni
Dim OpIndexes As List(Of Integer) = GetOpIndexes() UpdateAllStatus(value, Sub(item, val) item.OnOff = val)
If OpIndexes.Count = 0 Then NotifyPropertyChanged(NameOf(OnOffAll))
NotifyPropertyChanged(NameOf(OnOffAll))
Return
End If
For Each OpInDispIndex In OpIndexes
DirectCast(Map.refOperationsListExpanderVM.OperationList.Item(OpInDispIndex), MachiningOpListBoxItem).OnOff = If(IsNothing(value), False, CBool(value))
Next
End Set End Set
End Property End Property
Private m_Image As String = String.Empty Private m_Image As String = String.Empty
Public Property Image As String Public Property Image As String
Get Get
@@ -78,6 +52,7 @@ Public Class DispositionOpListBoxItem
Exit For Exit For
End If End If
Next Next
' Inserisco in una lista gli indici delle operazioni della Disposizione (a partire dunque dall'indice trovato) ' Inserisco in una lista gli indici delle operazioni della Disposizione (a partire dunque dall'indice trovato)
Dim OpIndexes As New List(Of Integer)() Dim OpIndexes As New List(Of Integer)()
Dim OpIndex As Integer = DispIndex + 1 Dim OpIndex As Integer = DispIndex + 1
@@ -89,4 +64,28 @@ Public Class DispositionOpListBoxItem
Return OpIndexes Return OpIndexes
End Function End Function
' Metodo per calcolare il valore aggregato (Checked/Unchecked/Indeterminate)
Private Function GetUnifiedStatus(getStatus As Func(Of MachiningOpListBoxItem, Boolean?)) As Boolean?
Dim OpIndexes As List(Of Integer) = GetOpIndexes()
If OpIndexes.Count = 0 Then Return False
Dim firstStatus = getStatus(DirectCast(Map.refOperationsListExpanderVM.OperationList.Item(OpIndexes(0)), MachiningOpListBoxItem))
For Each index In OpIndexes.Skip(1)
Dim currentStatus = getStatus(DirectCast(Map.refOperationsListExpanderVM.OperationList.Item(index), MachiningOpListBoxItem))
If currentStatus <> firstStatus Then Return Nothing
Next
Return firstStatus
End Function
' Metodo per aggiornare lo stato di tutte le operazioni
Private Sub UpdateAllStatus(value As Boolean?, updateStatus As Action(Of MachiningOpListBoxItem, Boolean?))
Dim OpIndexes As List(Of Integer) = GetOpIndexes()
If OpIndexes.Count = 0 Then Return
For Each index In OpIndexes
Dim item = DirectCast(Map.refOperationsListExpanderVM.OperationList.Item(index), MachiningOpListBoxItem)
updateStatus(item, If(IsNothing(value), False, CBool(value)))
Next
End Sub
End Class End Class
@@ -1,5 +1,4 @@
Imports System.Collections.ObjectModel Imports EgtUILib
Imports EgtUILib
Public Class MachiningOpListBoxItem Public Class MachiningOpListBoxItem
Inherits OperationListBoxItem Inherits OperationListBoxItem
@@ -27,11 +26,29 @@ Public Class MachiningOpListBoxItem
End If End If
OpIndex += 1 OpIndex += 1
Next Next
' Se Operazione selezionata metto la lampadina in stato false
For Each tmpItem As MachiningOpListBoxItem In Map.refOperationsListExpanderVM.tmpOperationList
If tmpItem.Id = Id Then
If tmpItem.OnOff Then
EgtSetStatus(tmpItem.Id, GDB_ST.OFF)
tmpItem.m_bThreeState = False
tmpItem.OnOff = False
Exit For
Else
EgtSetStatus(tmpItem.Id, GDB_ST.ON_)
tmpItem.OnOff = True
Exit For
End If
End If
Next
' Notifico StatusAll per calcolare lo stato della CheckBox della Disposizione ' Notifico StatusAll per calcolare lo stato della CheckBox della Disposizione
Map.refOperationsListExpanderVM.OperationList(DispIndex).NotifyPropertyChanged(NameOf(DispositionOpListBoxItem.StatusAll)) Map.refOperationsListExpanderVM.OperationList(DispIndex).NotifyPropertyChanged(NameOf(DispositionOpListBoxItem.StatusAll))
EgtSetOperationMode(Id, m_Status) EgtSetOperationMode(Id, m_Status)
EgtDraw() EgtDraw()
End If End If
Map.refProjectVM.EmitTitle()
NotifyPropertyChanged(NameOf(Status)) NotifyPropertyChanged(NameOf(Status))
End If End If
End Set End Set
@@ -100,10 +117,10 @@ Public Class MachiningOpListBoxItem
RaiseEvent m_ModifyNameGetFocus() RaiseEvent m_ModifyNameGetFocus()
' se esco da modifica ' se esco da modifica
End If End If
NotifyPropertyChanged("ModifiedName") NotifyPropertyChanged(NameOf(ModifiedName))
NotifyPropertyChanged("Name") NotifyPropertyChanged(NameOf(Name))
NotifyPropertyChanged("Name_Visibility") NotifyPropertyChanged(NameOf(Name_Visibility))
NotifyPropertyChanged("ModifyName_Visibility") NotifyPropertyChanged(NameOf(ModifyName_Visibility))
End Set End Set
End Property End Property
@@ -125,27 +142,31 @@ Public Class MachiningOpListBoxItem
End Get End Get
End Property End Property
Public m_bThreeState As Boolean = False
Private m_bOnOff As Boolean = True Private m_bOnOff As Boolean? = True
Public Property OnOff As Boolean Public Property OnOff As Boolean?
Get Get
Return m_bOnOff Return m_bOnOff
End Get End Get
Set(value As Boolean) Set(value As Boolean?)
If m_bOnOff <> value Then ' Controllo se la lampadina è messa in stato Nothing e value e false
m_bOnOff = value m_bOnOff = If(m_bThreeState AndAlso Not value, True, value)
Dim bOldEnMod As Boolean = EgtGetEnableModified() Dim bOldEnMod As Boolean = EgtGetEnableModified()
EgtDisableModified() EgtDisableModified()
' se abilitato, eseguo operazione ' se abilitato, eseguo operazione
Dim status As Integer = GDB_ST.OFF Dim status As Integer = GDB_ST.OFF
If value Then ' Controllo se lo stato della lampadina è true o nullo
status = GDB_ST.ON_ If m_bOnOff OrElse IsNothing(m_bOnOff) Then
End If status = GDB_ST.ON_
ModifyStatusLamp()
EgtSetStatus(Id, status)
If bOldEnMod Then EgtEnableModified()
EgtDraw()
End If End If
' Modifica lo stato della checkbox all delle lampadine
ModifyStatusLamp()
' Setto lo stato della lampadina
EgtSetStatus(Id, status)
If bOldEnMod Then EgtEnableModified()
If Map.refOperationsListExpanderVM.ForceDrawInIsSelected Then EgtDraw()
m_bThreeState = False
Map.refProjectVM.EmitTitle()
NotifyPropertyChanged(NameOf(OnOff)) NotifyPropertyChanged(NameOf(OnOff))
End Set End Set
End Property End Property
@@ -250,7 +271,7 @@ Public Class MachiningOpListBoxItem
m_CloseModifyLostFocus = False m_CloseModifyLostFocus = False
MessageBox.Show(EgtMsg(MSG_OPERATION + 22), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Warning) MessageBox.Show(EgtMsg(MSG_OPERATION + 22), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Warning)
m_IsActive_ModifyName = True m_IsActive_ModifyName = True
NotifyPropertyChanged("ModifyName_Visibility") NotifyPropertyChanged(NameOf(ModifyName_Visibility))
m_Spy = True m_Spy = True
Return Return
End If End If
@@ -36,7 +36,7 @@ Public Class OperationListBoxItem
Set(value As Boolean) Set(value As Boolean)
If Not IsNothing(value) Then If Not IsNothing(value) Then
Dim indexes As List(Of OperationListBoxItem) = New List(Of OperationListBoxItem) Dim indexes As New List(Of OperationListBoxItem)
Dim Count As Integer = 0 Dim Count As Integer = 0
For Each OperationListBoxItem In Map.refOperationsListExpanderVM.OperationList For Each OperationListBoxItem In Map.refOperationsListExpanderVM.OperationList
If OperationListBoxItem.IsSelected And OperationListBoxItem.Id <> m_Id Then If OperationListBoxItem.IsSelected And OperationListBoxItem.Id <> m_Id Then
@@ -45,6 +45,23 @@ Public Class OperationListBoxItem
End If End If
Next Next
' Se Operazione selezionata metto la lampadina in stato Nothing
For Each tmpItem As MachiningOpListBoxItem In Map.refOperationsListExpanderVM.tmpOperationList
If tmpItem.Id = Id Then
If IsNothing(tmpItem.OnOff) Then
EgtSetStatus(tmpItem.Id, GDB_ST.OFF)
tmpItem.m_bThreeState = False
tmpItem.OnOff = False
Exit For
ElseIf Not tmpitem.OnOff AndAlso Not m_IsSelected Then
EgtSetStatus(tmpItem.Id, GDB_ST.SEL)
tmpItem.OnOff = Nothing
tmpItem.m_bThreeState = True
Exit For
End If
End If
Next
If indexes.Count > 0 Then If indexes.Count > 0 Then
If EgtGetOperationPhase(Id) <> EgtGetOperationPhase(indexes(0).Id) Then If EgtGetOperationPhase(Id) <> EgtGetOperationPhase(indexes(0).Id) Then
Return Return
@@ -72,7 +89,7 @@ Public Class OperationListBoxItem
Map.refOperationsListExpanderVM.OnPropertyChanged("MoveUp_IsEnabled") Map.refOperationsListExpanderVM.OnPropertyChanged("MoveUp_IsEnabled")
Map.refOperationsListExpanderVM.OnPropertyChanged("MoveDown_IsEnabled") Map.refOperationsListExpanderVM.OnPropertyChanged("MoveDown_IsEnabled")
NotifyPropertyChanged("IsSelected") NotifyPropertyChanged(NameOf(IsSelected))
' Aggiorno visualizzazione ' Aggiorno visualizzazione
If Map.refOperationsListExpanderVM.ForceDrawInIsSelected Then EgtDraw() If Map.refOperationsListExpanderVM.ForceDrawInIsSelected Then EgtDraw()
Return Return
@@ -136,7 +153,7 @@ Public Class OperationListBoxItem
Map.refOperationsListExpanderVM.OnPropertyChanged("DuplicateCmd_IsEnabled") Map.refOperationsListExpanderVM.OnPropertyChanged("DuplicateCmd_IsEnabled")
Map.refOperationsListExpanderVM.OnPropertyChanged("MachToDb_IsEnabled") Map.refOperationsListExpanderVM.OnPropertyChanged("MachToDb_IsEnabled")
Map.refOperationsListExpanderVM.OnPropertyChanged("Rename_IsEnabled") Map.refOperationsListExpanderVM.OnPropertyChanged("Rename_IsEnabled")
NotifyPropertyChanged("IsSelected") NotifyPropertyChanged(NameOf(IsSelected))
End Set End Set
End Property End Property
@@ -1,10 +1,10 @@
<UserControl x:Class="OperationsListExpanderV" <UserControl x:Class="OperationsListExpanderV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:EgtCAM5="clr-namespace:EgtCAM5" xmlns:EgtCAM5="clr-namespace:EgtCAM5"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"> xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5">
<StackPanel Name="OperationsListExpanderViewStackPanel" IsEnabled="{Binding OpersListViewIsEnabled}"> <StackPanel Name="OperationsListExpanderViewStackPanel" IsEnabled="{Binding OpersListViewIsEnabled}">
@@ -27,9 +27,9 @@
<DataTemplate DataType="{x:Type EgtCAM5:MachiningOpListBoxItem}"> <DataTemplate DataType="{x:Type EgtCAM5:MachiningOpListBoxItem}">
<DataTemplate.Resources> <DataTemplate.Resources>
<Style x:Key="LayoutRoot" TargetType="Grid"> <Style x:Key="LayoutRoot" TargetType="Grid">
<!--<Style.Triggers> <!--<Style.Triggers>-->
--><!--these are the triggers that make the code cursor jump from box 1 to box 2 to box 3.--><!-- <!--these are the triggers that make the code cursor jump from box 1 to box 2 to box 3.-->
<DataTrigger Binding="{Binding ElementName=Box, Path=Visibility}" Value="Visible"> <!--<DataTrigger Binding="{Binding ElementName=Box, Path=Visibility}" Value="Visible">
<Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=Box}"/> <Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=Box}"/>
</DataTrigger> </DataTrigger>
</Style.Triggers>--> </Style.Triggers>-->
@@ -38,8 +38,8 @@
<Border Background="Transparent"> <Border Background="Transparent">
<Border.InputBindings> <Border.InputBindings>
<MouseBinding MouseAction="LeftDoubleClick" <MouseBinding MouseAction="LeftDoubleClick"
Command="{Binding DataContext.OperationListDoubleClickCommand, RelativeSource={RelativeSource AncestorType={x:Type EgtCAM5:OperationsListExpanderV}}}" Command="{Binding DataContext.OperationListDoubleClickCommand, RelativeSource={RelativeSource AncestorType={x:Type EgtCAM5:OperationsListExpanderV}}}"
CommandParameter="{Binding Id}"/> CommandParameter="{Binding Id}"/>
</Border.InputBindings> </Border.InputBindings>
<Grid Style="{StaticResource LayoutRoot}"> <Grid Style="{StaticResource LayoutRoot}">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@@ -51,9 +51,10 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<CheckBox IsChecked="{Binding Status}" Margin="0,0,5,0"/> <CheckBox IsChecked="{Binding Status}" Margin="0,0,5,0"/>
<Image Source="{Binding Image}" Height="15" Margin="0,0,5,0"/> <Image Source="{Binding Image}" Height="15" Margin="0,0,5,0"/>
<ToggleButton Style="{StaticResource EgtCAM5_LampToggleButton}" Grid.Column="1" <!--<ToggleButton Style="{StaticResource EgtCAM5_LampToggleButton}" Grid.Column="1"
IsChecked="{Binding OnOff}" Visibility="{Binding IsHidden}" Focusable="True" Height="15" Width="15" Margin="0,0,5,0"/> IsChecked="{Binding OnOff}" Visibility="{Binding IsHidden}" Focusable="True" Height="15" Width="15" Margin="0,0,5,0"/>-->
<CheckBox Style="{StaticResource EgtCAM5_LampToggleButton}" Grid.Column="1"
IsChecked="{Binding OnOff}" Height="15" Width="15" Margin="0,0,5,0"/>
<TextBlock Grid.Column="2" Text="{Binding Name}" <TextBlock Grid.Column="2" Text="{Binding Name}"
Visibility="{Binding Name_Visibility}" Margin="0,0,5,0"/> Visibility="{Binding Name_Visibility}" Margin="0,0,5,0"/>
<TextBox Grid.Column="2" Text="{Binding ModifiedName, UpdateSourceTrigger=PropertyChanged}" <TextBox Grid.Column="2" Text="{Binding ModifiedName, UpdateSourceTrigger=PropertyChanged}"
@@ -75,17 +76,17 @@
<Border CornerRadius="1" Background="{StaticResource EgaltechBlue3}"> <Border CornerRadius="1" Background="{StaticResource EgaltechBlue3}">
<Border.InputBindings> <Border.InputBindings>
<MouseBinding MouseAction="LeftDoubleClick" <MouseBinding MouseAction="LeftDoubleClick"
Command="{Binding DataContext.OperationListDoubleClickCommand, RelativeSource={RelativeSource AncestorType={x:Type EgtCAM5:OperationsListExpanderV}}}" Command="{Binding DataContext.OperationListDoubleClickCommand, RelativeSource={RelativeSource AncestorType={x:Type EgtCAM5:OperationsListExpanderV}}}"
CommandParameter="{Binding Id}"/> CommandParameter="{Binding Id}"/>
</Border.InputBindings> </Border.InputBindings>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding StatusAll}" VerticalAlignment="Center" Margin="0,0,5,0"/> <CheckBox IsChecked="{Binding StatusAll}" VerticalAlignment="Center" Margin="0,0,5,0"/>
<CheckBox IsChecked="{Binding OnOffAll}" VerticalAlignment="Center" Margin="0,0,5,0"/> <CheckBox IsChecked="{Binding OnOffAll}" Style="{StaticResource EgtCAM5_LampToggleButton}" Height="15" Width="15" VerticalAlignment="Center" Margin="0,0,5,0"/>
<!--<ToggleButton Style="{StaticResource EgtCAM5_LampToggleButton}" <!--<ToggleButton Style="{StaticResource EgtCAM5_LampToggleButton}"
IsChecked="{Binding OnOffAll}" Visibility="{Binding IsHidden}" Focusable="True" Height="15" Width="15" Margin="0,0,5,0"/>--> IsChecked="{Binding OnOffAll}" Visibility="{Binding IsHidden}" Focusable="True" Height="15" Width="15" Margin="0,0,5,0"/>-->
<Image Source="{Binding Image}" Height="15" Margin="0,0,5,0"/> <Image Source="{Binding Image}" Height="15" Margin="0,0,5,0"/>
<TextBlock Text="{Binding Name}" Foreground="White" <TextBlock Text="{Binding Name}" Foreground="White"
FontSize="15" FontWeight="SemiBold"/> FontSize="15" FontWeight="SemiBold"/>
</StackPanel> </StackPanel>
</Border> </Border>
</DataTemplate> </DataTemplate>
@@ -1330,6 +1330,7 @@ Public Class StatusLamp
#Region "FIELDS & PROPERTIES" #Region "FIELDS & PROPERTIES"
' Id dell'operazione
Private m_nId As Integer Private m_nId As Integer
Public Property nId As Integer Public Property nId As Integer
Get Get
@@ -1340,12 +1341,13 @@ Public Class StatusLamp
End Set End Set
End Property End Property
Private m_bStatusLamp As Boolean ' Stato della lampadina: vero, falso e nullo
Public Property bStatusLamp As Boolean Private m_bStatusLamp As Boolean?
Public Property bStatusLamp As Boolean?
Get Get
Return m_bStatusLamp Return m_bStatusLamp
End Get End Get
Set(value As Boolean) Set(value? As Boolean)
m_bStatusLamp = value m_bStatusLamp = value
End Set End Set
End Property End Property
@@ -1354,38 +1356,50 @@ Public Class StatusLamp
#Region "CONSTRUCTOR" #Region "CONSTRUCTOR"
Sub New(nId As Integer, bStatusLamp As Boolean) Sub New(nId As Integer, bStatusLamp As Boolean?)
m_nId = nId m_nId = nId
m_bStatusLamp = bStatusLamp m_bStatusLamp = bStatusLamp
End Sub End Sub
Sub New() Sub New()
End Sub End Sub
#End Region ' Constructor #End Region ' Constructor
#Region "METHODS" #Region "METHODS"
''' <summary>
''' Funzione che salva gli stati di tutte le lampadine delle operazioni
''' </summary>
''' <returns></returns>
Public Function LoadStatusLamp() As ObservableCollection(Of StatusLamp) Public Function LoadStatusLamp() As ObservableCollection(Of StatusLamp)
Dim tmpStatusLampList As New ObservableCollection(Of StatusLamp) ' Utilizzo di LINQ per creare la lista in modo più conciso, carico gli stati delle lampadine per tenerli salvati
For Each ItemOp As MachiningOpListBoxItem In Map.refOperationsListExpanderVM.tmpOperationList Return New ObservableCollection(Of StatusLamp)(Map.refOperationsListExpanderVM.tmpOperationList.Select(Function(ItemOp) New StatusLamp(ItemOp.Id, ItemOp.OnOff)))
tmpStatusLampList.Add(New StatusLamp(ItemOp.Id, ItemOp.OnOff))
Next
Return tmpStatusLampList
End Function End Function
''' <summary>
''' Funzione che aggiorna lo stato delle lampadine delle operazioni
''' </summary>
Public Sub UpdateStatusLamp() Public Sub UpdateStatusLamp()
' Verifica che tmpOperationList non sia nulla
If IsNothing(Map.refOperationsListExpanderVM.tmpOperationList) Then Return
Dim tmpStatusLamp As StatusLamp Dim tmpStatusLamp As StatusLamp
If Not IsNothing(Map.refOperationsListExpanderVM.tmpOperationList) Then For Each ItemOp As MachiningOpListBoxItem In Map.refOperationsListExpanderVM.tmpOperationList
For Each ItemOp As MachiningOpListBoxItem In Map.refOperationsListExpanderVM.tmpOperationList ' Recuero lo stato della lampadina
tmpStatusLamp = Map.refOperationsListExpanderVM.StatusLampList.FirstOrDefault(Function(x) x.nId = ItemOp.Id) tmpStatusLamp = Map.refOperationsListExpanderVM.StatusLampList.FirstOrDefault(Function(x) x.nId = ItemOp.Id)
If Not tmpStatusLamp.bStatusLamp Then ' Controllo se lo stato della lampadina è falso nella lista StatusLampList
EgtSetStatus(ItemOp.Id, GDB_ST.OFF) If Not tmpStatusLamp.bStatusLamp Then
ItemOp.OnOff = False ' Rimetto lo stato della lampadina a falso nella OperationList
End If EgtSetStatus(ItemOp.Id, GDB_ST.OFF)
Next ItemOp.OnOff = False
End If ' Controllo se lo stato della lampadina è nullo nella lista StatusLampList
ElseIf IsNothing(tmpStatusLamp.bStatusLamp) Then
' Rimetto lo stato della lampadina a nullo nella OperationList
EgtSetStatus(ItemOp.Id, GDB_ST.SEL)
ItemOp.OnOff = Nothing
End If
Next
End Sub End Sub
#End Region ' Methods #End Region ' Methods
Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

+8 -4
View File
@@ -667,13 +667,17 @@
<Image.Style> <Image.Style>
<Style> <Style>
<Setter Property="Image.Source" <Setter Property="Image.Source"
Value="/Resources/TreeView/LampOff.png" /> Value="/Resources/TreeView/LampOff.png" />
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, <DataTrigger Binding="{Binding IsChecked,
RelativeSource={RelativeSource AncestorType= RelativeSource={RelativeSource AncestorType={x:Type ToggleButton}}}" Value="True">
{x:Type ToggleButton}}}" Value="True">
<Setter Property="Image.Source" <Setter Property="Image.Source"
Value="/Resources/TreeView/LampOn.png" /> Value="/Resources/TreeView/LampOn.png" />
</DataTrigger>
<DataTrigger Binding="{Binding IsChecked,
RelativeSource={RelativeSource AncestorType={x:Type ToggleButton}}}" Value="{x:Null}">
<Setter Property="Image.Source"
Value="/Resources/TreeView/LampSel.png" />
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>