- inizio definizione tipo e modo di import ed export
This commit is contained in:
@@ -160,4 +160,7 @@
|
||||
Public Const PART_NAME = "PartName"
|
||||
Public Const ENTITY_NAME = "EntityName"
|
||||
|
||||
' stringa che identifica il materiale come originale del costruttore
|
||||
Public Const ORIG_MATERIAL As String = "***"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -8,8 +8,15 @@ Public Class ImportExportMachiningPanelVM
|
||||
|
||||
' Modalita' di apertura della finestra
|
||||
Public Enum WindowModeEnum As Integer
|
||||
IMPORT
|
||||
EXPORT
|
||||
IMPORT = 1
|
||||
EXPORT = 2
|
||||
EXPORT_ORIG = 3
|
||||
End Enum
|
||||
|
||||
' Tipo da importare/esportare
|
||||
Public Enum WindowTypeEnum As Integer
|
||||
MATERIAL = 1
|
||||
MACHINING = 2
|
||||
End Enum
|
||||
|
||||
Private m_WindowMode As WindowModeEnum
|
||||
@@ -19,6 +26,13 @@ Public Class ImportExportMachiningPanelVM
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_WindowType As WindowTypeEnum
|
||||
Public ReadOnly Property WindowType As WindowModeEnum
|
||||
Get
|
||||
Return m_WindowType
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Lista delle lavorazioni
|
||||
Private m_MachiningList As New ObservableCollection(Of ImpExpMachiningItem)
|
||||
Public Property MachiningList As ObservableCollection(Of ImpExpMachiningItem)
|
||||
@@ -85,22 +99,62 @@ Public Class ImportExportMachiningPanelVM
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
' export
|
||||
Sub New()
|
||||
m_WindowMode = WindowModeEnum.EXPORT
|
||||
Sub New(Type As WindowTypeEnum, Mode As WindowModeEnum)
|
||||
m_WindowType = Type
|
||||
m_WindowMode = Mode
|
||||
' carico lista lavorazioni
|
||||
MachiningList.Clear()
|
||||
' leggo ed aggiungo le altre
|
||||
Dim nIndex As Integer = 1
|
||||
Dim sGUID As String = ""
|
||||
Dim sName As String = ""
|
||||
Dim sMaterials As String = ""
|
||||
While ReadMachiningParamString(nIndex, MAC_GUID, "", sGUID) > 0
|
||||
Dim Guid As Guid = Guid.Empty
|
||||
Guid.TryParse(sGUID, Guid)
|
||||
ReadMachiningParamString(nIndex, MAC_NAME, "", sName)
|
||||
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, False))
|
||||
nIndex += 1
|
||||
End While
|
||||
Select Case Mode
|
||||
Case WindowModeEnum.EXPORT
|
||||
Select Case Type
|
||||
Case WindowTypeEnum.MATERIAL
|
||||
' leggo ed aggiungo le altre
|
||||
Dim nIndex As Integer = 1
|
||||
Dim sGUID As String = ""
|
||||
Dim sName As String = ""
|
||||
While ReadMaterialParamString(nIndex, MAC_GUID, "", sGUID) > 0
|
||||
Dim sOrigGUID As String = ""
|
||||
ReadMaterialParamString(nIndex, MAT_ORIG, "", sOrigGUID)
|
||||
If sOrigGUID <> ORIG_MATERIAL Then
|
||||
Dim Guid As Guid = Guid.Empty
|
||||
Guid.TryParse(sGUID, Guid)
|
||||
ReadMachiningParamString(nIndex, MAC_NAME, "", sName)
|
||||
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, False))
|
||||
End If
|
||||
nIndex += 1
|
||||
End While
|
||||
Case WindowTypeEnum.MACHINING
|
||||
' leggo ed aggiungo le altre
|
||||
Dim nIndex As Integer = 1
|
||||
Dim sGUID As String = ""
|
||||
Dim sName As String = ""
|
||||
While ReadMachiningParamString(nIndex, MAC_GUID, "", sGUID) > 0
|
||||
Dim Guid As Guid = Guid.Empty
|
||||
Guid.TryParse(sGUID, Guid)
|
||||
ReadMachiningParamString(nIndex, MAC_NAME, "", sName)
|
||||
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, False))
|
||||
nIndex += 1
|
||||
End While
|
||||
End Select
|
||||
Case WindowModeEnum.EXPORT_ORIG
|
||||
If Type = WindowTypeEnum.MATERIAL Then
|
||||
' leggo ed aggiungo le altre
|
||||
Dim nIndex As Integer = 1
|
||||
Dim sGUID As String = ""
|
||||
Dim sName As String = ""
|
||||
While ReadMaterialParamString(nIndex, MAC_GUID, "", sGUID) > 0
|
||||
Dim sOrigGUID As String = ""
|
||||
ReadMaterialParamString(nIndex, MAT_ORIG, "", sOrigGUID)
|
||||
If sOrigGUID = ORIG_MATERIAL Then
|
||||
Dim Guid As Guid = Guid.Empty
|
||||
Guid.TryParse(sGUID, Guid)
|
||||
ReadMachiningParamString(nIndex, MAC_NAME, "", sName)
|
||||
MachiningList.Add(New ImpExpMachiningItem(nIndex, Guid, sName, False))
|
||||
End If
|
||||
nIndex += 1
|
||||
End While
|
||||
End If
|
||||
End Select
|
||||
ImpExpMachiningItem.m_delEnableOkBtn = AddressOf EnableOkBtn
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ Public Class MachiningDbVM
|
||||
End Property
|
||||
|
||||
Public Sub Export()
|
||||
Dim ExportWindow As New ImportExportMachiningPanelV(Application.Current.MainWindow, New ImportExportMachiningPanelVM)
|
||||
Dim ExportWindow As New ImportExportMachiningPanelV(Application.Current.MainWindow, New ImportExportMachiningPanelVM(ImportExportMachiningPanelVM.WindowTypeEnum.MACHINING, ImportExportMachiningPanelVM.WindowModeEnum.EXPORT))
|
||||
ExportWindow.ShowDialog()
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -621,8 +621,6 @@ End Class
|
||||
Public Class StringMaterialParam
|
||||
Inherits MaterialParam
|
||||
|
||||
Public Const DEFAULT_MATERIAL As String = "***"
|
||||
|
||||
Private m_sGUID As String
|
||||
Public Property sGUID As String
|
||||
Get
|
||||
@@ -687,9 +685,9 @@ Public Class StringMaterialParam
|
||||
Case Params.ORIG
|
||||
Dim sOrigGUID As String = ""
|
||||
ReadMaterialParamString(nIndex, MAT_ORIG, "", sOrigGUID)
|
||||
If sOrigGUID = DEFAULT_MATERIAL Then
|
||||
m_sGUID = DEFAULT_MATERIAL
|
||||
m_sValue = DEFAULT_MATERIAL
|
||||
If sOrigGUID = ORIG_MATERIAL Then
|
||||
m_sGUID = ORIG_MATERIAL
|
||||
m_sValue = ORIG_MATERIAL
|
||||
' se livello alto, lo visualizzo comunque
|
||||
If Map.refMainWindowVM.MainWindowM.nUserLevel >= 5 Then
|
||||
m_String_Visibility = Visibility.Visible
|
||||
@@ -744,8 +742,8 @@ Public Class StringMaterialParam
|
||||
|
||||
Public Sub Original()
|
||||
If MessageBox.Show("Are you sure you want to set this material as original?", "Original material confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
|
||||
m_sGUID = DEFAULT_MATERIAL
|
||||
m_sValue = DEFAULT_MATERIAL
|
||||
m_sGUID = ORIG_MATERIAL
|
||||
m_sValue = ORIG_MATERIAL
|
||||
NotifyPropertyChanged(NameOf(sValue))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -161,7 +161,7 @@ Public Class MaterialDbVM
|
||||
If Not IsNothing(General) Then
|
||||
Dim Original As MaterialParam = General.MaterialParamList.FirstOrDefault(Function(x) x.Type = MaterialParam.Params.ORIG)
|
||||
If Not IsNothing(Original) Then
|
||||
If DirectCast(Original, StringMaterialParam).sValue = StringMaterialParam.DEFAULT_MATERIAL Then
|
||||
If DirectCast(Original, StringMaterialParam).sValue = ORIG_MATERIAL Then
|
||||
Return True
|
||||
End If
|
||||
End If
|
||||
@@ -383,8 +383,13 @@ Public Class MaterialDbVM
|
||||
End Property
|
||||
|
||||
Public Sub Export()
|
||||
Dim ExportWindow As New ImportExportMachiningPanelV(Application.Current.MainWindow, New ImportExportMachiningPanelVM)
|
||||
ExportWindow.ShowDialog()
|
||||
Dim ExportMode As ImportExportMachiningPanelVM.WindowModeEnum = ImportExportMachiningPanelVM.WindowModeEnum.EXPORT
|
||||
If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then
|
||||
ExportMode = ImportExportMachiningPanelVM.WindowModeEnum.EXPORT_ORIG
|
||||
End If
|
||||
Dim ExportWindowVM As New ImportExportMachiningPanelVM(ImportExportMachiningPanelVM.WindowTypeEnum.MATERIAL, ExportMode)
|
||||
Dim ExportWindowV As New ImportExportMachiningPanelV(Application.Current.MainWindow, ExportWindowVM)
|
||||
ExportWindowV.ShowDialog()
|
||||
End Sub
|
||||
|
||||
#End Region ' Export
|
||||
|
||||
Reference in New Issue
Block a user