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

After

Width:  |  Height:  |  Size: 757 B

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