EgtDOORCreator :
- Passaggio a lettura intestazione file DDF per avere i parametri dei componenti.
This commit is contained in:
@@ -1,50 +1,75 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports EgtUILib
|
||||
Imports System.IO
|
||||
|
||||
Public Class CompoPanelViewModel
|
||||
Implements INotifyPropertyChanged
|
||||
Implements INotifyPropertyChanged
|
||||
|
||||
Private m_Door As Door
|
||||
Public Property Door As Door
|
||||
Get
|
||||
Return m_Door
|
||||
End Get
|
||||
Set(value As Door)
|
||||
m_Door = value
|
||||
End Set
|
||||
End Property
|
||||
Private m_rfMainWindowViewModel As MainWindowViewModel
|
||||
Private m_rfDoorParametersViewModel As DoorParametersViewModel
|
||||
|
||||
Private Shared m_CompoBtnList As New ObservableCollection(Of CompoBtn)
|
||||
Public Shared ReadOnly Property CompoBtnList As ObservableCollection(Of CompoBtn)
|
||||
Private Shared m_CompoTypeList As New ObservableCollection(Of CompoType)
|
||||
Public Shared ReadOnly Property CompoTypeList As ObservableCollection(Of CompoType)
|
||||
Get
|
||||
Return m_CompoBtnList
|
||||
Return m_CompoTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(ByRef Door As Door)
|
||||
Me.m_Door = Door
|
||||
' Definizione comando
|
||||
Private m_CmdCompoBtn As ICommand
|
||||
|
||||
Sub New(MainWindowViewModel As MainWindowViewModel)
|
||||
m_rfMainWindowViewModel = MainWindowViewModel
|
||||
m_rfDoorParametersViewModel = DirectCast(m_rfMainWindowViewModel.DoorParameters.DataContext, DoorParametersViewModel)
|
||||
' Lettura file ini per generare bottoni
|
||||
Dim Index As Integer = 1
|
||||
Dim CompoName As String = String.Empty
|
||||
Dim CompoNameDDF As String = String.Empty
|
||||
Dim nCompoName As Integer = 0
|
||||
' ciclo sui Compo
|
||||
While Index <> -1
|
||||
CompoGetPrivateProfileNameGroup(ConstCompo.S_COMPO & Index, ConstCompo.K_NAME, CompoNameDDF, CompoName)
|
||||
' se lo trovo
|
||||
If CompoName = String.Empty Then
|
||||
Index = -1
|
||||
Else
|
||||
m_CompoBtnList.Add(New CompoBtn(CompoName, ConstCompo.S_COMPO & Index, CompoNameDDF, AddressOf Door.AddNewCompo))
|
||||
Index += 1
|
||||
' Carico un vettore con il nome delle Path delle componenti
|
||||
Dim CompoArray() As String = Directory.GetDirectories("c:\EgtData\Doors\Compo")
|
||||
For Index = 0 To CompoArray.Count - 1
|
||||
' apro ogni directory e cerco un file di testo di nome Config.ini
|
||||
Dim CurrCompoPath As String = CompoArray(Index) & "\" & ConstCompo.CONFIGINI_FILE_NAME
|
||||
If File.Exists(CurrCompoPath) Then
|
||||
GetPrivateProfileCompoName(ConstCompo.S_COMPO, ConstCompo.K_NAME, CompoNameDDF, CompoName, CurrCompoPath)
|
||||
m_CompoTypeList.Add(New CompoType(CompoName, CompoNameDDF, CompoArray(Index)))
|
||||
End If
|
||||
End While
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
||||
#Region "COMMANDS"
|
||||
|
||||
Public Sub NotifyPropertyChanged(propName As String)
|
||||
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
||||
End Sub
|
||||
#Region "CompoBtnCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Exec.
|
||||
''' </summary>
|
||||
Public ReadOnly Property CompoBtnCommand As ICommand
|
||||
Get
|
||||
If m_CmdCompoBtn Is Nothing Then
|
||||
m_CmdCompoBtn = New Command(AddressOf CompoBtn)
|
||||
End If
|
||||
Return m_CmdCompoBtn
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Exec. This method is invoked by the ExecCommand.
|
||||
''' </summary>
|
||||
Public Sub CompoBtn(param As Object)
|
||||
Dim CurrCompoType As CompoType = DirectCast(param, CompoType)
|
||||
m_rfDoorParametersViewModel.CurrDoor.AddNewCompo(CurrCompoType)
|
||||
End Sub
|
||||
|
||||
#End Region ' CompoBtnCommand
|
||||
|
||||
#End Region 'Commands
|
||||
|
||||
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
||||
|
||||
Public Sub NotifyPropertyChanged(propName As String)
|
||||
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user