0851ba19d0
- Implementato uso della EgtSaveFileDialog da EgtWPFLib5. - Abbozzata gestione dei file per GunStock. - Aggiunta virtualizzazione dell'albero dei layer. - Corretta visualizzazione pallini colorati nell'albero dei layer. - Miglioramenti nel salvataggio delle MTable e selezione di quella corrente. - Aggiunto colore Egaltech1 in IniFile per poterlo usare da codice.
696 lines
26 KiB
VB.net
696 lines
26 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.Collections.ObjectModel
|
|
Imports System.Text.RegularExpressions
|
|
Imports System.IO
|
|
Imports EgtUILib
|
|
Imports EgtCAM5.MachineModel
|
|
|
|
Public Class MTableListBoxItem
|
|
Implements INotifyPropertyChanged
|
|
|
|
Private m_Visibility As Visibility
|
|
Public Property Visibility As Visibility
|
|
Get
|
|
Return m_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_Visibility = value
|
|
NotifyPropertyChanged("Visibility")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsSelected As Boolean
|
|
Public Property IsSelected As Boolean
|
|
Get
|
|
Return m_IsSelected
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value <> m_IsSelected Then
|
|
m_IsSelected = value
|
|
If value Then
|
|
ReadMTableFile()
|
|
SelectedAssociation = If(m_AssociationList.Count > 0, m_AssociationList(0), Nothing)
|
|
ElseIf IsModified() OrElse String.IsNullOrEmpty(m_TableNamePath) Then
|
|
' chiedo se salvare la tabella corrente prima di passare alla successiva
|
|
If MessageBox.Show(EgtMsg(MSG_DOORS + 7), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
|
|
Application.Msn.NotifyColleagues(Application.SAVEDOORTABLE, Me)
|
|
ElseIf String.IsNullOrEmpty(m_TableNamePath) Then
|
|
Visibility = Windows.Visibility.Collapsed
|
|
End If
|
|
End If
|
|
NotifyPropertyChanged("IsSelected")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Friend SharedMachIndex As Integer = 0
|
|
|
|
Friend Shared NewMTableIndex As Integer = 0
|
|
|
|
Friend m_TableNamePath As String
|
|
Public ReadOnly Property TableNamePath As String
|
|
Get
|
|
Return m_TableNamePath
|
|
End Get
|
|
End Property
|
|
|
|
Private m_TableName As String
|
|
Public Property TableName As String
|
|
Get
|
|
Return m_TableName
|
|
End Get
|
|
Set(value As String)
|
|
m_TableName = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_ActiveTable As Boolean
|
|
Public Property ActiveTable As Boolean
|
|
Get
|
|
Return m_ActiveTable
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value <> m_ActiveTable Then
|
|
m_ActiveTable = value
|
|
NotifyPropertyChanged("StateColor")
|
|
End If
|
|
m_ActiveTable = value
|
|
End Set
|
|
End Property
|
|
|
|
Public ReadOnly Property StateColor As Brush
|
|
Get
|
|
If ActiveTable Then
|
|
Return IniFile.EgaltechBlue1
|
|
Else
|
|
Return Brushes.Transparent
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Private m_ActiveMachinesList As New ObservableCollection(Of MTableMachineListBoxItem)
|
|
Public Property ActiveMachinesList As ObservableCollection(Of MTableMachineListBoxItem)
|
|
Get
|
|
Return m_ActiveMachinesList
|
|
End Get
|
|
Set(value As ObservableCollection(Of MTableMachineListBoxItem))
|
|
m_ActiveMachinesList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_AssociationList As New ObservableCollection(Of MTableAssociationGridBoxItem)
|
|
Public Property AssociationList As ObservableCollection(Of MTableAssociationGridBoxItem)
|
|
Get
|
|
Return m_AssociationList
|
|
End Get
|
|
Set(value As ObservableCollection(Of MTableAssociationGridBoxItem))
|
|
m_AssociationList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelectedAssociation As MTableAssociationGridBoxItem
|
|
Public Property SelectedAssociation As MTableAssociationGridBoxItem
|
|
Get
|
|
Return m_SelectedAssociation
|
|
End Get
|
|
Set(value As MTableAssociationGridBoxItem)
|
|
m_SelectedAssociation = value
|
|
End Set
|
|
End Property
|
|
|
|
' Lista dei MachId per ComboBox nella DataGrid
|
|
Friend m_MachIdList As New ObservableCollection(Of Integer)
|
|
Public Property MachIdList As ObservableCollection(Of Integer)
|
|
Get
|
|
Return m_MachIdList
|
|
End Get
|
|
Set(value As ObservableCollection(Of Integer))
|
|
m_MachIdList = value
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(sTableName As String, sTableNamePath As String)
|
|
TableName = sTableName
|
|
m_TableNamePath = sTableNamePath
|
|
End Sub
|
|
|
|
Private Sub ReadMTableFile()
|
|
If String.IsNullOrEmpty(m_TableNamePath) Then
|
|
SharedMachIndex += 1
|
|
ActiveMachinesList.Add(New MTableMachineListBoxItem(String.Empty, False, False, SharedMachIndex))
|
|
m_MachIdList.Add(SharedMachIndex)
|
|
AssociationList.Add(New MTableAssociationGridBoxItem(False, String.Empty, Nothing, 0, String.Empty, String.Empty, String.Empty, String.Empty, ActiveMachinesList))
|
|
Return
|
|
End If
|
|
' resetto indici macchine impostati in tabella
|
|
SharedMachIndex = 0
|
|
m_MachIdList.Clear()
|
|
' resetto lista macchine ed associazioni prima di rileggerle
|
|
m_ActiveMachinesList.Clear()
|
|
m_AssociationList.Clear()
|
|
ReadDoorsTable(Me)
|
|
End Sub
|
|
|
|
Private Function SearchKey(sLine As String, sKey As String) As String
|
|
Dim x = Regex.Match(sLine, "[,|{|\s]" & sKey & "\s*=\s*['|\""]?(.*?)\s*?[,|}|'|\""]").Groups(1).Value
|
|
Return Regex.Match(sLine, "[,|{|\s]" & sKey & "\s*=\s*['|\""]?(.*?)\s*?[,|}|'|\""]").Groups(1).Value
|
|
End Function
|
|
|
|
Public Function CountCharacter(ByVal sLine As String, ByVal cValue As Char) As Integer
|
|
Dim nCount As Integer = 0
|
|
Dim cArray() As Char = sLine.ToCharArray
|
|
For Index As Integer = 0 To cArray.Count - 1
|
|
If cArray(Index) = cValue Then nCount += 1
|
|
Next
|
|
Return nCount
|
|
End Function
|
|
|
|
Public Function IsModified() As Boolean
|
|
Dim CurrIsModified As Boolean = False
|
|
For Index As Integer = 0 To m_ActiveMachinesList.Count - 1
|
|
If m_ActiveMachinesList(Index).m_IsModified = True Then
|
|
Return True
|
|
End If
|
|
Next
|
|
For Index = 0 To m_AssociationList.Count - 1
|
|
If m_AssociationList(Index).m_IsModified = True Then
|
|
Return True
|
|
End If
|
|
Next
|
|
Return False
|
|
End Function
|
|
|
|
Public Sub IsModifiedReset()
|
|
For Index As Integer = 0 To m_ActiveMachinesList.Count - 1
|
|
m_ActiveMachinesList(Index).m_IsModified = False
|
|
Next
|
|
For Index = 0 To m_AssociationList.Count - 1
|
|
m_AssociationList(Index).m_IsModified = False
|
|
Next
|
|
End Sub
|
|
|
|
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
|
|
|
Public Sub NotifyPropertyChanged(propName As String)
|
|
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class MTableMachineListBoxItem
|
|
Implements INotifyPropertyChanged
|
|
|
|
' Variabile che indica se questo oggetto è stato modificato
|
|
Friend m_IsModified As Boolean = False
|
|
|
|
' Indice della macchina
|
|
Private m_MachId As Integer
|
|
Public Property MachId As Integer
|
|
Get
|
|
Return m_MachId
|
|
End Get
|
|
Set(value As Integer)
|
|
m_MachId = value
|
|
End Set
|
|
End Property
|
|
|
|
' Lista di macchine per la ComboBox
|
|
Private Shared m_MachinesList As New ObservableCollection(Of String)
|
|
Public Property MachinesList As ObservableCollection(Of String)
|
|
Get
|
|
Return m_MachinesList
|
|
End Get
|
|
Set(value As ObservableCollection(Of String))
|
|
m_MachinesList = value
|
|
End Set
|
|
End Property
|
|
|
|
' Macchina selezionata
|
|
Private m_SelectedMachine As String
|
|
Public Property SelectedMachine As String
|
|
Get
|
|
Return m_SelectedMachine
|
|
End Get
|
|
Set(value As String)
|
|
m_IsModified = True
|
|
m_SelectedMachine = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_NcGenerate As Boolean
|
|
Public Property NcGenerate As Boolean
|
|
Get
|
|
Return m_NcGenerate
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_IsModified = True
|
|
m_NcGenerate = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Makeraw As Boolean
|
|
Public Property Makeraw As Boolean
|
|
Get
|
|
Return m_Makeraw
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_IsModified = True
|
|
m_Makeraw = value
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(sMachName As String, bNcGenerate As Boolean, bMakeraw As Boolean, nMachId As Integer)
|
|
If m_MachinesList.Count = 0 Then
|
|
SearchMachine()
|
|
End If
|
|
SelectedMachine = sMachName
|
|
NcGenerate = bNcGenerate
|
|
Makeraw = bMakeraw
|
|
MachId = nMachId
|
|
m_IsModified = False
|
|
End Sub
|
|
|
|
' Funzione che cerca tutte le macchine disponibili per aggiungerle alla lista della ComboBox
|
|
Private Sub SearchMachine()
|
|
' aggiungo elemento stringa vuota per dare la possibilità di non selezionarne nessuna macchina
|
|
MachinesList.Add(String.Empty)
|
|
' aggiungo tutte le macchine
|
|
Dim TempArray As String() = Directory.GetDirectories(IniFile.m_sMachinesRoot)
|
|
For i As Integer = 0 To TempArray.Count - 1
|
|
Dim MachinePathIni As String = TempArray(i) & "\" & Path.GetFileName(TempArray(i)) & ".ini"
|
|
If File.Exists(MachinePathIni) Then
|
|
MachinesList.Add(Path.GetFileName(TempArray(i)))
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
|
|
|
Public Sub NotifyPropertyChanged(propName As String)
|
|
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class MTableAssociationGridBoxItem
|
|
Implements INotifyPropertyChanged
|
|
|
|
' Variabile che indica se questo oggetto è stato modificato
|
|
Friend m_IsModified As Boolean = False
|
|
|
|
' Riferimento alla lista di macchine attive per la tabella a cui appartiene questa associazione
|
|
Private m_ActiveMachinesList As ObservableCollection(Of MTableMachineListBoxItem)
|
|
|
|
Private m_OnPar As Boolean
|
|
Public Property OnPar As Boolean
|
|
Get
|
|
Return m_OnPar
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_IsModified = True
|
|
m_OnPar = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared m_NamesList As ObservableCollection(Of String)
|
|
Public Property NamesList As ObservableCollection(Of String)
|
|
Get
|
|
Return m_NamesList
|
|
End Get
|
|
Set(value As ObservableCollection(Of String))
|
|
If value IsNot m_NamesList Then
|
|
m_NamesList = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Name As String
|
|
Public Property Name As String
|
|
Get
|
|
Return m_Name
|
|
End Get
|
|
Set(value As String)
|
|
If m_NamesList.Contains(value) Then
|
|
m_IsModified = True
|
|
m_Name = value
|
|
Else
|
|
m_Name = String.Empty
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared m_OperationsList As ObservableCollection(Of String)
|
|
Public Property OperationsList As ObservableCollection(Of String)
|
|
Get
|
|
Return m_OperationsList
|
|
End Get
|
|
Set(value As ObservableCollection(Of String))
|
|
m_OperationsList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Oper As String
|
|
Public Property Oper As String
|
|
Get
|
|
Return m_Oper
|
|
End Get
|
|
Set(value As String)
|
|
m_IsModified = True
|
|
m_Oper = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_MachId As Integer
|
|
Public Property MachId As Integer
|
|
Get
|
|
Return m_MachId
|
|
End Get
|
|
Set(value As Integer)
|
|
If value <> m_MachId Then
|
|
m_IsModified = True
|
|
m_MachId = value
|
|
' Riverifico che il numero di macchine non sia cambiato
|
|
If m_MachId > 1 Then
|
|
If m_DrillingList.Count <> m_ActiveMachinesList.Count Then
|
|
For Index As Integer = m_DrillingList.Count To m_ActiveMachinesList.Count - 1
|
|
m_DrillingList.Add(New List(Of String))
|
|
m_SawingList.Add(New List(Of String))
|
|
m_MillingList.Add(New List(Of String))
|
|
m_PocketingList.Add(New List(Of String))
|
|
m_MortisingList.Add(New List(Of String))
|
|
m_SawRoughingList.Add(New List(Of String))
|
|
m_SawFinishingList.Add(New List(Of String))
|
|
Next
|
|
End If
|
|
End If
|
|
' Assegno alla lista delle lavorazioni della riga selezionata la lista di quelle del suo tipo
|
|
If IsNothing(m_SelectedMachType) Then
|
|
MachList = Nothing
|
|
Else
|
|
UpdateMachiningLists()
|
|
End If
|
|
' Verifico se i nomi già presenti per Mach, MachUp e MachDw sono validi per la nuova macchina
|
|
EgtSetCurrMachine(m_ActiveMachinesList(value - 1).SelectedMachine)
|
|
Dim nMachType As Integer = GDB_ID.NULL
|
|
If Not String.IsNullOrEmpty(m_Mach) Then
|
|
EgtMdbSetCurrMachining(m_Mach)
|
|
If Not EgtMdbSetCurrMachining(m_Mach) Then
|
|
Mach = String.Empty
|
|
NotifyPropertyChanged("Mach")
|
|
End If
|
|
End If
|
|
If Not String.IsNullOrEmpty(m_MachUp) Then
|
|
If Not EgtMdbSetCurrMachining(m_MachUp) Then
|
|
MachUp = String.Empty
|
|
NotifyPropertyChanged("MachUp")
|
|
End If
|
|
End If
|
|
If Not String.IsNullOrEmpty(m_MachDw) Then
|
|
If Not EgtMdbSetCurrMachining(m_MachDw) Then
|
|
MachDw = String.Empty
|
|
NotifyPropertyChanged("MachDw")
|
|
End If
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared m_ShiftList As New ObservableCollection(Of Integer)({0, 1})
|
|
Public ReadOnly Property ShiftList As ObservableCollection(Of Integer)
|
|
Get
|
|
Return m_ShiftList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_Shift As Integer
|
|
Public Property Shift As Integer
|
|
Get
|
|
Return m_Shift
|
|
End Get
|
|
Set(value As Integer)
|
|
m_IsModified = True
|
|
m_Shift = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared m_MachTypeList As ObservableCollection(Of MachineModel.MachiningsType)
|
|
Public Property MachTypeList As ObservableCollection(Of MachineModel.MachiningsType)
|
|
Get
|
|
Return m_MachTypeList
|
|
End Get
|
|
Set(value As ObservableCollection(Of MachineModel.MachiningsType))
|
|
m_MachTypeList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelectedMachType As MachineModel.MachiningsType
|
|
Public Property SelectedMachType As MachineModel.MachiningsType
|
|
Get
|
|
Return m_SelectedMachType
|
|
End Get
|
|
Set(value As MachineModel.MachiningsType)
|
|
If Not IsNothing(value) Then
|
|
m_SelectedMachType = value
|
|
' Assegno alla lista delle lavorazioni della riga selezionata la lista di quelle del suo tipo
|
|
If IsNothing(m_SelectedMachType) Then
|
|
MachList = Nothing
|
|
Else
|
|
UpdateMachiningLists()
|
|
End If
|
|
' Annullo i valori di Mach, MachUp e MachDw
|
|
Mach = String.Empty
|
|
NotifyPropertyChanged("Mach")
|
|
MachUp = String.Empty
|
|
NotifyPropertyChanged("MachUp")
|
|
MachDw = String.Empty
|
|
NotifyPropertyChanged("MachDw")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
' Funzione che in base al tipo di lavorazione e alla macchina selezionati, imposta la lista delle lavorazioni per le combo
|
|
Private Sub UpdateMachiningLists()
|
|
Select Case m_SelectedMachType.TypeId
|
|
Case MCH_MY.DRILLING
|
|
' se la lista è vuota devo caricarla
|
|
If m_DrillingList(m_MachId - 1).Count = 0 Then
|
|
m_DrillingList(m_MachId - 1) = New List(Of String)
|
|
EgtSetCurrMachine(m_ActiveMachinesList(m_MachId - 1).SelectedMachine)
|
|
LoadMachiningListByType(m_DrillingList(m_MachId - 1), MCH_MY.DRILLING)
|
|
' aggiungo elemento vuoto per poter non impostare alcuna lavorazione
|
|
m_DrillingList(m_MachId - 1).Insert(0, String.Empty)
|
|
End If
|
|
MachList = New ObservableCollection(Of String)(m_DrillingList(m_MachId - 1))
|
|
Case MCH_MY.SAWING
|
|
' se la lista è vuota devo caricarla
|
|
If m_SawingList(m_MachId - 1).Count = 0 Then
|
|
m_SawingList(m_MachId - 1) = New List(Of String)
|
|
EgtSetCurrMachine(m_ActiveMachinesList(m_MachId - 1).SelectedMachine)
|
|
LoadMachiningListByType(m_SawingList(m_MachId - 1), MCH_MY.SAWING)
|
|
' aggiungo elemento vuoto per poter non impostare alcuna lavorazione
|
|
m_SawingList(m_MachId - 1).Insert(0, String.Empty)
|
|
End If
|
|
MachList = New ObservableCollection(Of String)(m_SawingList(m_MachId - 1))
|
|
Case MCH_MY.MILLING
|
|
' se la lista è vuota devo caricarla
|
|
If m_MillingList(m_MachId - 1).Count = 0 Then
|
|
m_MillingList(m_MachId - 1) = New List(Of String)
|
|
EgtSetCurrMachine(m_ActiveMachinesList(m_MachId - 1).SelectedMachine)
|
|
LoadMachiningListByType(m_MillingList(m_MachId - 1), MCH_MY.MILLING)
|
|
' aggiungo elemento vuoto per poter non impostare alcuna lavorazione
|
|
m_MillingList(m_MachId - 1).Insert(0, String.Empty)
|
|
End If
|
|
MachList = New ObservableCollection(Of String)(m_MillingList(m_MachId - 1))
|
|
Case MCH_MY.POCKETING
|
|
' se la lista è vuota devo caricarla
|
|
If m_PocketingList(m_MachId - 1).Count = 0 Then
|
|
m_PocketingList(m_MachId - 1) = New List(Of String)
|
|
EgtSetCurrMachine(m_ActiveMachinesList(m_MachId - 1).SelectedMachine)
|
|
LoadMachiningListByType(m_PocketingList(m_MachId - 1), MCH_MY.POCKETING)
|
|
' aggiungo elemento vuoto per poter non impostare alcuna lavorazione
|
|
m_PocketingList(m_MachId - 1).Insert(0, String.Empty)
|
|
End If
|
|
MachList = New ObservableCollection(Of String)(m_PocketingList(m_MachId - 1))
|
|
Case MCH_MY.MORTISING
|
|
' se la lista è vuota devo caricarla
|
|
If m_MortisingList(m_MachId - 1).Count = 0 Then
|
|
m_MortisingList(m_MachId - 1) = New List(Of String)
|
|
EgtSetCurrMachine(m_ActiveMachinesList(m_MachId - 1).SelectedMachine)
|
|
LoadMachiningListByType(m_MortisingList(m_MachId - 1), MCH_MY.MORTISING)
|
|
' aggiungo elemento vuoto per poter non impostare alcuna lavorazione
|
|
m_MortisingList(m_MachId - 1).Insert(0, String.Empty)
|
|
End If
|
|
MachList = New ObservableCollection(Of String)(m_MortisingList(m_MachId - 1))
|
|
Case MCH_MY.SAWROUGHING
|
|
' se la lista è vuota devo caricarla
|
|
If m_SawRoughingList(m_MachId - 1).Count = 0 Then
|
|
m_SawRoughingList(m_MachId - 1) = New List(Of String)
|
|
EgtSetCurrMachine(m_ActiveMachinesList(m_MachId - 1).SelectedMachine)
|
|
LoadMachiningListByType(m_SawRoughingList(m_MachId - 1), MCH_MY.SAWROUGHING)
|
|
' aggiungo elemento vuoto per poter non impostare alcuna lavorazione
|
|
m_SawRoughingList(m_MachId - 1).Insert(0, String.Empty)
|
|
End If
|
|
MachList = New ObservableCollection(Of String)(m_SawRoughingList(m_MachId - 1))
|
|
Case MCH_MY.SAWFINISHING
|
|
' se la lista è vuota devo caricarla
|
|
If m_SawFinishingList(m_MachId - 1).Count = 0 Then
|
|
m_SawFinishingList(m_MachId - 1) = New List(Of String)
|
|
EgtSetCurrMachine(m_ActiveMachinesList(m_MachId - 1).SelectedMachine)
|
|
LoadMachiningListByType(m_SawFinishingList(m_MachId - 1), MCH_MY.SAWFINISHING)
|
|
' aggiungo elemento vuoto per poter non impostare alcuna lavorazione
|
|
m_SawFinishingList(m_MachId - 1).Insert(0, String.Empty)
|
|
End If
|
|
MachList = New ObservableCollection(Of String)(m_SawFinishingList(m_MachId - 1))
|
|
End Select
|
|
End Sub
|
|
|
|
Private m_MachList As ObservableCollection(Of String)
|
|
Public Property MachList As ObservableCollection(Of String)
|
|
Get
|
|
Return m_MachList
|
|
End Get
|
|
Set(value As ObservableCollection(Of String))
|
|
If value IsNot m_MachList Then
|
|
m_MachList = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Mach As String
|
|
Public Property Mach As String
|
|
Get
|
|
Return m_Mach
|
|
End Get
|
|
Set(value As String)
|
|
m_IsModified = True
|
|
m_Mach = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_MachUp As String
|
|
Public Property MachUp As String
|
|
Get
|
|
Return m_MachUp
|
|
End Get
|
|
Set(value As String)
|
|
m_IsModified = True
|
|
m_MachUp = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_MachDw As String
|
|
Public Property MachDw As String
|
|
Get
|
|
Return m_MachDw
|
|
End Get
|
|
Set(value As String)
|
|
m_IsModified = True
|
|
m_MachDw = value
|
|
End Set
|
|
End Property
|
|
|
|
' Liste per le lavorazioni
|
|
Private m_DrillingList As New List(Of List(Of String))
|
|
Private m_SawingList As New List(Of List(Of String))
|
|
Private m_MillingList As New List(Of List(Of String))
|
|
Private m_PocketingList As New List(Of List(Of String))
|
|
Private m_MortisingList As New List(Of List(Of String))
|
|
Private m_SawRoughingList As New List(Of List(Of String))
|
|
Private m_SawFinishingList As New List(Of List(Of String))
|
|
|
|
Sub New(bOn As Boolean, sName As String, nMachId As Integer, nShift As Integer, sOper As String, sMach As String, sMachUp As String, sMachDw As String, ByRef ActiveMachinesList As ObservableCollection(Of MTableMachineListBoxItem))
|
|
' Inizializzo la lista delle lavorazioni solo la prima volta
|
|
If m_DrillingList.Count = 0 Then
|
|
For Index As Integer = 0 To ActiveMachinesList.Count - 1
|
|
m_DrillingList.Add(New List(Of String))
|
|
m_SawingList.Add(New List(Of String))
|
|
m_MillingList.Add(New List(Of String))
|
|
m_PocketingList.Add(New List(Of String))
|
|
m_MortisingList.Add(New List(Of String))
|
|
m_SawRoughingList.Add(New List(Of String))
|
|
m_SawFinishingList.Add(New List(Of String))
|
|
Next
|
|
End If
|
|
OnPar = bOn
|
|
' Inizializzo la lista dei nomi solo la prima volta
|
|
If IsNothing(m_NamesList) Then
|
|
Dim NameFilePath As String = IniFile.m_sTablesRoot & "/" & GEONAMELIST_FILE
|
|
Dim TempNameList As New List(Of String)
|
|
Dim Index As Integer = 1
|
|
Dim sRaedName As String = String.Empty
|
|
While EgtUILib.GetPrivateProfileString(S_GEOMETRYNAMES, Index.ToString, "", sRaedName, NameFilePath) > 0
|
|
TempNameList.Add(sRaedName)
|
|
Index += 1
|
|
End While
|
|
TempNameList.Sort()
|
|
NamesList = New ObservableCollection(Of String)(TempNameList)
|
|
End If
|
|
Name = sName
|
|
'Imposto il riferimento alla lista di macchine di questa tabella
|
|
m_ActiveMachinesList = ActiveMachinesList
|
|
' Verifico che il valore di MachId sia valido altrimento imposto la prima macchina
|
|
If nMachId = 0 Then
|
|
MachId = 1
|
|
Else
|
|
MachId = nMachId
|
|
End If
|
|
If nShift = 1 Then
|
|
Shift = 1
|
|
Else
|
|
Shift = 0
|
|
End If
|
|
' Inizializzo la lista delle operazioni solo la prima volta
|
|
If IsNothing(m_OperationsList) Then
|
|
Dim TempOperList As New List(Of String)
|
|
' aggiungo elemento stringa vuota per dare la possibilità di non selezionarne nessuna operazione
|
|
TempOperList.Add(String.Empty)
|
|
' aggiungo tutte le altre
|
|
Dim OperationFilePath As String = IniFile.m_sTablesRoot & "/" & OPERATIONLIST_FILE
|
|
Dim Index As Integer = 1
|
|
Dim sRaedOperation As String = String.Empty
|
|
While EgtUILib.GetPrivateProfileString(S_OPERATIONS, Index.ToString, "", sRaedOperation, OperationFilePath) > 0
|
|
TempOperList.Add(sRaedOperation)
|
|
Index += 1
|
|
End While
|
|
TempOperList.Sort()
|
|
OperationsList = New ObservableCollection(Of String)(TempOperList)
|
|
End If
|
|
Oper = sOper
|
|
' Inizializzo la lista di tipi di lavorazione solo la prima volta
|
|
If IsNothing(m_MachTypeList) Then
|
|
MachTypeList = New ObservableCollection(Of MachiningsType)(MachineModel.ReadActiveMachiningsFamilies())
|
|
' aggiungo elemento stringa vuota(come primo elemento) per dare la possibilità di non selezionarne nessuna operazione
|
|
MachTypeList.Insert(0, New MachiningsType() With {.TypeId = MCH_MY.NONE, .TypeName = String.Empty})
|
|
End If
|
|
' dall'MId recupero la macchina a cui si riferisce questa associazione e la imposto come corrente
|
|
EgtSetCurrMachine(m_ActiveMachinesList(m_MachId - 1).SelectedMachine)
|
|
' Imposto MachType selezionato cercando il tipo delle lavorazioni
|
|
If EgtMdbSetCurrMachining(sMach) OrElse EgtMdbSetCurrMachining(sMachUp) OrElse EgtMdbSetCurrMachining(sMachDw) Then
|
|
Dim nMachType As Integer = GDB_ID.NULL
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TYPE, nMachType)
|
|
For Index As Integer = 0 To MachTypeList.Count - 1
|
|
If nMachType = MachTypeList(Index).TypeId Then
|
|
SelectedMachType = MachTypeList(Index)
|
|
Exit For
|
|
End If
|
|
Next
|
|
Else
|
|
SelectedMachType = Nothing
|
|
End If
|
|
If Not IsNothing(m_SelectedMachType) Then
|
|
' Imposto i Mach selezionati
|
|
Mach = sMach
|
|
MachUp = sMachUp
|
|
MachDw = sMachDw
|
|
End If
|
|
m_IsModified = False
|
|
End Sub
|
|
|
|
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
|
|
|
Public Sub NotifyPropertyChanged(propName As String)
|
|
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
|
End Sub
|
|
|
|
End Class
|