0fd043b1c6
- aggiunta expander dei parametri GenMachining alle Operazioni - ora viene settata m_sMachineIniPath di EgtWPFLib5 nel costruttore di MachiningParameterExpanderVM (operazione necessaria per alcune ComboBox in Parametri Operazioni se prima non apriamo il Db Lav.)
514 lines
20 KiB
VB.net
514 lines
20 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.Collections.ObjectModel
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class MachiningParameterExpanderVM
|
|
Inherits VMBase
|
|
|
|
Private WithEvents m_CurrOperation As MachiningTreeViewItem
|
|
Public Property CurrOpeartion As MachiningTreeViewItem
|
|
Get
|
|
Return m_CurrOperation
|
|
End Get
|
|
Set(value As MachiningTreeViewItem)
|
|
m_CurrOperation = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_CurrOperation_IsModified As Boolean
|
|
Public Property CurrOpeartion_IsModified As Boolean
|
|
Get
|
|
Return m_CurrOperation_IsModified
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_CurrOperation_IsModified = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_CurrOperation_ErrorOnOperation As Boolean
|
|
Public Property CurrOpeartion_ErrorOnOperation As Boolean
|
|
Get
|
|
Return m_CurrOperation_ErrorOnOperation
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_CurrOperation_ErrorOnOperation = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_UpdateMachiningBtn_Background As SolidColorBrush = Brushes.LightGray
|
|
Public ReadOnly Property UpdateMachiningBtn_Background As SolidColorBrush
|
|
Get
|
|
If m_CurrOperation_ErrorOnOperation Then
|
|
Return Brushes.Red
|
|
ElseIf m_CurrOperation_IsModified Then
|
|
Return Brushes.Gold
|
|
Else
|
|
Return Brushes.LightGray
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_bPreviewTool As Boolean = False
|
|
Private m_nPtEntId As Integer = GDB_ID.NULL
|
|
Public Property ViewTool As Boolean
|
|
Get
|
|
Return m_bPreviewTool
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value Then
|
|
EgtPreparePreviewMachiningTool()
|
|
m_nPtEntId = EgtPreviewMachiningTool(GDB_ID.NULL, MCH_PTM.AFTER)
|
|
m_bPreviewTool = True
|
|
Else
|
|
EgtRemovePreviewMachiningTool()
|
|
m_bPreviewTool = False
|
|
End If
|
|
EgtDraw()
|
|
NotifyPropertyChanged("ViewTool")
|
|
End Set
|
|
End Property
|
|
|
|
Dim WoodDrillParamExpanderV As WoodDrillingParameterExpanderV
|
|
Dim WoodSawParamExpanderV As WoodSawingParameterExpanderV
|
|
Dim WoodMillParamExpanderV As WoodMillingParameterExpanderV
|
|
Dim BeamMillParamExpanderV As BeamMillingParameterExpanderV
|
|
Dim PocketParamExpanderV As PocketingParameterExpanderV
|
|
Dim MortiseParamExpanderV As MortisingParameterExpanderV
|
|
Dim GenMachinParamExpanderV As GenMachiningParameterExpanderV
|
|
Dim ChiselParamExpanderV As ChiselingParameterExpanderV
|
|
Dim StoneSawParamExpanderV As StoneSawingParameterExpanderV
|
|
Dim StoneSawFinishParamExpanderV As StoneSawFinishingParameterExpanderV
|
|
Dim StoneSawRoughParamExpanderV As StoneSawRoughingParameterExpanderV
|
|
Dim StoneMillParamExpanderV As StoneMillingParameterExpanderV
|
|
Dim StoneDrillParamExpanderV As StoneDrillingParameterExpanderV
|
|
Dim SurfFinishParamExpanderV As SurfFinishingParameterExpanderV
|
|
Dim WjParamExpanderV As WaterjettingParameterExpanderV
|
|
|
|
Private Sub Dummy()
|
|
|
|
End Sub
|
|
|
|
Public ReadOnly Property ParamExpanderPageV As ContentControl
|
|
Get
|
|
|
|
' !!! Inizializzo delegati con funzione vuota, per evitare problemi !!!
|
|
MachiningTreeViewItem.m_delRemoveMachining = AddressOf Dummy
|
|
MachiningTreeViewItem.m_delErrorOnMachining = AddressOf Dummy
|
|
MachiningTreeViewItem.m_delIsEnabledBtns = AddressOf Dummy
|
|
FamilyMachiningTreeViewItem.m_delIsEnabledBtns = AddressOf Dummy
|
|
MachiningTreeViewItem.m_delNotifyPropertyChanged = AddressOf Dummy
|
|
FamilyMachiningTreeViewItem.m_delNotifyPropertyChanged = AddressOf Dummy
|
|
|
|
Dim sName = String.Empty
|
|
Dim nType As Integer
|
|
EgtGetMachiningParam(MCH_MP.NAME, sName)
|
|
EgtGetMachiningParam(MCH_MP.TYPE, nType)
|
|
m_CurrOperation = New MachiningTreeViewItem(sName, DirectCast(nType, MCH_MY))
|
|
|
|
WoodDrillParamExpanderV.DataContext = Nothing
|
|
WoodSawParamExpanderV.DataContext = Nothing
|
|
WoodMillParamExpanderV.DataContext = Nothing
|
|
BeamMillParamExpanderV.DataContext = Nothing
|
|
PocketParamExpanderV.DataContext = Nothing
|
|
MortiseParamExpanderV.DataContext = Nothing
|
|
GenMachinParamExpanderV.DataContext = Nothing
|
|
ChiselParamExpanderV.DataContext = Nothing
|
|
StoneSawParamExpanderV.DataContext = Nothing
|
|
StoneSawFinishParamExpanderV.DataContext = Nothing
|
|
StoneSawRoughParamExpanderV.DataContext = Nothing
|
|
StoneMillParamExpanderV.DataContext = Nothing
|
|
StoneDrillParamExpanderV.DataContext = Nothing
|
|
SurfFinishParamExpanderV.DataContext = Nothing
|
|
WjParamExpanderV.DataContext = Nothing
|
|
|
|
m_CurrOperation.ReadOperationParam()
|
|
|
|
IsModified(False)
|
|
ErrorOnOperation(False)
|
|
|
|
' EgtGetMachiningParam(MCH_MP.TYPE, m_Type)
|
|
If IsNothing(nType) Then Return Nothing
|
|
|
|
Dim MatType As MaterialType = EgtWPFLib5.MachiningTreeViewItem.m_MatType
|
|
|
|
Select Case nType
|
|
Case MCH_OY.DRILLING
|
|
If MatType = MaterialType.STONE Then
|
|
StoneDrillParamExpanderV.DataContext = m_CurrOperation
|
|
Return StoneDrillParamExpanderV
|
|
Else
|
|
WoodDrillParamExpanderV.DataContext = m_CurrOperation
|
|
Return WoodDrillParamExpanderV
|
|
End If
|
|
Case MCH_OY.SAWING
|
|
If MatType = MaterialType.STONE Then
|
|
StoneSawParamExpanderV.DataContext = m_CurrOperation
|
|
Return StoneSawParamExpanderV
|
|
Else
|
|
WoodSawParamExpanderV.DataContext = m_CurrOperation
|
|
Return WoodSawParamExpanderV
|
|
End If
|
|
Case MCH_OY.MILLING
|
|
If MatType = MaterialType.BEAM Then
|
|
BeamMillParamExpanderV.DataContext = m_CurrOperation
|
|
Return BeamMillParamExpanderV
|
|
ElseIf MatType = MaterialType.STONE Then
|
|
StoneMillParamExpanderV.DataContext = m_CurrOperation
|
|
Return StoneMillParamExpanderV
|
|
Else
|
|
WoodMillParamExpanderV.DataContext = m_CurrOperation
|
|
Return WoodMillParamExpanderV
|
|
End If
|
|
Case MCH_OY.SAWROUGHING
|
|
StoneSawRoughParamExpanderV.DataContext = m_CurrOperation
|
|
Return StoneSawRoughParamExpanderV
|
|
Case MCH_OY.SAWFINISHING
|
|
StoneSawFinishParamExpanderV.DataContext = m_CurrOperation
|
|
Return StoneSawFinishParamExpanderV
|
|
Case MCH_OY.POCKETING
|
|
PocketParamExpanderV.DataContext = m_CurrOperation
|
|
Return PocketParamExpanderV
|
|
Case MCH_OY.MORTISING
|
|
MortiseParamExpanderV.DataContext = m_CurrOperation
|
|
Return MortiseParamExpanderV
|
|
Case MCH_OY.GENMACHINING
|
|
GenMachinParamExpanderV.DataContext = m_CurrOperation
|
|
Return GenMachinParamExpanderV
|
|
Case MCH_OY.CHISELING
|
|
ChiselParamExpanderV.DataContext = m_CurrOperation
|
|
Return ChiselParamExpanderV
|
|
Case MCH_OY.SURFFINISHING
|
|
SurfFinishParamExpanderV.DataContext = m_CurrOperation
|
|
Return SurfFinishParamExpanderV
|
|
Case MCH_OY.WATERJETTING
|
|
WjParamExpanderV.DataContext = m_CurrOperation
|
|
Return WjParamExpanderV
|
|
End Select
|
|
|
|
'MachiningParameterExpanderItem.ReadOperationParam()
|
|
|
|
Return Nothing
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property UpdateMachiningBtnMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPERATION + 3) 'Applica Lavorazione
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ViewToolBtnMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPERATION + 13) 'Anteprima Utensile
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property NextStepToolBtnMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPERATION + 14) 'Avanti
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property PrevStepToolBtnMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_OPERATION + 15) 'Indietro
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
' Definizione comando
|
|
Private m_cmdNextStepTool As ICommand
|
|
Private m_cmdPrevStepTool As ICommand
|
|
Private m_cmdUpdateMachining As ICommand
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
EgtWPFLib5.MachiningDbWindowVM.m_sMachineIniPath = IniFile.m_sCurrMachIniFilePath
|
|
|
|
WoodDrillParamExpanderV = New WoodDrillingParameterExpanderV
|
|
WoodSawParamExpanderV = New WoodSawingParameterExpanderV
|
|
WoodMillParamExpanderV = New WoodMillingParameterExpanderV
|
|
BeamMillParamExpanderV = New BeamMillingParameterExpanderV
|
|
PocketParamExpanderV = New PocketingParameterExpanderV
|
|
MortiseParamExpanderV = New MortisingParameterExpanderV
|
|
GenMachinParamExpanderV = New GenMachiningParameterExpanderV
|
|
ChiselParamExpanderV = New ChiselingParameterExpanderV
|
|
StoneSawParamExpanderV = New StoneSawingParameterExpanderV
|
|
StoneSawFinishParamExpanderV = New StoneSawFinishingParameterExpanderV
|
|
StoneSawRoughParamExpanderV = New StoneSawRoughingParameterExpanderV
|
|
StoneMillParamExpanderV = New StoneMillingParameterExpanderV
|
|
StoneDrillParamExpanderV = New StoneDrillingParameterExpanderV
|
|
SurfFinishParamExpanderV = New SurfFinishingParameterExpanderV
|
|
WjParamExpanderV = New WaterjettingParameterExpanderV
|
|
|
|
NotifyPropertyChanged("ParamExpanderPageV")
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "NextStepToolCommand"
|
|
|
|
''' <summary>
|
|
''' Restituisce funzione per ricalcolo lavorazione.
|
|
''' </summary>
|
|
Public ReadOnly Property NextStepToolCommand As ICommand
|
|
Get
|
|
If m_cmdNextStepTool Is Nothing Then
|
|
m_cmdNextStepTool = New RelayCommand(AddressOf NextStepTool)
|
|
End If
|
|
Return m_cmdNextStepTool
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Ricalcola una lavorazione.
|
|
''' </summary>
|
|
Public Sub NextStepTool(ByVal param As Object)
|
|
If m_bPreviewTool Then
|
|
Dim nNextId = EgtPreviewMachiningTool(m_nPtEntId, MCH_PTM.AFTER)
|
|
If nNextId <> GDB_ID.NULL Then m_nPtEntId = nNextId
|
|
EgtDraw()
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' NextStepToolCommand
|
|
|
|
#Region "PrevStepToolCommand"
|
|
|
|
''' <summary>
|
|
''' Restituisce funzione per ricalcolo lavorazione.
|
|
''' </summary>
|
|
Public ReadOnly Property PrevStepToolCommand As ICommand
|
|
Get
|
|
If m_cmdPrevStepTool Is Nothing Then
|
|
m_cmdPrevStepTool = New RelayCommand(AddressOf PrevStepTool)
|
|
End If
|
|
Return m_cmdPrevStepTool
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Ricalcola una lavorazione.
|
|
''' </summary>
|
|
Public Sub PrevStepTool(ByVal param As Object)
|
|
If m_bPreviewTool Then
|
|
Dim nPrevId = EgtPreviewMachiningTool(m_nPtEntId, MCH_PTM.BEFORE)
|
|
If nPrevId <> GDB_ID.NULL Then m_nPtEntId = nPrevId
|
|
EgtDraw()
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' PrevStepToolCommand
|
|
|
|
#Region "UpdateMachiningCommand"
|
|
|
|
''' <summary>
|
|
''' Restituisce funzione per ricalcolo lavorazione.
|
|
''' </summary>
|
|
Public ReadOnly Property UpdateMachiningCommand As ICommand
|
|
Get
|
|
If m_cmdUpdateMachining Is Nothing Then
|
|
m_cmdUpdateMachining = New RelayCommand(AddressOf UpdateMachining)
|
|
End If
|
|
Return m_cmdUpdateMachining
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Ricalcola una lavorazione.
|
|
''' </summary>
|
|
Public Sub UpdateMachining(ByVal param As Object)
|
|
' Verifico la presenza di errori: se ci sono li mostro in una MessageBox ed esco da UpdateMachining
|
|
If m_CurrOperation_ErrorOnOperation Then
|
|
Dim sErrorList As String = String.Empty
|
|
For Each [property] As String In EgtWPFLib5.MachiningTreeViewItem.ValidatedProperties
|
|
If Not String.IsNullOrEmpty(m_CurrOperation.GetErrorString([property])) Then
|
|
sErrorList += Environment.NewLine + " - " + m_CurrOperation.GetErrorString([property])
|
|
End If
|
|
Next [property]
|
|
MessageBox.Show(EgtMsg(5423) + sErrorList, EgtMsg(30009), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
|
Return
|
|
End If
|
|
Dim bRecalc As Boolean = ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift)
|
|
' La modifica di alcuni parametri forza il ricalcolo della geometria
|
|
Dim ModifiedGeometry As Boolean = m_CurrOperation.m_IsModifiedSelectedFaceUseType
|
|
' aggiorno valori modificati
|
|
m_CurrOperation.WriteOperationParam()
|
|
' Carico tutta la geometria selezionata in una lista
|
|
Dim SelectedGeometry As New List(Of Integer)
|
|
Dim EntityIndex As Integer = EgtGetFirstSelectedObj()
|
|
While EntityIndex <> GDB_ID.NULL
|
|
SelectedGeometry.Add(EntityIndex)
|
|
EntityIndex = EgtGetNextSelectedObj()
|
|
End While
|
|
' Gestione speciale per superfici ( si aggiunge l'identificazione della faccia)
|
|
If SelectedGeometry.Count() > 0 AndAlso
|
|
(EgtGetType(SelectedGeometry(0)) = GDB_TY.SRF_MESH Or EgtGetType(SelectedGeometry(0)) = GDB_TY.SRF_FRGN) Then
|
|
' Aggiorno lista speciale con facce
|
|
SelData.VerifyIdSub()
|
|
' Verifico se geometria cambiata, confrontando selezione attuale con facet con geometria di lavorazione
|
|
Dim nInd As Integer = 0
|
|
Dim nMchId, nMchSub As Integer
|
|
EgtGetMachiningGeometry(nInd, nMchId, nMchSub)
|
|
Dim nSelId, nSelSub As Integer
|
|
SelData.GetIdSub(nInd, nSelId, nSelSub)
|
|
While Not ModifiedGeometry And (nMchId <> GDB_ID.NULL Or nSelId <> GDB_ID.NULL)
|
|
' Controllo uguaglianza
|
|
If nMchId <> nSelId Or nMchSub <> nSelSub Then ModifiedGeometry = True
|
|
' Passo al successivo
|
|
nInd += 1
|
|
EgtGetMachiningGeometry(nInd, nMchId, nMchSub)
|
|
SelData.GetIdSub(nInd, nSelId, nSelSub)
|
|
End While
|
|
If ModifiedGeometry Then
|
|
Dim vId() As Integer = Nothing
|
|
Dim vSub() As Integer = Nothing
|
|
SelData.GetAllIdSub(vId, vSub)
|
|
EgtSetMachiningGeometry(vId, vSub)
|
|
End If
|
|
' Gestione standard per altre entità (curve, testi, ...)
|
|
Else
|
|
' Verifico se geometria cambiata, confrontando selezione attuale con geometria di lavorazione
|
|
Dim nInd As Integer = 0
|
|
Dim nMchId, nMchSub As Integer
|
|
EgtGetMachiningGeometry(nInd, nMchId, nMchSub)
|
|
Dim nSelId As Integer
|
|
nSelId = If(nInd < SelectedGeometry.Count(), SelectedGeometry(nInd), GDB_ID.NULL)
|
|
While Not ModifiedGeometry And (nMchId <> GDB_ID.NULL Or nSelId <> GDB_ID.NULL)
|
|
' Controllo uguaglianza
|
|
If nMchId <> nSelId Then ModifiedGeometry = True
|
|
' Passo al successivo
|
|
nInd += 1
|
|
EgtGetMachiningGeometry(nInd, nMchId, nMchSub)
|
|
nSelId = If(nInd < SelectedGeometry.Count(), SelectedGeometry(nInd), GDB_ID.NULL)
|
|
End While
|
|
' Imposto geometria selezionata come geometria di lavorazione
|
|
If ModifiedGeometry Then
|
|
EgtSetMachiningGeometry(SelectedGeometry.ToArray)
|
|
End If
|
|
End If
|
|
' Ricalcolo la lavorazione
|
|
If Not EgtApplyMachining(bRecalc Or ModifiedGeometry) Then
|
|
If EgtGetLastMachMgrErrorId() <> 0 Then
|
|
Dim sErr As String = EgtGetLastMachMgrErrorString()
|
|
Dim sInfo As String = String.Empty
|
|
EgtGetOutstrokeInfo(sInfo)
|
|
If Not String.IsNullOrEmpty(sInfo) Then sErr &= " " & sInfo
|
|
MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
|
Else
|
|
MessageBox.Show(EgtMsg(MSG_SIMULATION + 6), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error)
|
|
End If
|
|
Else
|
|
If EgtGetMachMgrWarningId(0) <> 0 Then
|
|
Dim sWarn As String = EgtGetMachMgrWarningString(0)
|
|
Map.refStatusBarVM.NotifyStatusOutput(sWarn)
|
|
Else
|
|
Map.refStatusBarVM.NotifyStatusOutput("")
|
|
End If
|
|
End If
|
|
' Restart visualizzazione utensile
|
|
If m_bPreviewTool Then
|
|
EgtPreparePreviewMachiningTool()
|
|
m_nPtEntId = EgtPreviewMachiningTool(GDB_ID.NULL, MCH_PTM.AFTER)
|
|
End If
|
|
IsModified(False) ' NotifyPropertyChanged("UpdateMachiningBtn_Background")
|
|
ErrorOnOperation(False)
|
|
EgtDraw()
|
|
Map.refProjectVM.EmitTitle()
|
|
End Sub
|
|
|
|
#End Region ' UpdateMachiningCommand
|
|
|
|
#End Region ' Commands
|
|
|
|
Private Sub IsModified(IsModified As Boolean) Handles m_CurrOperation.m_IsModified
|
|
m_CurrOperation_IsModified = IsModified
|
|
' NotifyPropertyChanged("CurrOperation_IsModified")
|
|
NotifyPropertyChanged("UpdateMachiningBtn_Background")
|
|
End Sub
|
|
|
|
Private Sub ErrorOnOperation(ErrorOnOperation As Boolean) Handles m_CurrOperation.m_ErrorOnOperation
|
|
m_CurrOperation_ErrorOnOperation = ErrorOnOperation
|
|
' NotifyPropertyChanged("CurrOperation_ErrorOnOperation")
|
|
NotifyPropertyChanged("UpdateMachiningBtn_Background")
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
''' <summary>
|
|
''' Class that represent a Converter that use machining type and param type, to set the visibility state of the param type.
|
|
''' </summary>
|
|
Public Class OperationParamVisibilityConverter
|
|
Implements IValueConverter
|
|
|
|
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
|
|
Select Case CInt(value)
|
|
Case MCH_OY.NONE
|
|
Return Visibility.Hidden
|
|
Case MCH_OY.DISP
|
|
Return TMDbParamVisibility.OperationDisposition(CInt(parameter))
|
|
Case MCH_OY.DRILLING
|
|
Return TMDbParamVisibility.Drilling(CInt(parameter))
|
|
Case MCH_OY.SAWING
|
|
Return TMDbParamVisibility.Sawing(CInt(parameter))
|
|
Case MCH_OY.MILLING
|
|
Return TMDbParamVisibility.Milling(CInt(parameter))
|
|
Case MCH_OY.POCKETING
|
|
Return TMDbParamVisibility.Pocketing(CInt(parameter))
|
|
Case MCH_OY.MORTISING
|
|
Return TMDbParamVisibility.Mortising(CInt(parameter))
|
|
Case MCH_OY.SAWROUGHING
|
|
Return TMDbParamVisibility.Sawroughing(CInt(parameter))
|
|
Case MCH_OY.SAWFINISHING
|
|
Return TMDbParamVisibility.Sawfinishing(CInt(parameter))
|
|
Case MCH_OY.GENMACHINING
|
|
Return TMDbParamVisibility.GenMachining(CInt(parameter))
|
|
Case MCH_OY.CHISELING
|
|
Return TMDbParamVisibility.Chiseling(CInt(parameter))
|
|
Case MCH_OY.SURFFINISHING
|
|
Return TMDbParamVisibility.SurfFinishing(CInt(parameter))
|
|
Case MCH_OY.WATERJETTING
|
|
Return TMDbParamVisibility.WaterJetting(CInt(parameter))
|
|
Case Else
|
|
Return Visibility.Hidden
|
|
End Select
|
|
End Function
|
|
|
|
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
|
|
Throw New NotImplementedException
|
|
End Function
|
|
|
|
End Class
|
|
|
|
''' <summary>
|
|
''' Class that represent a Converter that convert mm in inch if necessary for the param depth.
|
|
''' </summary>
|
|
Public Class DepthUnitConverter
|
|
Implements IValueConverter
|
|
|
|
Friend Const INCHTOMM As String = "*25.4"
|
|
Friend Const INCHSYMBOL As String = """"
|
|
|
|
|
|
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
|
|
If Not IsNothing(value) Then
|
|
value = CStr(value).Replace(INCHTOMM, INCHSYMBOL)
|
|
End If
|
|
Return value
|
|
End Function
|
|
|
|
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
|
|
If Not IsNothing(value) Then
|
|
value = CStr(value).Replace(INCHSYMBOL, INCHTOMM)
|
|
End If
|
|
Return value
|
|
End Function
|
|
|
|
End Class |