Spostato Proj in Core
This commit is contained in:
@@ -96,6 +96,7 @@
|
||||
</Compile>
|
||||
<Compile Include="MyMachGroup.vb" />
|
||||
<Compile Include="Part.vb" />
|
||||
<Compile Include="ProjectFile.vb" />
|
||||
<Compile Include="SectionXMaterial.vb" />
|
||||
<Compile Include="Utility\BTLIniFile.vb" />
|
||||
<Compile Include="Utility\Command.vb" />
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class ProjectFile
|
||||
|
||||
Protected m_nProjectType As ProjectType
|
||||
Public ReadOnly Property nProjectType As ProjectType
|
||||
Get
|
||||
Return m_nProjectType
|
||||
End Get
|
||||
End Property
|
||||
Public Sub SetProjectType(nProjectType As ProjectType)
|
||||
m_nProjectType = nProjectType
|
||||
End Sub
|
||||
|
||||
Protected m_nProjId As Integer = 0
|
||||
Public ReadOnly Property nProjId As Integer
|
||||
Get
|
||||
Return m_nProjId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
Protected m_nProdId As Integer = 0
|
||||
Public ReadOnly Property nProdId As Integer
|
||||
Get
|
||||
Return m_nProdId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_BTLFileName As String = String.Empty
|
||||
Public ReadOnly Property BTLFileName As String
|
||||
Get
|
||||
Return m_BTLFileName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected m_NewProj As Boolean
|
||||
Public Property NewProj As Boolean
|
||||
Get
|
||||
Return m_NewProj
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_NewProj = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected m_NewProd As Boolean
|
||||
Public Property NewProd As Boolean
|
||||
Get
|
||||
Return m_NewProd
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_NewProd = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New()
|
||||
|
||||
End Sub
|
||||
|
||||
Sub New(nProjectType As ProjectType, nProjId As Integer, nProdId As Integer, sBTLFileName As String)
|
||||
m_nProjectType = nProjectType
|
||||
If m_nProjectType = ProjectType.PROJ Then
|
||||
m_nProjId = nProjId
|
||||
m_nProdId = nProdId
|
||||
m_BTLFileName = sBTLFileName
|
||||
ElseIf m_nProjectType = ProjectType.PROD Then
|
||||
m_nProdId = nProdId
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
@@ -99,18 +99,21 @@ Public Class OpenProjectFileDialogVM
|
||||
Public Function Init(ProjectType As ProjectType, Optional ProjectList As List(Of ProjectFile) = Nothing) As Boolean?
|
||||
m_ProjectType = ProjectType
|
||||
If IsNothing(ProjectList) OrElse ProjectList.Count = 0 Then
|
||||
' cartella da cui leggere i programmi
|
||||
Dim sFolderPath As String
|
||||
If m_ProjectType = ProjectType.PROJ Then
|
||||
sFolderPath = Map.refMainWindowVM.MainWindowM.sProjsDir
|
||||
Else
|
||||
sFolderPath = Map.refMainWindowVM.MainWindowM.sProdsDir
|
||||
End If
|
||||
' leggo i file che contiene
|
||||
Dim AllDirsInDir As IEnumerable(Of String) = IO.Directory.EnumerateDirectories(sFolderPath)
|
||||
For Each CurrDirectory In AllDirsInDir
|
||||
VerifyFiles(CurrDirectory)
|
||||
Next
|
||||
' leggo lista proj da DB
|
||||
Dim ProjController As New DataLayer.Controllers.ProjController
|
||||
Dim ProjList As List(Of DataLayer.DatabaseModels.ProjModel) = ProjController.GetLastPaginatedDesc(50)
|
||||
'' cartella da cui leggere i programmi
|
||||
'Dim sFolderPath As String
|
||||
'If m_ProjectType = ProjectType.PROJ Then
|
||||
' sFolderPath = Map.refMainWindowVM.MainWindowM.sProjsDir
|
||||
'Else
|
||||
' sFolderPath = Map.refMainWindowVM.MainWindowM.sProdsDir
|
||||
'End If
|
||||
'' leggo i file che contiene
|
||||
'Dim AllDirsInDir As IEnumerable(Of String) = IO.Directory.EnumerateDirectories(sFolderPath)
|
||||
'For Each CurrDirectory In AllDirsInDir
|
||||
' VerifyFiles(CurrDirectory)
|
||||
'Next
|
||||
Else
|
||||
m_ProjectList = ProjectList
|
||||
End If
|
||||
@@ -130,6 +133,20 @@ Public Class OpenProjectFileDialogVM
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub VerifyFiles(FileId As String)
|
||||
Dim AllFilesInDir As IEnumerable(Of String) = IO.Directory.EnumerateFiles(CurrDirectory)
|
||||
For Each File In AllFilesInDir
|
||||
If Path.GetExtension(File).ToLower() = ".nge" Then
|
||||
Dim nProjId As Integer = 0
|
||||
Dim nProdId As Integer = 0
|
||||
Dim sBTLFileName As String = ""
|
||||
If ProjectFile.VerifyProjectFile(m_ProjectType, Path.GetFileNameWithoutExtension(File), nProjId, nProdId, sBTLFileName) Then
|
||||
m_ProjectList.Add(New ProjectFile(m_ProjectType, nProjId, nProdId, sBTLFileName))
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Friend Function VerifySelected() As Boolean
|
||||
Return Not IsNothing(SelProject)
|
||||
End Function
|
||||
|
||||
@@ -2,23 +2,7 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class ProjectFile
|
||||
|
||||
Private m_nProjectType As ProjectType
|
||||
Public ReadOnly Property nProjectType As ProjectType
|
||||
Get
|
||||
Return m_nProjectType
|
||||
End Get
|
||||
End Property
|
||||
Friend Sub SetProjectType(nProjectType As ProjectType)
|
||||
m_nProjectType = nProjectType
|
||||
End Sub
|
||||
|
||||
Private m_nProjId As Integer = 0
|
||||
Public ReadOnly Property nProjId As Integer
|
||||
Get
|
||||
Return m_nProjId
|
||||
End Get
|
||||
End Property
|
||||
Inherits Core.ProjectFile
|
||||
|
||||
Friend ReadOnly Property sProjDirPath As String
|
||||
Get
|
||||
@@ -39,12 +23,6 @@ Public Class ProjectFile
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_nProdId As Integer = 0
|
||||
Public ReadOnly Property nProdId As Integer
|
||||
Get
|
||||
Return m_nProdId
|
||||
End Get
|
||||
End Property
|
||||
Friend ReadOnly Property sProdDirPath As String
|
||||
Get
|
||||
Dim sPath As String = String.Empty
|
||||
@@ -60,33 +38,6 @@ Public Class ProjectFile
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_BTLFileName As String = String.Empty
|
||||
Public ReadOnly Property BTLFileName As String
|
||||
Get
|
||||
Return m_BTLFileName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_NewProj As Boolean
|
||||
Friend Property NewProj As Boolean
|
||||
Get
|
||||
Return m_NewProj
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_NewProj = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_NewProd As Boolean
|
||||
Friend Property NewProd As Boolean
|
||||
Get
|
||||
Return m_NewProd
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_NewProd = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' nome del file mostrato nella finestra OpenProjFileDialog
|
||||
Public ReadOnly Property OpenFileName As String
|
||||
Get
|
||||
@@ -121,14 +72,7 @@ Public Class ProjectFile
|
||||
End Sub
|
||||
|
||||
Sub New(nProjectType As ProjectType, nProjId As Integer, nProdId As Integer, sBTLFileName As String)
|
||||
m_nProjectType = nProjectType
|
||||
If m_nProjectType = ProjectType.PROJ Then
|
||||
m_nProjId = nProjId
|
||||
m_nProdId = nProdId
|
||||
m_BTLFileName = sBTLFileName
|
||||
ElseIf m_nProjectType = ProjectType.PROD Then
|
||||
m_nProdId = nProdId
|
||||
End If
|
||||
MyBase.New(nProjectType, nProjId, nProdId, sBTLFileName)
|
||||
End Sub
|
||||
|
||||
Friend Sub SetProdId(nProdId As Integer)
|
||||
|
||||
Reference in New Issue
Block a user