Files
EgtCAM5/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderV.xaml.vb
Renzo Lanza 7eb8240749 EgtCAM5 2.2i2 :
- MachGroupPanelVM, MachinePanelVM, StatusBarVM spostati in EgtWPFLib5. Ora qua sono presenti le versioni My_ che ereditano quelle della Libreria. 
- ComboBox della Macchina corrente spostata in MachinePanel (accanto a Db Ut./Lav./SetUp). 
- modificato OptionPanel in modo da gestire i nuovi DrawOptionPanel e MachiningOptionPanel in base alle modalità DISEGNA e LAVORA. 
- ogni Expander di MachiningOptionPanel ora ha il suo VM e il suo V. 
- nuova gestione degli Expander di MachiningOptionPanel tramite funzioni Init e Exit. 
- barra TOPTRAY ora può estendersi su una seconda riga in base a larghezza finestra. 
- eliminati molti Application.Msn.Register/NotifyColleagues. Ora le funzioni che chiamavano sono chiamate tramite i riferimenti in Map. 
- corretta selezione superfici quando si sceglie Nuova Lav. in LAVORA.
2020-09-14 09:42:54 +00:00

181 lines
9.8 KiB
VB.net

Imports EgtWPFLib5
Imports EgtWPFLib5.EgtFloating
Public Class OperationParametersExpanderV
' Private m_OperationExpanderVM As OperationExpanderVM
' 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
' Private SimulationContentPresenter As ContentPresenter
' Private SimulationUserControl As UserControl
' Private SimulationExpanderStackPanel As StackPanel
' Private SimulationExpander As Expander
' Private GenerateButton As Button
' Private m_bFirst As Boolean = True
'#Region "CONSTRUCTOR"
' Sub New()
' ' Funzione che interpreta l'xaml
' InitializeComponent()
' ' Assegno al riferimento locale al VM il VM preso dal DataContext
' m_OperationExpanderVM = DirectCast(Me.DataContext, OperationExpanderVM)
' End Sub
'#End Region ' CONSTRUCTOR
'#Region "EVENTS"
' Private Sub MachiningOpListBoxItem_LostKeyboardFocus(sender As Object, e As KeyboardFocusChangedEventArgs)
' Dim TextBox As TextBox = TryCast(sender, TextBox)
' If IsNothing(TextBox) Then Return
' Dim SelOp As MachiningOpListBoxItem = TryCast(TextBox.DataContext, MachiningOpListBoxItem)
' If IsNothing(SelOp) Then Return
' If MachiningOpListBoxItem.m_CloseModifyLostFocus Then
' SelOp.ModifyNameEsc()
' Else
' If MachiningOpListBoxItem.m_Spy Then
' MachiningOpListBoxItem.m_CloseModifyLostFocus = True
' MachiningOpListBoxItem.m_Spy = False
' End If
' Keyboard.Focus(TextBox)
' End If
' End Sub
' Private Sub MachiningOpListBoxItem_IsVisibleChanged(sender As Object, e As DependencyPropertyChangedEventArgs)
' Dim bNewVal As Boolean = False
' Try
' bNewVal = CType(e.NewValue, Boolean)
' Catch
' End Try
' If bNewVal Then
' Dim inElem As IInputElement = TryCast(sender, IInputElement)
' If Not IsNothing(inElem) Then Keyboard.Focus(inElem)
' End If
' End Sub
'#End Region ' EVENTS
' Private Sub OperationExpanderView_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
' If m_bFirst Then
' EgtFloatingTray = FindAncestor(Of EgtFloatingTray)(Me)
' OptionPanelView = FindAncestor(Of UserControl)(Me)
' OptionPanelViewStackPanel = DirectCast(OptionPanelView.Content, StackPanel)
' MachiningTreeContentPresenter = DirectCast(OptionPanelViewStackPanel.Children(1), ContentPresenter)
' MachiningTreeUserControl = DirectCast(MachiningTreeContentPresenter.Content, UserControl)
' MachiningTreeExpander = DirectCast(MachiningTreeUserControl.Content, Expander)
' SimulationContentPresenter = DirectCast(OptionPanelViewStackPanel.Children(2), ContentPresenter)
' SimulationUserControl = DirectCast(SimulationContentPresenter.Content, UserControl)
' SimulationExpanderStackPanel = DirectCast(SimulationUserControl.Content, StackPanel)
' SimulationExpander = DirectCast(SimulationExpanderStackPanel.Children(0), Expander)
' GenerateButton = DirectCast(SimulationExpanderStackPanel.Children(2), Button)
' ' Gestisco l'evento SizeChanged della Tray
' AddHandler EgtFloatingTray.SizeChanged, AddressOf OperationExpanderTray_SizeChanged
' m_bFirst = False
' End If
' CalculateOperationParametersStackPanelMaxHeight()
' End Sub
' Private Sub OperationExpanderTray_SizeChanged(sender As Object, e As System.Windows.SizeChangedEventArgs)
' CalculateOperationParametersStackPanelMaxHeight()
' 'For Each Expander In OperationParametersStackPanel.Children
' ' If TypeOf Expander Is Expander Then
' ' Dim CurrExpander As Expander = DirectCast(Expander, Expander)
' ' CurrExpander.IsExpanded = False
' ' End If
' 'Next
' End Sub
' Private Sub CalculateOperationParametersStackPanelMaxHeight()
' Dim OccupiedHeight As Double = 0
' If Not MachiningTreeExpander.IsExpanded Then
' OccupiedHeight += MachiningTreeExpander.ActualHeight
' Else
' Dim MachiningTreeExpanderContent As FrameworkElement = DirectCast(MachiningTreeExpander.Content, FrameworkElement)
' MachiningTreeExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
' OccupiedHeight += (MachiningTreeExpander.ActualHeight - MachiningTreeExpanderContent.DesiredSize.Height)
' End If
' If Not SimulationExpander.IsExpanded Then
' OccupiedHeight += SimulationExpander.ActualHeight
' Else
' Dim SimulationExpanderContent As FrameworkElement = DirectCast(SimulationExpander.Content, FrameworkElement)
' SimulationExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
' OccupiedHeight += (SimulationExpander.ActualHeight - SimulationExpanderContent.DesiredSize.Height)
' End If
' OccupiedHeight += GenerateButton.ActualHeight
' 'Aggiungo altezza OperationsList header Expander
' If Not OperationsListExpander.IsExpanded Then
' OccupiedHeight += OperationsListExpander.ActualHeight
' Else
' Dim OperationsListExpanderContent As FrameworkElement = DirectCast(OperationsListExpander.Content, FrameworkElement)
' 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
' '' Aggiungo altezza contenuto OperationParameters che però è fuori dallo Stackpanel
' 'OperationFirstParametersStackPanel.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
' 'If OperationFirstParametersStackPanel.DesiredSize.Height <> 0 Then
' ' OccupiedHeight += OperationFirstParametersStackPanel.DesiredSize.Height
' 'Else
' ' ' aggiungo il valore calcolato provando se non viene calcolato dal sistema al momento
' ' OccupiedHeight += 10
' 'End If
' 'OperationParametersStackPanel.MaxHeight = OptionPanelViewStackPanel.MaxHeight - OccupiedHeight
' 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
' 'Public Sub ItemsControl_SelectionChanged(sender As Object, e As SelectionChangedEventArgs)
' ' Dim ListControl As ListBox = DirectCast(sender, ListBox)
' ' If Not IsNothing(ListControl.SelectedItem) Then
' ' Dim SelectedItemIndex As Integer = ListControl.Items.IndexOf(ListControl.SelectedItem)
' ' ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
' ' ListControl.UpdateLayout()
' ' If ListControl.SelectedItem IsNot Nothing Then
' ' ListControl.ScrollIntoView(ListControl.SelectedItem)
' ' End If
' ' End Sub, Action))
' ' If SelectedItemIndex > 0 Then
' ' ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
' ' ListControl.UpdateLayout()
' ' ListControl.ScrollIntoView(ListControl.Items(SelectedItemIndex - 1))
' ' End Sub, Action))
' ' End If
' ' If SelectedItemIndex < ListControl.Items.Count - 2 Then
' ' ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
' ' ListControl.UpdateLayout()
' ' ListControl.ScrollIntoView(ListControl.Items(SelectedItemIndex + 1))
' ' End Sub, Action))
' ' End If
' ' End If
' 'End Sub
End Class