Files
EgtWPFLib5/OptionPanel/EstimationsVM.vb
T
Renzo Lanza 088886dd1b EgtWPFLib5 2.2j1 :
- Spostamento VM e funzioni generiche di Simulazione e Stime da EgtCAM5 e OmagOFFICE alla Libreria
2020-10-01 08:13:11 +00:00

143 lines
3.9 KiB
VB.net

Imports System.Collections.ObjectModel
Imports System.IO
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)
Dim sTotalTime As New TimeSpan(0, 0, nTotalTime)
Return sTotalTime.ToString("hh\:mm\:ss")
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(MSG_ESTIMATIONS + 19) 'Stime
End Get
End Property
Public ReadOnly Property TimeMsg As String
Get
Return EgtMsg(MSG_ESTIMATIONS + 15) 'Tempo totale
End Get
End Property
Public ReadOnly Property CutLenMsg As String
Get
Return EgtMsg(MSG_ESTIMATIONS + 16) 'Lunghezza totale
End Get
End Property
Public ReadOnly Property NetAreaMsg As String
Get
Return EgtMsg(MSG_ESTIMATIONS + 17) 'Area utilizzata
End Get
End Property
Public ReadOnly Property UsageMsg As String
Get
Return EgtMsg(MSG_ESTIMATIONS + 18) 'Percentuale di utilizzo
End Get
End Property
Public ReadOnly Property DetailsMsg As String
Get
Return EgtMsg(MSG_ESTIMATIONS + 20) '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