EgtCAM5 :
- Modificata behaviour che apre e chiude gli expander automaticamente. - Modificato calcolo dell'altezza massima dei parametri operazione di lavorazione. - Migliorie varie.
This commit is contained in:
@@ -61,47 +61,76 @@ Public Class AutomaticCloseExpander
|
||||
End Sub
|
||||
|
||||
Private Sub VerticalVerifyDimension(SelectedExpander As Expander)
|
||||
Dim TotalDimension As Double = 0
|
||||
'Aggiungo la dimensione di tutti gli Header
|
||||
For Each Expander In ExpanderList
|
||||
If Expander IsNot SelectedExpander Then
|
||||
If Not Expander.IsExpanded Then
|
||||
TotalDimension += Expander.ActualHeight
|
||||
Else
|
||||
Dim ExpanderContent As FrameworkElement = DirectCast(Expander.Content, FrameworkElement)
|
||||
ExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
TotalDimension += (Expander.ActualHeight - ExpanderContent.DesiredSize.Height)
|
||||
End If
|
||||
Else
|
||||
TotalDimension += Expander.ActualHeight
|
||||
End If
|
||||
Next
|
||||
' Aggiungo la dimensione dei controlli fissi (non Expander)
|
||||
For Each OtherControl In OtherControlList
|
||||
TotalDimension += OtherControl.ActualHeight
|
||||
Next
|
||||
Dim AssociatedObjectElement As FrameworkElement = DirectCast(AssociatedObject, FrameworkElement)
|
||||
AssociatedObjectElement.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
Dim TotalCurrentHeight = AssociatedObjectElement.DesiredSize.Height
|
||||
' Aggiungo la dimensione del contenuto dell'expander selezionato
|
||||
Dim SelectedContent As FrameworkElement = DirectCast(SelectedExpander.Content, FrameworkElement)
|
||||
SelectedContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
TotalDimension += SelectedContent.DesiredSize.Height
|
||||
' Verifico per tutti gli expander (tranne quello selezionato) a partire dal primo se sono espansi e nel caso se la loro dimensione totale li fa stare nello spazio disponibile
|
||||
Dim Index As Integer = 0
|
||||
For Index = 0 To ExpanderList.Count - 1
|
||||
If ExpanderList(Index) IsNot SelectedExpander Then
|
||||
If ExpanderList(Index).IsExpanded Then
|
||||
Dim ExpanderContent As FrameworkElement = DirectCast(ExpanderList(Index).Content, FrameworkElement)
|
||||
TotalDimension += ExpanderContent.ActualHeight
|
||||
If TotalDimension > Me.AssociatedObject.MaxHeight Then
|
||||
Exit For
|
||||
End If
|
||||
TotalCurrentHeight += SelectedContent.DesiredSize.Height
|
||||
' Aggiungo il padding del contenuto
|
||||
TotalCurrentHeight += (SelectedExpander.Padding.Top + SelectedExpander.Padding.Bottom)
|
||||
If TotalCurrentHeight < Me.AssociatedObject.MaxHeight Then
|
||||
Return
|
||||
End If
|
||||
For Index = ExpanderList.Count - 1 To 0 Step -1
|
||||
If TotalCurrentHeight > Me.AssociatedObject.MaxHeight Then
|
||||
If ExpanderList(Index) IsNot SelectedExpander AndAlso ExpanderList(Index).IsExpanded = True Then
|
||||
'TotalCurrentHeight -= ExpanderList(Index).ActualHeight
|
||||
ExpanderList(Index).IsExpanded = False
|
||||
Dim CurrExpanderContent As FrameworkElement = DirectCast(ExpanderList(Index).Content, FrameworkElement)
|
||||
CurrExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
TotalCurrentHeight -= CurrExpanderContent.DesiredSize.Height
|
||||
' Sottraggo anche i padding
|
||||
TotalCurrentHeight -= (ExpanderList(Index).Padding.Top + ExpanderList(Index).Padding.Bottom)
|
||||
End If
|
||||
Else
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
For CancelIndex = Index To ExpanderList.Count - 1
|
||||
If ExpanderList(CancelIndex) IsNot SelectedExpander Then
|
||||
ExpanderList(CancelIndex).IsExpanded = False
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
'Dim TotalDimension As Double = 0
|
||||
''Aggiungo la dimensione di tutti gli Header
|
||||
'For Each Expander In ExpanderList
|
||||
' If Expander IsNot SelectedExpander Then
|
||||
' If Not Expander.IsExpanded Then
|
||||
' TotalDimension += Expander.ActualHeight
|
||||
' Else
|
||||
' Dim ExpanderContent As FrameworkElement = DirectCast(Expander.Content, FrameworkElement)
|
||||
' ExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
' TotalDimension += (Expander.ActualHeight - ExpanderContent.DesiredSize.Height)
|
||||
' End If
|
||||
' Else
|
||||
' TotalDimension += Expander.ActualHeight
|
||||
' End If
|
||||
'Next
|
||||
'' Aggiungo la dimensione dei controlli fissi (non Expander)
|
||||
'For Each OtherControl In OtherControlList
|
||||
' TotalDimension += OtherControl.ActualHeight
|
||||
'Next
|
||||
'' Aggiungo la dimensione del contenuto dell'expander selezionato
|
||||
'Dim SelectedContent As FrameworkElement = DirectCast(SelectedExpander.Content, FrameworkElement)
|
||||
'SelectedContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
'TotalDimension += SelectedContent.DesiredSize.Height
|
||||
'' Verifico per tutti gli expander (tranne quello selezionato) a partire dal primo se sono espansi e nel caso se la loro dimensione totale li fa stare nello spazio disponibile
|
||||
'Dim Index As Integer = 0
|
||||
'For Index = 0 To ExpanderList.Count - 1
|
||||
' If ExpanderList(Index) IsNot SelectedExpander Then
|
||||
' If ExpanderList(Index).IsExpanded Then
|
||||
' Dim ExpanderContent As FrameworkElement = DirectCast(ExpanderList(Index).Content, FrameworkElement)
|
||||
' TotalDimension += ExpanderContent.ActualHeight
|
||||
' If TotalDimension > Me.AssociatedObject.MaxHeight Then
|
||||
' Exit For
|
||||
' End If
|
||||
' End If
|
||||
' End If
|
||||
'Next
|
||||
'For CancelIndex = Index To ExpanderList.Count - 1
|
||||
' If ExpanderList(CancelIndex) IsNot SelectedExpander Then
|
||||
' ExpanderList(CancelIndex).IsExpanded = False
|
||||
' End If
|
||||
'Next
|
||||
End Sub
|
||||
|
||||
Private Sub HorizontalVerifyDimension(SelectedExpander As Expander)
|
||||
|
||||
@@ -4,6 +4,8 @@ Imports EgtUILib
|
||||
Module IniFile
|
||||
|
||||
Friend EgaltechBlue1 As New SolidColorBrush(Color.FromArgb(255, 77, 132, 196))
|
||||
Friend ReferenceContactColRed As New Color3d(255, 0, 0)
|
||||
Friend ReferenceContactColGreen As New Color3d(0, 255, 0)
|
||||
|
||||
Friend Enum ProjectModeOpt As Integer
|
||||
DRAW = 1
|
||||
|
||||
+74
-35
@@ -319,6 +319,7 @@ Namespace EgtCAM5
|
||||
Public Sub Done(ByVal param As Object)
|
||||
' Verifico la validità del punto in Input
|
||||
If Not String.IsNullOrEmpty(m_InputValue) Then
|
||||
' se movimento di traslazione
|
||||
If m_MoveIsChecked Then
|
||||
Dim InputPoint As New Point3d(0, 0, 0)
|
||||
Dim Values() As String = m_InputValue.Split(","c)
|
||||
@@ -334,42 +335,19 @@ Namespace EgtCAM5
|
||||
Dim vtMove As Vector3d
|
||||
' lo imposto a seconda del tipo del primo elemento selezionato
|
||||
Dim nFirstSelectedId As Integer = EgtGetFirstSelectedObj()
|
||||
' se è un grezzo
|
||||
If EgtVerifyRawPartCurrPhase(nFirstSelectedId) Then
|
||||
Dim bboxRawPart As New BBox3d
|
||||
' recupero il solido del grezzo dal primo elemento selezionato
|
||||
Dim nRawSolidId As Integer = EgtGetFirstNameInGroup(nFirstSelectedId, RAWSOLID)
|
||||
' ne calcolo il BBox
|
||||
EgtGetBBoxGlob(nRawSolidId, GDB_BB.STANDARD, bboxRawPart)
|
||||
' imposto il riferimento della tavola
|
||||
Dim ptTableRef As Point3d
|
||||
EgtGetTableRef(1, ptTableRef)
|
||||
' calcolo i punti min e max del bbox riferiti alla tavola
|
||||
Dim ptBBoxRawPartMin As New Point3d(bboxRawPart.Min)
|
||||
Dim ptBBoxRawPartMax As New Point3d(bboxRawPart.Max)
|
||||
ptBBoxRawPartMin.ToLoc(New Frame3d(ptTableRef))
|
||||
ptBBoxRawPartMax.ToLoc(New Frame3d(ptTableRef))
|
||||
' dal box e dal tipo di punto di riferimento selezionato ricavo le coordinate del punto di riferimento
|
||||
Dim ptRawRefPoint As Point3d
|
||||
Select Case m_RawRefPosition
|
||||
Case MCH_CR.TL
|
||||
ptRawRefPoint.x = ptBBoxRawPartMin.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMax.y
|
||||
Case MCH_CR.TR
|
||||
ptRawRefPoint.x = ptBBoxRawPartMax.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMax.y
|
||||
Case MCH_CR.BL
|
||||
ptRawRefPoint.x = ptBBoxRawPartMin.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMin.y
|
||||
Case MCH_CR.BR
|
||||
ptRawRefPoint.x = ptBBoxRawPartMax.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMin.y
|
||||
End Select
|
||||
ptRawRefPoint.z = ptBBoxRawPartMin.z
|
||||
' calcolo il punto del grezzo da posizionar nelle coordinate di input
|
||||
Dim ptRawRefPoint As Point3d = GetRawPartRefPoint(nFirstSelectedId, m_RawRefPosition)
|
||||
' creo un punto con le coordinate di input espresse rispetto alla tavola
|
||||
Dim TableRefInputPoint As New Point3d(InputPoint)
|
||||
TableRefInputPoint.LocToLoc(EgtGetGridFrame(), New Frame3d(ptTableRef))
|
||||
' calcolo il vettore di spostamento del grezzo
|
||||
vtMove = TableRefInputPoint - ptRawRefPoint
|
||||
' se è una ventosa
|
||||
ElseIf EgtVerifyFixture(nFirstSelectedId) Then
|
||||
Dim SelObjFrame3d As New Frame3d(Frame3d.GLOB)
|
||||
EgtGetGroupGlobFrame(nFirstSelectedId, SelObjFrame3d)
|
||||
@@ -381,11 +359,19 @@ Namespace EgtCAM5
|
||||
End If
|
||||
' Muovo tutti gli oggetti selezionati
|
||||
MoveRawPartPartAndFixture(GDB_ID.SEL, vtMove)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
' se è un grezzo
|
||||
If EgtVerifyRawPartCurrPhase(nFirstSelectedId) Then
|
||||
Dim ptRawRefPoint As Point3d = GetRawPartRefPoint(nFirstSelectedId, m_RawRefPosition)
|
||||
' verifico se lo spostamento effettuato differisce da quello richiesto
|
||||
Dim vtRemainingMove As Vector3d = InputPoint - ptRawRefPoint
|
||||
' se differisce
|
||||
If Not vtRemainingMove.IsSmall() Then
|
||||
' eseguo lo spostamento rimanente sull'asse x
|
||||
MoveRawPartPartAndFixture(GDB_ID.SEL, New Vector3d(vtRemainingMove.x, 0, 0))
|
||||
' eseguo lo spostamento rimanente sull'asse y
|
||||
MoveRawPartPartAndFixture(GDB_ID.SEL, New Vector3d(0, vtRemainingMove.y, 0))
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
@@ -494,6 +480,8 @@ Namespace EgtCAM5
|
||||
' End Select
|
||||
'nSelId = EgtGetNextSelectedObj()
|
||||
'End While
|
||||
|
||||
' se rotazione
|
||||
Else
|
||||
Dim InputAngle As Double = 0
|
||||
If Not StringToDouble(m_InputValue, InputAngle) Then
|
||||
@@ -524,6 +512,40 @@ Namespace EgtCAM5
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Shared Function GetRawPartRefPoint(nRawPartId As Integer, RawRefPosition As MCH_CR) As Point3d
|
||||
Dim bboxRawPart As New BBox3d
|
||||
' recupero il solido del grezzo dal primo elemento selezionato
|
||||
Dim nRawSolidId As Integer = EgtGetFirstNameInGroup(nRawPartId, RAWSOLID)
|
||||
' ne calcolo il BBox
|
||||
EgtGetBBoxGlob(nRawSolidId, GDB_BB.STANDARD, bboxRawPart)
|
||||
' imposto il riferimento della tavola
|
||||
Dim ptTableRef As Point3d
|
||||
EgtGetTableRef(1, ptTableRef)
|
||||
' calcolo i punti min e max del bbox riferiti alla tavola
|
||||
Dim ptBBoxRawPartMin As New Point3d(bboxRawPart.Min)
|
||||
Dim ptBBoxRawPartMax As New Point3d(bboxRawPart.Max)
|
||||
ptBBoxRawPartMin.ToLoc(New Frame3d(ptTableRef))
|
||||
ptBBoxRawPartMax.ToLoc(New Frame3d(ptTableRef))
|
||||
' dal box e dal tipo di punto di riferimento selezionato ricavo le coordinate del punto di riferimento
|
||||
Dim ptRawRefPoint As Point3d
|
||||
Select Case RawRefPosition
|
||||
Case MCH_CR.TL
|
||||
ptRawRefPoint.x = ptBBoxRawPartMin.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMax.y
|
||||
Case MCH_CR.TR
|
||||
ptRawRefPoint.x = ptBBoxRawPartMax.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMax.y
|
||||
Case MCH_CR.BL
|
||||
ptRawRefPoint.x = ptBBoxRawPartMin.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMin.y
|
||||
Case MCH_CR.BR
|
||||
ptRawRefPoint.x = ptBBoxRawPartMax.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMin.y
|
||||
End Select
|
||||
ptRawRefPoint.z = ptBBoxRawPartMin.z
|
||||
Return ptRawRefPoint
|
||||
End Function
|
||||
|
||||
Public Shared Function MoveRawPartPartAndFixture(nMoveId As Integer, vtMove As Vector3d, Optional nCount As Integer = 1) As Boolean
|
||||
Dim bErrorMoving As Boolean = False
|
||||
' Muovo gli oggetti selezionati se consentito
|
||||
@@ -772,11 +794,19 @@ Namespace EgtCAM5
|
||||
' calcolo il vettore di spostamento necessario ad allinearli
|
||||
Dim vtDelta As Vector3d = ptArcCenter - ptMin
|
||||
vtDelta.z = 0
|
||||
' se i punti non coincidono, esco
|
||||
If Not vtDelta.IsSmall() Then
|
||||
' se i punti coincidono, esco
|
||||
If vtDelta.IsSmall() Then
|
||||
' il grezzo è in battuta sul riferimento
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_CONTACTCOLDISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColGreen)
|
||||
Else
|
||||
' altrimenti riporto il vettore di correzione
|
||||
vtRefMove = -vtDelta.Glob(ccompoRawPartOutlineId)
|
||||
End If
|
||||
Else
|
||||
' il grezzo non è in battuta sul riferimento
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_CONTACTCOLDISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColRed)
|
||||
End If
|
||||
End Select
|
||||
End If
|
||||
@@ -881,7 +911,11 @@ Namespace EgtCAM5
|
||||
Dim vtDelta As Vector3d = -(ptDist - ptArcCenter)
|
||||
vtDelta.z = 0
|
||||
' se il vettore non è nullo
|
||||
If Not vtDelta.IsSmall() Then
|
||||
If vtDelta.IsSmall() Then
|
||||
' il grezzo è in battuta sul riferimento
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_CONTACTCOLDISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColGreen)
|
||||
Else
|
||||
vtDelta = vtDelta.Glob(ccompoRawPartOutlineId)
|
||||
' il vettore da restituire è nullo, quindi lo inizializzo
|
||||
If vtRefMove.IsSmall() Then
|
||||
@@ -902,6 +936,11 @@ Namespace EgtCAM5
|
||||
EgtErase(nDistLine)
|
||||
EgtErase(ccompoRawPartOutlineOffsetId)
|
||||
End Select
|
||||
' se non c'è sovrapposizione
|
||||
ElseIf FixtureType(nFixtureId) = FIX_TYPE.REFERENCE Then
|
||||
' il grezzo non è in battuta sul riferimento
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_CONTACTCOLDISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColRed)
|
||||
End If
|
||||
nFixtureId = EgtGetNextFixture(nFixtureId)
|
||||
End While
|
||||
|
||||
+50
-47
@@ -61,52 +61,54 @@
|
||||
<sys:Int32 x:Key="SubType">49</sys:Int32>
|
||||
</UserControl.Resources>
|
||||
|
||||
<StackPanel Name="OperationParametersStackPanel">
|
||||
<StackPanel Name="OperationFirstParametersStackPanel">
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
<StackPanel Name="OperationParametersStackPanel">
|
||||
<StackPanel Name="OperationFirstParametersStackPanel">
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource DepthStr}}">
|
||||
<TextBlock Text="{Binding DepthMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding Depth,
|
||||
Converter={StaticResource DepthUnitConverter}}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Height="20" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource Invert}}">
|
||||
<TextBlock Text="{Binding InvertMsg}"/>
|
||||
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsChecked="{Binding Invert}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource DepthStr}}">
|
||||
<TextBlock Text="{Binding DepthMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding Depth,
|
||||
Converter={StaticResource DepthUnitConverter}}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Height="20" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource Invert}}">
|
||||
<TextBlock Text="{Binding InvertMsg}"/>
|
||||
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsChecked="{Binding Invert}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource HeadSide}}">
|
||||
<TextBlock Text="{Binding HeadSideMsg}"/>
|
||||
<ComboBox ItemsSource="{Binding HeadSideList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedHeadSide}"
|
||||
IsSynchronizedWithCurrentItem="True">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource WorkSide}}">
|
||||
<TextBlock Text="{Binding WorkSideMsg}"/>
|
||||
<ComboBox ItemsSource="{Binding WorkSideList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedWorkSide}"
|
||||
IsSynchronizedWithCurrentItem="True">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource UserNotes}}">
|
||||
<TextBlock Text="{Binding UserNotesMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding UserNotes}">
|
||||
<EgtWPFLib5:EgtTextBox.ToolTip>
|
||||
<TextBlock Text="{Binding UserNotesTooltip}"/>
|
||||
</EgtWPFLib5:EgtTextBox.ToolTip>
|
||||
</EgtWPFLib5:EgtTextBox>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
<Expander Header="{Binding GenericExpanderHeader}" Style="{StaticResource ExpanderStyle}" Margin="0,1,0,1">
|
||||
ConverterParameter={StaticResource HeadSide}}">
|
||||
<TextBlock Text="{Binding HeadSideMsg}"/>
|
||||
<ComboBox ItemsSource="{Binding HeadSideList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedHeadSide}"
|
||||
IsSynchronizedWithCurrentItem="True">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource WorkSide}}">
|
||||
<TextBlock Text="{Binding WorkSideMsg}"/>
|
||||
<ComboBox ItemsSource="{Binding WorkSideList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedWorkSide}"
|
||||
IsSynchronizedWithCurrentItem="True">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource UserNotes}}">
|
||||
<TextBlock Text="{Binding UserNotesMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding UserNotes}">
|
||||
<EgtWPFLib5:EgtTextBox.ToolTip>
|
||||
<TextBlock Text="{Binding UserNotesTooltip}"/>
|
||||
</EgtWPFLib5:EgtTextBox.ToolTip>
|
||||
</EgtWPFLib5:EgtTextBox>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
<StackPanel Name="AutomaticCloseExpanderStackPanel">
|
||||
<Expander Header="{Binding GenericExpanderHeader}" Name="GenericExpander"
|
||||
Style="{StaticResource ExpanderStyle}" Margin="0,1,0,1">
|
||||
<StackPanel>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
@@ -382,11 +384,12 @@
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Button Name="ApplyMachBtn" Height="30" Content="{Binding ApplyMachiningBtnContent}"
|
||||
Command="{Binding ReloadMachiningCommand}" />
|
||||
<Interactivity:Interaction.Behaviors>
|
||||
<EgtCAM5:AutomaticCloseExpander/>
|
||||
</Interactivity:Interaction.Behaviors>
|
||||
</StackPanel>
|
||||
<Button Name="ApplyMachBtn" Height="30" Content="{Binding ApplyMachiningBtnContent}"
|
||||
Command="{Binding ReloadMachiningCommand}" />
|
||||
</StackPanel>
|
||||
|
||||
</UserControl>
|
||||
|
||||
+81
-1
@@ -1,3 +1,83 @@
|
||||
Public Class MachiningParameterExpanderView
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtWPFLib5.EgtFloating
|
||||
|
||||
Public Class MachiningParameterExpanderView
|
||||
|
||||
Private EgtFloatingTray As EgtFloatingTray
|
||||
Private EgtFloatingPanel As EgtFloatingPanel
|
||||
|
||||
Private m_bFirst As Boolean = True
|
||||
|
||||
Private Sub OperationExpanderView_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
|
||||
If m_bFirst Then
|
||||
EgtFloatingTray = FindAncestor(Of EgtFloatingTray)(Me)
|
||||
EgtFloatingPanel = FindAncestor(Of EgtFloatingPanel)(Me)
|
||||
AddHandler EgtFloatingTray.SizeChanged, AddressOf EgtFloatingTray_SizeChanged
|
||||
PanelHeight = EgtFloatingPanel.ActualHeight
|
||||
Me.AutomaticCloseExpanderStackPanelHeight = AutomaticCloseExpanderStackPanel.ActualHeight
|
||||
m_bFirst = False
|
||||
End If
|
||||
CalculateOperationParametersStackPanelMaxHeight()
|
||||
End Sub
|
||||
|
||||
Dim m_bSizeChanging As Boolean = False
|
||||
|
||||
Private Sub EgtFloatingTray_SizeChanged(sender As Object, e As System.Windows.SizeChangedEventArgs)
|
||||
If m_bSizeChanging Then Return
|
||||
m_bSizeChanging = True
|
||||
CalculateOperationParametersStackPanelMaxHeight()
|
||||
m_bSizeChanging = False
|
||||
End Sub
|
||||
|
||||
Dim PanelHeight As Double = 0
|
||||
Dim AutomaticCloseExpanderStackPanelHeight As Double = 0
|
||||
|
||||
Private Sub CalculateOperationParametersStackPanelMaxHeight()
|
||||
Dim AutomaticCloseExpanderStackPanelHeight As Double = 0
|
||||
Dim OpenedExpanderList As New List(Of Boolean)
|
||||
For Index = 0 To AutomaticCloseExpanderStackPanel.Children.Count - 1
|
||||
If TypeOf AutomaticCloseExpanderStackPanel.Children(Index) Is Expander Then
|
||||
Dim IndexedExpander As Expander = DirectCast(AutomaticCloseExpanderStackPanel.Children(Index), Expander)
|
||||
If IndexedExpander.IsExpanded Then
|
||||
OpenedExpanderList.Add(True)
|
||||
IndexedExpander.IsExpanded = False
|
||||
Dim CurrExpanderContent As FrameworkElement = DirectCast(IndexedExpander.Content, FrameworkElement)
|
||||
CurrExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
AutomaticCloseExpanderStackPanelHeight -= CurrExpanderContent.DesiredSize.Height
|
||||
' Sottraggo anche i padding
|
||||
AutomaticCloseExpanderStackPanelHeight -= (IndexedExpander.Padding.Top + IndexedExpander.Padding.Bottom)
|
||||
Else
|
||||
OpenedExpanderList.Add(False)
|
||||
End If
|
||||
Else
|
||||
OpenedExpanderList.Add(False)
|
||||
End If
|
||||
Next
|
||||
Dim RemainingHeight As Double = EgtFloatingTray.ActualHeight - PanelHeight
|
||||
AutomaticCloseExpanderStackPanel.MaxHeight = Me.AutomaticCloseExpanderStackPanelHeight + RemainingHeight
|
||||
For Index = AutomaticCloseExpanderStackPanel.Children.Count - 1 To 0 Step -1
|
||||
If TypeOf AutomaticCloseExpanderStackPanel.Children(Index) Is Expander Then
|
||||
Dim IndexedExpander As Expander = DirectCast(AutomaticCloseExpanderStackPanel.Children(Index), Expander)
|
||||
If OpenedExpanderList(Index) Then
|
||||
IndexedExpander.IsExpanded = True
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
' Funzione che permette di trovare il primo contenitore di tipo T di un elemento grafico dependencyObject
|
||||
Public Function FindAncestor(Of T As Class)(dependencyObject As DependencyObject) As T
|
||||
Dim target As DependencyObject = dependencyObject
|
||||
Do
|
||||
target = LogicalTreeHelper.GetParent(target)
|
||||
Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T)
|
||||
If IsNothing(target) Then
|
||||
target = dependencyObject
|
||||
Do
|
||||
target = VisualTreeHelper.GetParent(target)
|
||||
Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T)
|
||||
End If
|
||||
Return TryCast(target, T)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@
|
||||
</Expander.Header>
|
||||
|
||||
<!--ContentPresenter that contains the OperationParameters-->
|
||||
<ContentPresenter Content="{Binding OperationParameters,Mode=OneWay}"/>
|
||||
<ContentPresenter Name="OperationParameters" Content="{Binding OperationParameters,Mode=OneWay}"/>
|
||||
|
||||
</Expander>
|
||||
|
||||
|
||||
+8
-7
@@ -6,6 +6,7 @@ Public Class OperationExpanderView
|
||||
Private EgtFloatingTray As EgtFloatingTray
|
||||
Private OptionPanelView As UserControl
|
||||
Private OptionPanelViewStackPanel As StackPanel
|
||||
'Private OperationParameters As ContentPresenter
|
||||
Private MachiningTreeContentPresenter As ContentPresenter
|
||||
Private MachiningTreeUserControl As UserControl
|
||||
Private MachiningTreeExpander As Expander
|
||||
@@ -72,13 +73,13 @@ Public Class OperationExpanderView
|
||||
OperationsListExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
OccupiedHeight += (OperationsListExpander.ActualHeight - OperationsListExpanderContent.DesiredSize.Height)
|
||||
End If
|
||||
'If Not OperationParametersExpander.IsExpanded Then
|
||||
' OccupiedHeight += OperationParametersExpander.ActualHeight
|
||||
'Else
|
||||
' Dim OperationParametersExpanderContent As FrameworkElement = DirectCast(OperationParametersExpander.Content, FrameworkElement)
|
||||
' OperationParametersExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
' OccupiedHeight += (OperationParametersExpander.ActualHeight - OperationParametersExpanderContent.DesiredSize.Height)
|
||||
'End If
|
||||
If Not OperationParametersExpander.IsExpanded Then
|
||||
OccupiedHeight += OperationParametersExpander.ActualHeight
|
||||
Else
|
||||
Dim OperationParametersExpanderContent As FrameworkElement = DirectCast(OperationParametersExpander.Content, FrameworkElement)
|
||||
OperationParametersExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
OccupiedHeight += (OperationParametersExpander.ActualHeight - OperationParametersExpanderContent.DesiredSize.Height)
|
||||
End If
|
||||
'' Aggiungo altezza contenuto OperationParameters che però è fuori dallo Stackpanel
|
||||
'OperationFirstParametersStackPanel.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
'If OperationFirstParametersStackPanel.DesiredSize.Height <> 0 Then
|
||||
|
||||
Reference in New Issue
Block a user