6591de143a
-migliorato gestione popup
376 lines
13 KiB
VB.net
376 lines
13 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports EgtBEAMWALL.Core
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
Imports System.IO
|
|
|
|
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_OnlyProdPartManagerVisibility As Visibility = Visibility.Collapsed
|
|
Public ReadOnly Property OnlyProdPartManagerVisibility As Visibility
|
|
Get
|
|
Return m_OnlyProdPartManagerVisibility
|
|
End Get
|
|
End Property
|
|
Friend Sub SetOnlyProdPartManager_Visibility(value As Visibility)
|
|
m_OnlyProdPartManagerVisibility = value
|
|
NotifyPropertyChanged(NameOf(OnlyProdPartManagerVisibility))
|
|
End Sub
|
|
|
|
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
|
|
|
|
' Definizione comandi
|
|
Private m_cmdVerifyAll As ICommand
|
|
Private m_cmdShowPopUpFilterBtnCmd As ICommand
|
|
Private m_cmdBackRotation As ICommand
|
|
Private m_cmdInvert 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
|
|
|
|
#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
|
|
|
|
' funzione che gestisce risposta da thread di verifica, aggiorna progress e segnala comando di interruzione
|
|
Private Sub ManageCalc(dProgress As Double, sProgress As String, ByRef bCancel As Boolean)
|
|
If dProgress = 0 Then
|
|
Map.refMyStatusBarVM.SetLoadingProgress_Visibility(True)
|
|
Map.refMyStatusBarVM.SetStopProgress_IsActive(True)
|
|
Map.refMyStatusBarVM.SetStopProgress_IsEnabled(True)
|
|
Map.refMyStatusBarVM.SetOutputMessage(sProgress)
|
|
Map.refMyStatusBarVM.SetStopProgress_IsActive(True)
|
|
Map.refMyStatusBarVM.SetStopProgress_IsEnabled(True)
|
|
ElseIf dProgress = 1 Then
|
|
Map.refMyStatusBarVM.SetLoadingProgress_Visibility(False)
|
|
Map.refMyStatusBarVM.SetStopProgress_IsActive(False)
|
|
Map.refMyStatusBarVM.SetStopProgress_IsEnabled(False)
|
|
Map.refMyStatusBarVM.SetOutputMessage(sProgress, 3)
|
|
End If
|
|
bCancel = Map.refMyStatusBarVM.bStopProgress
|
|
Map.refMyStatusBarVM.SetLoadingProgress(dProgress * 100)
|
|
Map.refMyStatusBarVM.SetOutputMessage(sProgress)
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "VerifyAll"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Open.
|
|
''' </summary>
|
|
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
|
|
|
|
''' <summary>
|
|
''' Execute the Open. This method is invoked by the OpenCommand.
|
|
''' </summary>
|
|
Friend Sub VerifyAll()
|
|
If (Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE AndAlso (IsNothing(ProjectManagerVM.CurrProj) OrElse IsNothing(Map.refProjectVM.BTLStructureVM)) AndAlso (IsNothing(ProjectManagerVM.CurrProd) OrElse IsNothing(Map.refProjectVM.MachGroupPanelVM))) Then Return
|
|
' se modalita' assemblato
|
|
If Map.refShowBeamPanelVM.ShowBuilding_IsChecked 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
|
|
Dim BarList() As EgtBEAMWALL.Core.Bar = Nothing
|
|
Dim ProjType As BWType = ProjectManagerVM.CurrProd.nType
|
|
If Not CreateBarListToVerify(ProjType, BarList) Then Return
|
|
' lancio calcolo
|
|
EgtBEAMWALL.Core.CalcIntegration.Run(BarList, ProjectManagerVM.CurrProj.sProjDirPath, AddressOf ManageCalc)
|
|
End Sub
|
|
|
|
Private Function CreateBarListToVerify(ProjType As BWType, ByRef BarList As Bar()) As Boolean
|
|
Dim TempBarList As New List(Of EgtBEAMWALL.Core.Bar)
|
|
For PartIndex = 0 To Map.refProjectVM.BTLStructureVM.BTLPartVMList.Count - 1
|
|
Dim CurrPart As BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList(PartIndex)
|
|
If Not CurrPart.bDO Then Continue For
|
|
Dim Bar As New EgtBEAMWALL.Core.Bar With {.nBarId = CurrPart.nPartId,
|
|
.nProgramPage = ProjectType.PROJ,
|
|
.nProjType = ProjType,
|
|
.bBarOk = True,
|
|
.nMachineName = Map.refMachinePanelVM.SelectedMachine.Name,
|
|
.nGlobState = CurrPart.nGlobalState}
|
|
Select Case CurrPart.nGlobalState
|
|
Case Core.CalcStates.OK, CalcStates.INFO
|
|
Bar.nCmdType = CalcIntegration.CmdTypes.GENERATE
|
|
Case Else
|
|
If CurrPart.nGlobalState = CalcStates.NOTCALCULATED OrElse CurrPart.nFeaturesGlobalState > CalcStates.INFO Then
|
|
Dim sBTLPartFilePath As String = ProjectManagerVM.CurrProj.sProjDirPath & "\" & CurrPart.nPDN.ToString() & ".ori.bwe"
|
|
If File.Exists(sBTLPartFilePath) Then File.Delete(sBTLPartFilePath)
|
|
End If
|
|
Bar.nCmdType = CalcIntegration.CmdTypes.CHECKNOSIM
|
|
End Select
|
|
TempBarList.Add(Bar)
|
|
Next
|
|
BarList = TempBarList.ToArray()
|
|
' disabilito interfaccia
|
|
Map.refProjectVM.SetCalcRunning(True)
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' VerifyAll
|
|
|
|
#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 "BackRotation"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Exec.
|
|
''' </summary>
|
|
Public ReadOnly Property BackRotation_Command As ICommand
|
|
Get
|
|
If m_cmdBackRotation Is Nothing Then
|
|
m_cmdBackRotation = New Command(AddressOf BackRotation)
|
|
End If
|
|
Return m_cmdBackRotation
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Exec. This method is invoked by the ExecCommand.
|
|
''' </summary>
|
|
Public Sub BackRotation()
|
|
If IsNothing(ProjectManagerVM.CurrProj) 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 ' BackRotation
|
|
|
|
#Region "Invert"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Exec.
|
|
''' </summary>
|
|
Public ReadOnly Property Invert_Command As ICommand
|
|
Get
|
|
If m_cmdInvert Is Nothing Then
|
|
m_cmdInvert = New Command(AddressOf Invert)
|
|
End If
|
|
Return m_cmdInvert
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Exec. This method is invoked by the ExecCommand.
|
|
''' </summary>
|
|
Public Sub Invert()
|
|
If ((Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE) AndAlso IsNothing(ProjectManagerVM.CurrProj)) 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 ' Invert
|
|
|
|
#Region "ResetCalc"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Exec.
|
|
''' </summary>
|
|
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
|
|
|
|
''' <summary>
|
|
''' Execute the Exec. This method is invoked by the ExecCommand.
|
|
''' </summary>
|
|
Public Sub ResetCalc()
|
|
If (Map.refMainMenuVM.SelPage = Pages.ONLYPRODPAGE AndAlso (IsNothing(ProjectManagerVM.CurrProj) OrElse IsNothing(Map.refProjectVM.BTLStructureVM)) AndAlso (IsNothing(ProjectManagerVM.CurrProd) OrElse IsNothing(Map.refProjectVM.MachGroupPanelVM))) Then Return
|
|
For Each Part In Map.refProjectVM.BTLStructureVM.BTLPartVMList
|
|
If Part.nGlobalState <> CalcStates.NOTCALCULATED Then
|
|
' resetto stato dei calcoli
|
|
Part.ResetCalcTotalPart()
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
#End Region ' ResetCalc
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|