Imports System.Collections.ObjectModel Imports EgtBEAMWALL.Core Imports EgtUILib Imports EgtWPFLib5 Public Class LeftPanelVM Inherits VMBase #Region "FIELDS & PROPERTIES" Private Property m_GridDims As New ObservableCollection(Of GridDimension) Public Property GridDims As ObservableCollection(Of GridDimension) Get Return m_GridDims End Get Set m_GridDims = Value NotifyPropertyChanged(NameOf(GridDims)) End Set End Property Private m_LeftPanel_IsEnabled As Boolean = True Public ReadOnly Property LeftPanel_IsEnabled As Boolean Get Return m_LeftPanel_IsEnabled End Get End Property Public ReadOnly Property SearchFilter_IsEnabled As Boolean Get Return Not Map.refFreeContourManagerVM.bIsActive End Get End Property Private m_IsFilterBtnOpen As Boolean = False Public Property IsFilterBtnOpen As Boolean Get Return m_IsFilterBtnOpen End Get Set(value As Boolean) m_IsFilterBtnOpen = value End Set End Property Friend Sub SetIsFilterBtnOpen(bIsFilterBtnOpen As Boolean) m_IsFilterBtnOpen = bIsFilterBtnOpen NotifyPropertyChanged(NameOf(IsFilterBtnOpen)) End Sub Private m_RotateAll_IsEnabled As Boolean = False Public ReadOnly Property RotateAll_IsEnabled As Boolean Get Return m_RotateAll_IsEnabled End Get End Property Friend Sub SetRotateAll_IsEnabled(value As Boolean) m_RotateAll_IsEnabled = value NotifyPropertyChanged(NameOf(RotateAll_IsEnabled)) End Sub Private m_IsProjectParametersBtnOpen As Boolean = False Public Property IsProjectParametersBtnOpen As Boolean Get Return m_IsProjectParametersBtnOpen End Get Set(value As Boolean) m_IsProjectParametersBtnOpen = value End Set End Property Friend Sub SetIsProjectParametersBtnOpen(bIsProjectParametersBtnOpen As Boolean) m_IsProjectParametersBtnOpen = bIsProjectParametersBtnOpen NotifyPropertyChanged(NameOf(IsProjectParametersBtnOpen)) End Sub Private m_CALCPanel_IsEnabled As Boolean = True Public ReadOnly Property CALCPanel_IsEnabled As Boolean Get Return m_CALCPanel_IsEnabled End Get End Property Friend Sub SetCALCPanel_IsEnabled(value As Boolean) m_CALCPanel_IsEnabled = value NotifyPropertyChanged(NameOf(CALCPanel_IsEnabled)) End Sub ' Definizione comandi Private m_cmdVerifyAll As ICommand Private m_cmdVerifyFlipRotAll As ICommand Private m_cmdShowPopUpFilterBtnCmd As ICommand Private m_cmdRotateAll As ICommand Private m_cmdInvertAll As ICommand Private m_cmdResetCalc As ICommand #Region "Messages" Public ReadOnly Property SearchFilter_Msg As String Get Return EgtMsg(61949) End Get End Property Public ReadOnly Property Section_Msg As String Get Return EgtMsg(61771) End Get End Property Public ReadOnly Property Group_Msg As String Get Return EgtMsg(61624) End Get End Property Public ReadOnly Property SubGroup_Msg As String Get Return EgtMsg(61623) End Get End Property Public ReadOnly Property ParType_Msg As String Get Return EgtMsg(61950) End Get End Property Public ReadOnly Property ParValue_Msg As String Get Return EgtMsg(61951) End Get End Property Public ReadOnly Property Pdn_Msg As String Get Return EgtMsg(61809) End Get End Property Public ReadOnly Property Description_Msg As String Get Return EgtMsg(62511) End Get End Property Public ReadOnly Property VerifyAll_ToolTip As String Get Return EgtMsg(61928) End Get End Property Public ReadOnly Property FilterAll_ToolTip As String Get Return EgtMsg(62570) End Get End Property Public ReadOnly Property ResetCalc_ToolTip As String Get Return EgtMsg(61940) End Get End Property Public ReadOnly Property RotateAll_ToolTip As String Get Return EgtMsg(63029) End Get End Property Public ReadOnly Property InvertAll_ToolTip As String Get Return EgtMsg(63030) End Get End Property Public ReadOnly Property MultipleModify_ToolTip As String Get Return EgtMsg(63031) End Get End Property #End Region ' Messages #End Region 'FIELDS & PROPERTIES #Region "CONSTRUCTOR" Sub New() ' imposto riferimento su mappa Map.SetRefLeftPanelVM(Me) ' imposto dimensioni colonne/righe della Grid DimensionsIniFile.ReadGridDimensions(ConstDims.LEFTPANEL_VIEW, GridDims) End Sub #End Region ' Constructor #Region "METHODS" Friend Sub SetLeftPanelIsEnabled(bIsEnabled As Boolean) m_LeftPanel_IsEnabled = bIsEnabled NotifyPropertyChanged(NameOf(LeftPanel_IsEnabled)) NotifyPropertyChanged(NameOf(SearchFilter_IsEnabled)) End Sub #End Region ' METHODS #Region "COMMANDS" #Region "VerifyAll" Public ReadOnly Property VerifyAll_Command As ICommand Get If m_cmdVerifyAll Is Nothing Then m_cmdVerifyAll = New Command(AddressOf VerifyAll) End If Return m_cmdVerifyAll End Get End Property Friend Sub VerifyAll() If (IsNothing(ProjectManagerVM.CurrProd) OrElse IsNothing(Map.refProjectVM.BTLStructureVM) OrElse IsNothing(Map.refProjectVM.MachGroupPanelVM)) Then Return ' imposto flag per calcolo Map.refCALCPanelVM.SetCalculating(True) For Each BTLPartItem As BTLPartVM In Map.refProjectVM.BTLStructureVM.BTLPartVMList BTLPartItem.SetIsRowEnabled(False) Next Map.refCALCPanelVM.VerifyAll(ProjectType.PROJ, CalcIntegration.CmdTypes.CHECKNOSIM) Return End Sub #End Region ' VerifyAll #Region "VerifyAllFlipRot" Public ReadOnly Property VerifyAllFlipRot_Command As ICommand Get If m_cmdVerifyFlipRotAll Is Nothing Then m_cmdVerifyFlipRotAll = New Command(AddressOf VerifyAllFlipRot) End If Return m_cmdVerifyFlipRotAll End Get End Property Friend Sub VerifyAllFlipRot() If (IsNothing(ProjectManagerVM.CurrProd) OrElse IsNothing(Map.refProjectVM.BTLStructureVM) OrElse IsNothing(Map.refProjectVM.MachGroupPanelVM)) Then Return ' imposto flag per calcolo Map.refCALCPanelVM.SetCalculating(True) For Each BTLPartItem As BTLPartVM In Map.refProjectVM.BTLStructureVM.BTLPartVMList BTLPartItem.SetIsRowEnabled(False) Next Map.refCALCPanelVM.VerifyAll(ProjectType.PROJ, CalcIntegration.CmdTypes.FLIP_ROT) Return End Sub #End Region ' VerifyAllRotate #Region "ShowPopUpFilterBtnCommand" Public ReadOnly Property ShowPopUpFilterBtnCommand As ICommand Get If m_cmdShowPopUpFilterBtnCmd Is Nothing Then m_cmdShowPopUpFilterBtnCmd = New Command(AddressOf ShowPopUpFilterBtn) End If Return m_cmdShowPopUpFilterBtnCmd End Get End Property Public Sub ShowPopUpFilterBtn(ByVal param As Object) If m_IsFilterBtnOpen Then SetIsFilterBtnOpen(False) Else SetIsFilterBtnOpen(True) End If End Sub #End Region ' ShowPopUpFilterBtnCommand #Region "RotateAll" Public ReadOnly Property RotateAll_Command As ICommand Get If m_cmdRotateAll Is Nothing Then m_cmdRotateAll = New Command(AddressOf RotateAll) End If Return m_cmdRotateAll End Get End Property Public Sub RotateAll() If IsNothing(ProjectManagerVM.CurrProd) OrElse IsNothing(Map.refProjectVM.BTLStructureVM) Then Return ' salvo sezione impostata Dim CurrSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SelSection ' se modalita' assemblato Dim bShowBuilding As Boolean = Map.refShowBeamPanelVM.ShowBuilding_IsChecked If bShowBuilding AndAlso Map.refShowBeamPanelVM.bShowAll Then ' devo smontarlo prima di calcolare le travi, altrimenti non trova i pezzi Map.refProjectVM.BTLStructureVM.ShowBuilding(False, False) End If ' ruoto i pezzi selezionati For Each Part In Map.refProjectVM.BTLStructureVM.SelBTLParts Part.BackRotation(False, False) Next ' se assemblato lo ripristino If bShowBuilding Then Map.refProjectVM.BTLStructureVM.ShowBuilding(True, False) ' se progetto travi e sezione precedente diversa da vuota (tutti i pezzi) If Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.BEAM AndAlso CurrSection <> SectionXMaterial.Empty Then ' se esiste, imposto sezione inversa Dim InverseSection As SectionXMaterial = Map.refProjectVM.BTLStructureVM.SectionList.FirstOrDefault(Function(x) x.dH = CurrSection.dW AndAlso x.dW = CurrSection.dH AndAlso x.sMaterial(0) = CurrSection.sMaterial(0)) If Not IsNothing(InverseSection) Then Map.refProjectVM.BTLStructureVM.SetSelSection(InverseSection) End If EgtDraw() End Sub #End Region ' RotateAll #Region "InvertAll" Public ReadOnly Property InvertAll_Command As ICommand Get If m_cmdInvertAll Is Nothing Then m_cmdInvertAll = New Command(AddressOf InvertAll) End If Return m_cmdInvertAll End Get End Property Public Sub InvertAll() If IsNothing(ProjectManagerVM.CurrProd) OrElse IsNothing(Map.refProjectVM.BTLStructureVM) Then Return ' se modalita' assemblato Dim bShowBuilding As Boolean = Map.refShowBeamPanelVM.ShowBuilding_IsChecked If bShowBuilding AndAlso Map.refShowBeamPanelVM.bShowAll Then ' devo smontarlo prima di calcolare le travi, altrimenti non trova i pezzi Map.refProjectVM.BTLStructureVM.ShowBuilding(False, False) End If ' inverto i pezzi selezionati For Each Part In Map.refProjectVM.BTLStructureVM.SelBTLParts Part.Invert() Next ' se assemblato lo ripristino If bShowBuilding Then Map.refProjectVM.BTLStructureVM.ShowBuilding(True, False) End Sub #End Region ' InvertAll #Region "ResetCalc" Public ReadOnly Property ResetCalc_Command As ICommand Get If m_cmdResetCalc Is Nothing Then m_cmdResetCalc = New Command(AddressOf ResetCalc) End If Return m_cmdResetCalc End Get End Property Public Sub ResetCalc() If (IsNothing(ProjectManagerVM.CurrProd) OrElse IsNothing(Map.refProjectVM.BTLStructureVM) OrElse IsNothing(Map.refProjectVM.MachGroupPanelVM)) Then Return Map.refShowBeamPanelVM.ShowBuilding_IsEnabled = True Map.refCALCPanelVM.SetCalculating(False) For Each Part In Map.refProjectVM.BTLStructureVM.BTLPartVMList If Part.nGlobalState <> CalcStates.NOTCALCULATED Then ' Resetto info If MyExecProcessManager.sInfoNgePartList.Count > 0 Then For Each InfoNgePart As String In MyExecProcessManager.sInfoNgePartList Dim sInfoNgePart As String() = InfoNgePart.Split("="c) EgtRemoveInfo(Part.nPartId, sInfoNgePart(0)) Next End If ' resetto stato dei calcoli Part.ResetCalcTotalPart() End If If Not Part.IsRowEnabled Then Part.SetIsRowEnabled(True) Next End Sub #End Region ' ResetCalc #End Region ' COMMANDS End Class