Files
EgtWPFLib5/OptionPanel/EstimationsVM.vb
2025-03-21 23:42:17 +01:00

145 lines
4.0 KiB
VB.net

Imports EgtUILib
Public Class EstimationsVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Public ReadOnly Property Time As String
Get
Dim nTotalTime As Integer = 0
EgtGetInfo(EgtGetCurrMachGroup(), "Ttot", nTotalTime)
' Non si usa TimeSpan per la conversione in stringa perchè oltre le 24 ore usa i giorni
Dim nH As Integer = nTotalTime \ 3600
Dim nM As Integer = ( nTotalTime - nH * 3600) \ 60
Dim nS As Integer = ( nTotalTime - nH * 3600 - nM * 60)
Dim sTotalTime As String = nH.ToString() & ":" & nM.ToString( "D2") & ":" & nS.ToString( "D2")
Return sTotalTime
End Get
End Property
Public ReadOnly Property CutLen As String
Get
Dim dTotalLength As Double = 0
EgtGetInfo(EgtGetCurrMachGroup(), "Ltot", dTotalLength)
Dim sTotalLength As String = ""
If EgtUiUnitsAreMM() Then
sTotalLength = DoubleToString(dTotalLength / 1000, 1) & " m"
Else
sTotalLength = DoubleToString(dTotalLength / (ONEINCH * 12), 1) & " ft"
End If
Return sTotalLength
End Get
End Property
Public ReadOnly Property NetArea As String
Get
Dim dNetArea As Double = 0
EgtGetInfo(EgtGetCurrMachGroup(), "NetArea", dNetArea)
Dim sTotalLength As String = ""
If EgtUiUnitsAreMM() Then
sTotalLength = DoubleToString(dNetArea / 1000000, 1) & ""
Else
sTotalLength = DoubleToString(dNetArea / (ONEINCH * 12 * ONEINCH * 12), 1) & " ft²"
End If
Return sTotalLength
End Get
End Property
Public ReadOnly Property Usage As String
Get
Dim dRawArea As Integer = 0
EgtGetInfo(EgtGetCurrMachGroup(), "RawArea", dRawArea)
Dim dNetArea As Double = 0
EgtGetInfo(EgtGetCurrMachGroup(), "NetArea", dNetArea)
Dim dUsage As Double = If(dRawArea > EPS_SMALL, dNetArea / dRawArea, 1)
Return DoubleToString(dUsage * 100, 1) & " %"
End Get
End Property
' Definizione comandi
Private m_cmdDetails As ICommand
#Region "Messages"
Public ReadOnly Property EstimationMsg As String
Get
Return EgtMsg(90569) 'Stime
End Get
End Property
Public ReadOnly Property TimeMsg As String
Get
Return EgtMsg(90565) 'Tempo totale
End Get
End Property
Public ReadOnly Property CutLenMsg As String
Get
Return EgtMsg(90566) 'Lunghezza totale
End Get
End Property
Public ReadOnly Property NetAreaMsg As String
Get
Return EgtMsg(90567) 'Area utilizzata
End Get
End Property
Public ReadOnly Property UsageMsg As String
Get
Return EgtMsg(90568) 'Percentuale di utilizzo
End Get
End Property
Public ReadOnly Property DetailsMsg As String
Get
Return EgtMsg(90570) 'Dettagli
End Get
End Property
#End Region ' Messages
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Public Overridable Function GetEstimationFileName(bAskSave As Boolean, ByRef sEstFile As String, ByRef sInfo As String) As Boolean
Return True
End Function
#Region "Details"
''' <summary>
''' Returns a command that create a new tool.
''' </summary>
Public ReadOnly Property Details_Command As ICommand
Get
If m_cmdDetails Is Nothing Then
m_cmdDetails = New Command(AddressOf Details)
End If
Return m_cmdDetails
End Get
End Property
''' <summary>
''' Creata the new tool. This method is invoked by the NewCommand.
''' </summary>
Public Overridable Sub Details(ByVal param As Object)
End Sub
#End Region ' Details
#End Region
End Class