Compare commits

..

6 Commits

Author SHA1 Message Date
RenzoL 0a45d1af95 - Sistemati FeatureManager e Parametri P/Q visualizzati a seconda del Layer o Part selezionato 2022-04-08 17:39:09 +02:00
RenzoL b41454183f - Sistemati visibilità e bDO/bDOALL di FeatureListV per Layer e Part
- Nascosto (commentato) il filtro ricerca Part
2022-04-07 16:34:36 +02:00
RenzoL 7e7258dd7c - Parziale pulizia codice
- Disabilitati bottoni apertura e salvataggio in LayersWallProjManager
2022-04-07 09:45:15 +02:00
RenzoL 19a8ca1267 - Correzioni su Selezioni/Deselezioni/Riselezioni dei Part nella DG e dei Layer nel TreeView
- Inserite 2 FeatureListV separate (e parte di 2 diverse Tab) per Layer e Part selezionati
2022-04-07 08:59:16 +02:00
RenzoL e88c603fca - Corretta property sNAMplus per Element e Layer 2022-04-01 12:53:03 +02:00
RenzoL a62f0ca724 LayersWall WIP : - Aggiunta nuova pagina LayersWall per aprire progetti di tipo Pareti Layer
- Creati nuovi Panel e Manager dedicati nella pagina LayersWall (simili ai già esistenti in Visualizzatore ma preceduti da "LayersWall")
- Aggiunto ElementLayerTreeView come albero per i Composite di tipo Element e Layer
- Aggiunti BTLElement e BTLLayer che ereditano da BTLPart (Element contiene Layer, Layer contiene Part e Feature)
2022-04-01 09:56:04 +02:00
68 changed files with 11811 additions and 13591 deletions
-113
View File
@@ -1,113 +0,0 @@
variables:
NUGET_PATH: 'C:\Tools\nuget.exe'
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release'
DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds'
APP_NAME: 'EgtBEAMWALL'
APP_NAMEG: 'EgtBEAMWALL'
NEW_REL: ''
VERS_RD: 'Release'
ARCH: 'x86'
ARCH64: 'x64'
OUTPUT_DIR: ''
NET_SHARE: '\\10.74.82.201\Artifacts\EgtProg\EgtBEAMWALL'
NET_USER: 'steamw\steamware'
# helper x mount cartella Artifacts su truenas
.ReplicaCompiled: &ReplicaCompiled
- |
rm -Recurse Z:\$CI_COMMIT_BRANCH\$env:ARCH\*.*
rm -Recurse Z:\$CI_COMMIT_BRANCH\$env:ARCH\*.*
ROBOCOPY /E $env:APP_NAME\bin\$env:ARCH\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH /XF *.xml /XF *.pdb
ROBOCOPY /E $env:APP_NAME2\bin\$env:ARCH\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH /XF *.xml /XF *.pdb
SLEEP 2
net use Z: /delete
.ReplicaCompileds2: &ReplicaCompileds2
- |
ROBOCOPY /E $env:APP_NAME\bin\$env:ARCH64\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH64 /XF *.xml /XF *.pdb
ROBOCOPY /E $env:APP_NAME2\bin\$env:ARCH64\$env:VERS_RD Z:\$CI_COMMIT_BRANCH\$env:ARCH64 /XF *.xml /XF *.pdb
SLEEP 2
net use Z: /delete
.MakeFolderM: &MakeFolderM
- |
net use Z: /delete
new-item c:\EgtProg\EgtBEAMWALL -itemtype directory
net use Z: $env:NET_SHARE
.nuget-fix: &nuget-fix
- |
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
if ($hasSource -eq 0) {
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
} else {
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
}
echo $hasSource
# helper creazione hash files
.hashBuild: &hashBuild
- |
$Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
$MD5 = Get-FileHash $Target -Algorithm MD5
$SHA1 = Get-FileHash $Target -Algorithm SHA1
New-Item $Target".md5"
New-Item $Target".sha1"
$MD5.Hash | Set-Content -Path $Target".md5"
$SHA1.Hash | Set-Content -Path $Target".sha1"
echo "Created HASH files for $Target"
.cleanup-dir: &cleanup-dir
- |
rm $env:APP_NAME\bin\$env:ARCH\$env:VERS_RD\*.xml
rm $env:APP_NAME\bin\$env:ARCH\$env:VERS_RD\*.pdb
rm $env:APP_NAME\bin\$env:ARCH64\$env:VERS_RD\*.xml
rm $env:APP_NAME\bin\$env:ARCH64\$env:VERS_RD\*.pdb
stages:
- build
- deploy
X86:build:
stage: build
tags:
- win
variables:
APP_NAME: EgtBEAMWALL.Supervisor
APP_NAME2: EgtBEAMWALL.ViewerOptimizer
VERS_RD: 'Release'
ARCH: 'x86'
ARCH64: 'x64'
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore EgtBEAMWALL.sln -verbosity quiet'
- *MakeFolderM
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH" /p:OutputPath=bin/$env:ARCH/$env:VERS_RD/ /verbosity:minimal /m'
- '& "$env:MSBUILD_PATH" "$env:APP_NAME2\$env:APP_NAME2.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH" /p:OutputPath=bin/$env:ARCH/$env:VERS_RD/ /verbosity:minimal /m'
- *ReplicaCompiled
X64:build:
stage: build
tags:
- win
variables:
APP_NAME: EgtBEAMWALL.Supervisor
APP_NAME2: EgtBEAMWALL.ViewerOptimizer
VERS_RD: 'Release'
ARCH: 'x86'
ARCH64: 'x64'
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore EgtBEAMWALL.sln -verbosity quiet'
- *MakeFolderM
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH64" /p:OutputPath=bin/$env:ARCH64/$env:VERS_RD/ /verbosity:minimal /m'
- '& "$env:MSBUILD_PATH" "$env:APP_NAME2\$env:APP_NAME2.vbproj" -target:Build /p:Configuration=$env:VERS_RD /p:Platform="$env:ARCH64" /p:OutputPath=bin/$env:ARCH64/$env:VERS_RD/ /verbosity:minimal /m'
- *ReplicaCompileds2
+577
View File
@@ -0,0 +1,577 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
Public Class BTLElementM
Inherits BTLPartM
' lista delle feature del pezzo
Public m_BTLLayerMList As List(Of BTLLayerM)
Public Property BTLLayerMList As List(Of BTLLayerM)
Get
Return m_BTLLayerMList
End Get
Set(value As List(Of BTLLayerM))
m_BTLLayerMList = value
End Set
End Property
Public ReadOnly Property sName As String
Get
Return "Prova"
End Get
End Property
#Region "CONSTRUCTOR"
Protected Sub New()
End Sub
Public Shared Function CreateNewBTLElement() As BTLElementM
Return New BTLPartM
End Function
Public Shared Function CreateBTLElement(nGroupId As Integer) As BTLElementM
Dim NewBTLElement As New BTLElementM
NewBTLElement = CreateBTLElementAsPart(nGroupId)
Return NewBTLElement
End Function
Public Overloads Shared Function CreateBTLElementAsPart(nPartId As Integer) As BTLElementM
Dim NewBTLPart As New BTLElementM
NewBTLPart.m_nPartId = nPartId
' leggo info pezzo
Dim sValArray() As String
Dim sValue As String = String.Empty
Dim nValue As Integer = 0
EgtGetInfo(nPartId, BTL_PRT_PDN, NewBTLPart.m_nPDN)
Dim nDO As Integer = 1
If EgtGetInfo(nPartId, BTL_PRT_DO, nDO) Then
NewBTLPart.m_bDO = (nDO <> 0)
Else
NewBTLPart.m_bDO = True
End If
EgtGetInfo(nPartId, BTL_PRT_NAM, NewBTLPart.m_sNAM)
EgtGetInfo(nPartId, BTL_PRT_L, NewBTLPart.m_dBtlL)
EgtGetInfo(nPartId, BTL_PRT_W, NewBTLPart.m_dBtlW)
EgtGetInfo(nPartId, BTL_PRT_H, NewBTLPart.m_dBtlH)
EgtGetInfo(nPartId, BTL_PRT_CNT, NewBTLPart.m_nCNT)
EgtGetInfo(nPartId, BTL_PRT_ADDED, NewBTLPart.m_nADDED)
EgtGetInfo(nPartId, BTL_PRT_ASSEMBLYNUM, NewBTLPart.m_sASSEMBLYNUM)
EgtGetInfo(nPartId, BTL_PRT_ORDERNUM, NewBTLPart.m_nORDERNUM)
EgtGetInfo(nPartId, BTL_PRT_DESIGNATION, NewBTLPart.m_sDESIGN)
EgtGetInfo(nPartId, BTL_PRT_ANNOTATION, NewBTLPart.m_sANNOT)
EgtGetInfo(nPartId, BTL_PRT_STOREY, NewBTLPart.m_sSTOREY)
EgtGetInfo(nPartId, BTL_PRT_GROUP, NewBTLPart.m_sGROUP)
EgtGetInfo(nPartId, BTL_PRT_PACKAGE, NewBTLPart.m_sPACKAGE)
EgtGetInfo(nPartId, BTL_PRT_TIMBERGRADE, NewBTLPart.m_sTIMBERGRADE)
EgtGetInfo(nPartId, BTL_PRT_QUALITYGRADE, NewBTLPart.m_sQUALITYGRADE)
EgtGetInfo(nPartId, BTL_PRT_COLOUR, sValue)
NewBTLPart.m_colCOLOR.FromString(sValue)
EgtGetInfo(nPartId, BTL_PRT_PLANINGLENGTH, NewBTLPart.m_dPLANINGLEN)
EgtGetInfo(nPartId, BTL_PRT_STARTOFFSET, NewBTLPart.m_dSTARTOFFSET)
EgtGetInfo(nPartId, BTL_PRT_ENDOFFSET, NewBTLPart.m_dENDOFFSET)
Dim ind As Integer = 1
While EgtGetInfo(nPartId, BTL_PRT_UID & ind, nValue)
NewBTLPart.ocUID.Add(nValue)
EgtGetInfo(nPartId, BTL_PRT_TRANSFORMATION & ind, sValue)
NewBTLPart.m_refTransf = New Frame3d
Dim ptOri As New Point3d
Dim vtVersX As New Vector3d
Dim vtVersY As New Vector3d
sValArray = sValue.Split({","}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 9 Then
StringToLen(sValArray(0), ptOri.x)
StringToLen(sValArray(1), ptOri.y)
StringToLen(sValArray(2), ptOri.z)
StringToDouble(sValArray(3), vtVersX.x)
StringToDouble(sValArray(4), vtVersX.y)
StringToDouble(sValArray(5), vtVersX.z)
StringToDouble(sValArray(6), vtVersY.x)
StringToDouble(sValArray(7), vtVersY.y)
StringToDouble(sValArray(8), vtVersY.z)
NewBTLPart.m_refTransf.ChangeOrigin(ptOri)
NewBTLPart.m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY)
End If
NewBTLPart.refTransfList.Add(NewBTLPart.m_refTransf)
ind = ind + 1
End While
EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 5 Then
StringToLen(sValArray(3), NewBTLPart.m_dCamberLen1)
StringToLen(sValArray(5), NewBTLPart.m_dCamberLen2)
StringToLen(sValArray(7), NewBTLPart.m_dCamberLen3)
StringToLen(sValArray(9), NewBTLPart.m_dCamberCross3)
End If
Dim pFrom As Integer = sValue.IndexOf("SIDE: ") + "SIDE: ".Length
Dim pTo As Integer = sValue.LastIndexOf(" P01")
If pTo >= 0 Then
nValue = CInt(sValue.Substring(pFrom, pTo - pFrom))
NewBTLPart.m_SelCAMBERSIDE = NewBTLPart.ocCAMBERSIDE.IndexOf(CInt(sValue.Substring(pFrom, pTo - pFrom)))
End If
EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 5 Then
StringToLen(sValArray(3), NewBTLPart.m_dPartOffsetSide1)
StringToLen(sValArray(5), NewBTLPart.m_dPartOffsetSide2)
StringToLen(sValArray(7), NewBTLPart.m_dPartOffsetSide3)
StringToLen(sValArray(9), NewBTLPart.m_dPartOffsetSide4)
End If
pFrom = sValue.IndexOf("P04: ") + "P04: ".Length
pTo = sValue.LastIndexOf(" P11")
If pTo >= 0 Then
NewBTLPart.m_SelREFSIDEFIXCLAMP = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue.Substring(pFrom, pTo - pFrom),
NewBTLPart.ocREFSIDEFIXCLAMP),
NewBTLPart.ocREFSIDEFIXCLAMP)
End If
Dim EnumIndex As Integer = 0
EgtGetInfo(nPartId, BTL_PRT_PROCESSINGQUALITY, sValue)
For ind = 1 To NewBTLPart.ocPROCESSINGQUALITY.Count
Dim sEnumName = [Enum].GetName(GetType(ProcessingQuality), ind)
If sEnumName.Equals(sValue) Then
EnumIndex = ind
Exit For
End If
Next
NewBTLPart.m_SelPROCESSINGQUALITY = EnumIndex - 1
EgtGetInfo(nPartId, BTL_PRT_RECESS, sValue)
EnumIndex = 0
For ind = 1 To NewBTLPart.ocRECESS.Count
Dim sEnumName = [Enum].GetName(GetType(Recess), ind)
If sEnumName.Equals(sValue) Then
EnumIndex = ind
Exit For
End If
Next
NewBTLPart.m_SelRECESS = EnumIndex - 1
EgtGetInfo(nPartId, BTL_PRT_STOREYTYPE, sValue)
EnumIndex = 0
For ind = 1 To NewBTLPart.ocSTOREYTYPE.Count
Dim sEnumName = [Enum].GetName(GetType(StoreyType), ind)
If sEnumName.Equals(sValue) Then
EnumIndex = ind
Exit For
End If
Next
NewBTLPart.m_SelSTOREYTYPE = EnumIndex - 1
EgtGetInfo(nPartId, BTL_PRT_ELEMENTNUM, NewBTLPart.m_sELEMENTNUM)
EgtGetInfo(nPartId, BTL_PRT_LAYER, NewBTLPart.m_nLAYER)
EgtGetInfo(nPartId, BTL_PRT_MODULENUM, NewBTLPart.m_sMODULENUM)
'EgtGetInfo(nPartId, BTL_PRT_USERATTRIBUTE, m_sUSERATTRIBUTE)
EgtGetInfo(nPartId, BTL_PRT_COMMENT, NewBTLPart.m_sCOMMENT)
EgtGetInfo(nPartId, BTL_PRT_GRAINDIR, sValue)
NewBTLPart.m_refGrainDir = New Vector3d
sValArray = sValue.Split(New String() {",", ";"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 4 Then
StringToDouble(sValArray(0), NewBTLPart.m_refGrainDir.x)
StringToDouble(sValArray(1), NewBTLPart.m_refGrainDir.y)
StringToDouble(sValArray(2), NewBTLPart.m_refGrainDir.z)
NewBTLPart.m_bGRAINDIRALIGN = (CInt(sValArray(3)) = 1)
End If
EgtGetInfo(nPartId, BTL_PRT_REFSIDE, sValue)
sValArray = sValue.Split({";"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 2 Then
NewBTLPart.m_SelREFSIDE = NewBTLPart.ocREFSIDE.IndexOf(CInt(sValArray(0)))
NewBTLPart.m_bREFSIDEALIGN = (CInt(sValArray(1)) = 1)
End If
EgtGetInfo(nPartId, BTL_PRT_ALIGNMENT, sValue)
sValArray = sValue.Split({":"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 2 Then
NewBTLPart.m_SelALIGNLOCATION = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(0), NewBTLPart.ocALIGNLOCATION),
NewBTLPart.ocALIGNLOCATION)
NewBTLPart.m_SelALIGNENDTYPE = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(1).Trim(),
NewBTLPart.ocALIGNENDTYPE),
NewBTLPart.ocALIGNENDTYPE)
End If
EgtGetInfo(nPartId, BTL_PRT_MATERIALTYPE, sValue)
sValArray = sValue.Split({":"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 1 Then
NewBTLPart.m_SelMATERIALTYPEGRP = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(0),
NewBTLPart.ocMATERIALTYPEGRP),
NewBTLPart.ocMATERIALTYPEGRP)
If sValArray.Count() >= 2 Then NewBTLPart.m_sMATERIALTYPESPEC = sValArray(1).Trim()
End If
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, NewBTLPart.nROTATED) Then
NewBTLPart.nROTATED = 0
End If
If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, NewBTLPart.nINVERTED) Then
NewBTLPart.nINVERTED = 0
End If
EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewBTLPart.m_sMATERIAL)
If Not EgtGetInfo(nPartId, LOCK_ROT, NewBTLPart.bLockRotation) Then
NewBTLPart.bLockRotation = False
End If
If Not EgtGetInfo(nPartId, LOCK_FLIP, NewBTLPart.bLockInversion) Then
NewBTLPart.bLockInversion = False
End If
EgtGetInfo(nPartId, BTL_PRT_VOLUME, NewBTLPart.dVolume)
'' Leggo outline e features
'NewBTLPart.m_BTLFeatureMList = LoadFeatures(nPartId, NewBTLPart)
' leggo calc error
Dim nErr As Integer = 0
Dim nRot As Integer = 0
Dim nFall As Integer = 0
Dim sMsg As String = ""
Dim bCalc As Boolean = False
bCalc = EgtGetInfo(nPartId, ITG_PROJ_ERR, nErr)
EgtGetInfo(nPartId, ITG_PROJ_ROT, nRot)
EgtGetInfo(nPartId, ITG_PROJ_FALL, nFall)
EgtGetInfo(nPartId, ITG_PROJ_MSG, sMsg)
If Not bCalc Then
NewBTLPart.m_nState = CalcStates.NOTCALCULATED
NewBTLPart.nCALC_ERR = 0
NewBTLPart.m_nCALC_ROT = 0
NewBTLPart.nCALC_FALL = 0
NewBTLPart.sCALC_MSG = ""
Else
NewBTLPart.nCALC_ERR = nErr
NewBTLPart.nCALC_ROT = nRot
NewBTLPart.nCALC_FALL = nFall
NewBTLPart.sCALC_MSG = sMsg
Select Case nErr
Case 0
NewBTLPart.nState = CalcStates.OK
Case 22
NewBTLPart.nState = CalcStates.COLLISION
Case 17, 19
NewBTLPart.nState = CalcStates.WARNING
Case < 0
NewBTLPart.nState = CalcStates.INFO
Case > 0
NewBTLPart.nState = CalcStates.ERROR_
End Select
End If
EgtGetInfo(nPartId, ITG_PROJ_TIME, NewBTLPart.m_nCALC_TIME)
Return NewBTLPart
End Function
' Private Shared Function LoadFeatures(nPartId As Integer, NewBTLPart As BTLPartM) As List(Of BTLFeatureM)
' Dim TempList As New List(Of BTLFeatureM)
' ' Leggo outline
' Dim nOutlineLayerId As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
' Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayerId)
' While nOutlineId <> GDB_ID.NULL
' ' verifico che sia una feature
' Dim nGRP As Integer
' If EgtGetInfo(nOutlineId, BTL_FTR_GRP, nGRP) Then
' ' creo la feature
' TempList.Add(BTLFeatureM.CreateBTLFeature(NewBTLPart, nOutlineId))
' End If
' nOutlineId = EgtGetNext(nOutlineId)
' End While
' ' Leggo feature
' Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
' Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
' While nFeatureId <> GDB_ID.NULL
' ' verifico che sia una feature
' Dim nGRP As Integer
' If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) AndAlso Not EgtExistsInfo(nFeatureId, BTL_FTR_MAINID) Then
' ' creo la feature
' Dim NewFeature As BTLFeatureM = BTLFeatureM.CreateBTLFeature(NewBTLPart, nFeatureId)
' TempList.Add(NewFeature)
' ' aggiorno Id feature perchè potrebbe essere stata ricalcolata
' nFeatureId = NewFeature.nFeatureId
' End If
' nFeatureId = EgtGetNext(nFeatureId)
' End While
' Return TempList
' End Function
' 'Sub New(ParentStructure As BTLStructureVM, nPartId As Integer)
' ' MyBase.New(ParentStructure, nPartId)
' ' ' leggo info pezzo
' ' Dim sValArray() As String
' ' Dim sValue As String = String.Empty
' ' Dim nValue As Integer = 0
' ' EgtGetInfo(nPartId, BTL_PRT_PDN, nPDN)
' ' Dim nDO As Integer = 1
' ' If EgtGetInfo(nPartId, BTL_PRT_DO, nDO) Then
' ' m_bDO = (nDO <> 0)
' ' Else
' ' m_bDO = True
' ' End If
' ' EgtGetInfo(nPartId, BTL_PRT_NAM, m_sNAM)
' ' EgtGetInfo(nPartId, BTL_PRT_L, m_dL)
' ' EgtGetInfo(nPartId, BTL_PRT_W, m_dW)
' ' EgtGetInfo(nPartId, BTL_PRT_H, m_dH)
' ' EgtGetInfo(nPartId, BTL_PRT_CNT, m_nCNT)
' ' EgtGetInfo(nPartId, BTL_PRT_ASSEMBLYNUM, m_sASSEMBLYNUM)
' ' EgtGetInfo(nPartId, BTL_PRT_ORDERNUM, m_nORDERNUM)
' ' EgtGetInfo(nPartId, BTL_PRT_DESIGNATION, m_sDESIGN)
' ' EgtGetInfo(nPartId, BTL_PRT_ANNOTATION, m_sANNOT)
' ' EgtGetInfo(nPartId, BTL_PRT_STOREY, m_sSTOREY)
' ' EgtGetInfo(nPartId, BTL_PRT_GROUP, m_sGROUP)
' ' EgtGetInfo(nPartId, BTL_PRT_PACKAGE, m_sPACKAGE)
' ' EgtGetInfo(nPartId, BTL_PRT_TIMBERGRADE, m_sTIMBERGRADE)
' ' EgtGetInfo(nPartId, BTL_PRT_QUALITYGRADE, m_sQUALITYGRADE)
' ' EgtGetInfo(nPartId, BTL_PRT_COLOUR, sValue)
' ' m_colCOLOR.FromString(sValue)
' ' EgtGetInfo(nPartId, BTL_PRT_PLANINGLENGTH, m_dPLANINGLEN)
' ' EgtGetInfo(nPartId, BTL_PRT_STARTOFFSET, m_dSTARTOFFSET)
' ' EgtGetInfo(nPartId, BTL_PRT_ENDOFFSET, m_dENDOFFSET)
' ' Dim ind As Integer = 1
' ' While EgtGetInfo(nPartId, BTL_PRT_UID & ind, nValue)
' ' ocUID.Add(nValue)
' ' EgtGetInfo(nPartId, BTL_PRT_TRANSFORMATION & ind, sValue)
' ' m_refTransf = New Frame3d
' ' Dim ptOri As New Point3d
' ' Dim vtVersX As New Vector3d
' ' Dim vtVersY As New Vector3d
' ' sValArray = sValue.Split({","}, StringSplitOptions.RemoveEmptyEntries)
' ' If sValArray.Count() >= 9 Then
' ' StringToLen(sValArray(0), ptOri.x)
' ' StringToLen(sValArray(1), ptOri.y)
' ' StringToLen(sValArray(2), ptOri.z)
' ' StringToDouble(sValArray(3), vtVersX.x)
' ' StringToDouble(sValArray(4), vtVersX.y)
' ' StringToDouble(sValArray(5), vtVersX.z)
' ' StringToDouble(sValArray(6), vtVersY.x)
' ' StringToDouble(sValArray(7), vtVersY.y)
' ' StringToDouble(sValArray(8), vtVersY.z)
' ' m_refTransf.ChangeOrigin(ptOri)
' ' m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY)
' ' End If
' ' refTransfList.Add(m_refTransf)
' ' ind = ind + 1
' ' End While
' ' EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
' ' sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
' ' If sValArray.Count() >= 5 Then
' ' StringToLen(sValArray(3), m_dCamberLen1)
' ' StringToLen(sValArray(5), m_dCamberLen2)
' ' StringToLen(sValArray(7), m_dCamberLen3)
' ' StringToLen(sValArray(9), m_dCamberCross3)
' ' End If
' ' Dim pFrom As Integer = sValue.IndexOf("SIDE: ") + "SIDE: ".Length
' ' Dim pTo As Integer = sValue.LastIndexOf(" P01")
' ' If pTo >= 0 Then
' ' nValue = CInt(sValue.Substring(pFrom, pTo - pFrom))
' ' m_SelCAMBERSIDE = ocCAMBERSIDE.IndexOf(CInt(sValue.Substring(pFrom, pTo - pFrom)))
' ' End If
' ' EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
' ' sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
' ' If sValArray.Count() >= 5 Then
' ' StringToLen(sValArray(3), m_dPartOffsetSide1)
' ' StringToLen(sValArray(5), m_dPartOffsetSide2)
' ' StringToLen(sValArray(7), m_dPartOffsetSide3)
' ' StringToLen(sValArray(9), m_dPartOffsetSide4)
' ' End If
' ' pFrom = sValue.IndexOf("P04: ") + "P04: ".Length
' ' pTo = sValue.LastIndexOf(" P11")
' ' If pTo >= 0 Then
' ' m_SelREFSIDEFIXCLAMP = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue.Substring(pFrom, pTo - pFrom), ocREFSIDEFIXCLAMP), ocREFSIDEFIXCLAMP)
' ' End If
' ' EgtGetInfo(nPartId, BTL_PRT_PROCESSINGQUALITY, sValue)
' ' m_SelPROCESSINGQUALITY = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, ocPROCESSINGQUALITY), ocPROCESSINGQUALITY)
' ' EgtGetInfo(nPartId, BTL_PRT_RECESS, sValue)
' ' m_SelRECESS = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, ocRECESS), ocRECESS)
' ' EgtGetInfo(nPartId, BTL_PRT_STOREYTYPE, sValue)
' ' m_SelSTOREYTYPE = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, ocSTOREYTYPE), ocSTOREYTYPE)
' ' EgtGetInfo(nPartId, BTL_PRT_ELEMENTNUM, m_sELEMENTNUM)
' ' EgtGetInfo(nPartId, BTL_PRT_LAYER, m_nLAYER)
' ' EgtGetInfo(nPartId, BTL_PRT_MODULENUM, m_sMODULENUM)
' ' 'EgtGetInfo(nPartId, BTL_PRT_USERATTRIBUTE, m_sUSERATTRIBUTE)
' ' EgtGetInfo(nPartId, BTL_PRT_COMMENT, m_sCOMMENT)
' ' EgtGetInfo(nPartId, BTL_PRT_GRAINDIR, sValue)
' ' m_refGrainDir = New Vector3d
' ' sValArray = sValue.Split(New String() {",", ";"}, StringSplitOptions.RemoveEmptyEntries)
' ' If sValArray.Count() >= 4 Then
' ' StringToDouble(sValArray(0), m_refGrainDir.x)
' ' StringToDouble(sValArray(1), m_refGrainDir.y)
' ' StringToDouble(sValArray(2), m_refGrainDir.z)
' ' m_bGRAINDIRALIGN = (CInt(sValArray(3)) = 1)
' ' End If
' ' EgtGetInfo(nPartId, BTL_PRT_REFSIDE, sValue)
' ' sValArray = sValue.Split({";"}, StringSplitOptions.RemoveEmptyEntries)
' ' If sValArray.Count() >= 2 Then
' ' m_SelREFSIDE = ocREFSIDE.IndexOf(CInt(sValArray(0)))
' ' m_bREFSIDEALIGN = (CInt(sValArray(1)) = 1)
' ' End If
' ' EgtGetInfo(nPartId, BTL_PRT_ALIGNMENT, sValue)
' ' sValArray = sValue.Split({":"}, StringSplitOptions.RemoveEmptyEntries)
' ' If sValArray.Count() >= 2 Then
' ' m_SelALIGNLOCATION = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(0), ocALIGNLOCATION), ocALIGNLOCATION)
' ' m_SelALIGNENDTYPE = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(1).Trim(), ocALIGNENDTYPE), ocALIGNENDTYPE)
' ' End If
' ' EgtGetInfo(nPartId, BTL_PRT_MATERIALTYPE, sValue)
' ' sValArray = sValue.Split({":"}, StringSplitOptions.RemoveEmptyEntries)
' ' If sValArray.Count() >= 1 Then
' ' m_SelMATERIALTYPEGRP = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(0), ocMATERIALTYPEGRP), ocMATERIALTYPEGRP)
' ' If sValArray.Count() >= 2 Then m_sMATERIALTYPESPEC = sValArray(1).Trim()
' ' End If
' ' If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, m_nROTATED) Then
' ' m_nROTATED = 0
' ' End If
' ' If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, m_nINVERTED) Then
' ' m_nINVERTED = 0
' ' End If
' ' If EgtGetInfo(nPartId, BTL_PRT_MATERIAL, m_sMATERIAL) Then
' ' If Not ParentStructure.MaterialList.Contains(m_sMATERIAL) Then
' ' ParentStructure.MaterialList.Add(m_sMATERIAL)
' ' End If
' ' End If
' ' If Not ParentStructure.SectionList.Contains(Section) Then
' ' ParentStructure.SectionList.Add(Section)
' ' End If
' ' ' Leggo outline
' ' Dim nOutlineLayerId As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
' ' Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayerId)
' ' While nOutlineId <> GDB_ID.NULL
' ' ' verifico che sia una feature
' ' Dim nGRP As Integer
' ' If EgtGetInfo(nOutlineId, BTL_FTR_GRP, nGRP) Then
' ' ' creo la feature
' ' m_FeatureList.Add(New BTLFeatureVM(Me, nOutlineId))
' ' End If
' ' nOutlineId = EgtGetNext(nOutlineId)
' ' End While
' ' ' Leggo feature
' ' Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
' ' Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
' ' While nFeatureId <> GDB_ID.NULL
' ' ' verifico che sia una feature
' ' Dim nGRP As Integer
' ' If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) Then
' ' ' creo la feature
' ' m_FeatureList.Add(New BTLFeatureVM(Me, nFeatureId))
' ' End If
' ' nFeatureId = EgtGetNext(nFeatureId)
' ' End While
' ' ' Aggiorno check DOALL
' ' NotifyPropertyChanged("bDOALL")
' ' ' leggo calc error
' ' Dim nErr As Integer = 0
' ' Dim nRot As Integer = 0
' ' Dim nFall As Integer = 0
' ' Dim sMsg As String = ""
' ' Dim bCalc As Boolean = False
' ' bCalc = EgtGetInfo(nPartId, ITG_PROJ_ERR, nErr)
' ' EgtGetInfo(nPartId, ITG_PROJ_ROT, nRot)
' ' EgtGetInfo(nPartId, ITG_PROJ_FALL, sMsg)
' ' EgtGetInfo(nPartId, ITG_PROJ_MSG, sMsg)
' ' CalcPartUpdate(bCalc, nErr, nRot, nFall, sMsg)
' ' CalcFeatureUpdate()
' 'End Sub
' 'Sub New(ParentStructure As BTLStructure, nPartId As Integer)
' ' m_BTLStructureM = ParentStructure
' ' Me.SetPartId = nPartId
' ' m_FeatureList = New ObservableCollection(Of BTLFeature)
' 'End Sub
'#End Region ' CONSTRUCTOR
'#Region "METHODS"
' Public Event BTLFeatureAdded As EventHandler(Of BTLFeatureAddedEventArgs)
' Public Sub AddBTLFeature(BTLFeatureM As BTLFeatureM)
' If IsNothing(BTLFeatureM) Then Return
' If Not m_BTLFeatureMList.Contains(BTLFeatureM) Then
' m_BTLFeatureMList.Add(BTLFeatureM)
' RaiseEvent BTLFeatureAdded(Me, New BTLFeatureAddedEventArgs(BTLFeatureM))
' End If
' End Sub
' Public Function GetBTLFeatures() As List(Of BTLFeatureM)
' Return New List(Of BTLFeatureM)(m_BTLFeatureMList)
' End Function
' Public Function Rotation(IsPositive As Boolean, SelectedMachineType As MachineType, Optional dAng As Double = 90) As Boolean
' ' recupero il box del pezzo
' Dim nLs As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
' Dim b3Solid As New BBox3d
' EgtGetBBoxGlob(nLs, GDB_BB.STANDARD, b3Solid)
' If b3Solid.IsEmpty() Then
' EgtOutLog("ERROR: Box non definito per la trave " & sNAM)
' Return False
' End If
' ' eseguo rotazione di 90 gradi attorno asse X
' Dim dRot = If(IsPositive, 1, -1) * Math.Abs(dAng)
' Dim vtAxes As Vector3d
' ' se travi ruoto attorno all'asse X
' If SelectedMachineType = MachineType.BEAM Then
' vtAxes = Vector3d.X_AX
' ' se pareti ruoto attorno all'asse Z
' ElseIf SelectedMachineType = MachineType.WALL Then
' vtAxes = -Vector3d.Z_AX
' End If
' ' se invertito
' Dim bInverted As Boolean = nINVERTED <> 0
' If bInverted Then
' ' annullo inversione
' Inversion(SelectedMachineType)
' End If
' ' eseguo rotazione
' Dim bOk As Boolean = EgtRotate(nPartId, b3Solid.Center, vtAxes, dRot, GDB_RT.GLOB)
' If bOk Then
' Dim dNewRotation As Double = (nROTATED + dRot) Mod 360
' nROTATED = If(dNewRotation >= 0, dNewRotation, 360 + dNewRotation)
' EgtSetInfo(nPartId, BTL_PRT_ROTATED, nROTATED)
' ' imposto modificato per copie
' EgtDuploSetModified(nPartId)
' End If
' ' se era invertito
' If bInverted Then
' ' ripristino inversione
' Inversion(SelectedMachineType)
' End If
' EgtDraw()
' Return bOk
' End Function
' Public Sub Inversion(SelectedMachineType As MachineType)
' ' recupero il box del pezzo
' Dim nLs As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
' Dim b3Solid As New BBox3d
' EgtGetBBoxGlob(nLs, GDB_BB.STANDARD, b3Solid)
' If b3Solid.IsEmpty() Then
' EgtOutLog("ERROR: Box non definito per la trave " & sNAM)
' Return
' End If
' Dim vtAxes As Vector3d
' ' se travi ruoto attorno all'asse Z
' If SelectedMachineType = MachineType.BEAM Then
' vtAxes = Vector3d.Z_AX
' ' se pareti ruoto attorno all'asse X
' ElseIf SelectedMachineType = MachineType.WALL Then
' vtAxes = Vector3d.X_AX
' End If
' ' eseguo rotazione di 180 gradi
' If EgtRotate(nPartId, b3Solid.Center, vtAxes, 180, GDB_RT.GLOB) Then
' nINVERTED = If(nINVERTED = 0, 180, 0)
' EgtSetInfo(nPartId, BTL_PRT_INVERTED, nINVERTED)
' ' imposto modificato per copie
' EgtDuploSetModified(nPartId)
' End If
' End Sub
' Public Function NewProcId() As Integer
' Dim nMaxProcId As Integer = 0
' If Not IsNothing(BTLFeatureMList) AndAlso BTLFeatureMList.Count > 0 Then
' nMaxProcId = BTLFeatureMList.Max(Function(x) x.nPRID)
' End If
' Return nMaxProcId + 1
' End Function
#End Region ' METHODS
End Class
+570
View File
@@ -0,0 +1,570 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
Public Class BTLLayerM
Inherits BTLPartM
Public m_BTLPartMList As List(Of BTLPartM)
Public Property BTLPartMList As List(Of BTLPartM)
Get
Return m_BTLPartMList
End Get
Set(value As List(Of BTLPartM))
m_BTLPartMList = value
End Set
End Property
#Region "CONSTRUCTOR"
Protected Sub New()
End Sub
Public Shared Function CreateNewBTLLayer() As BTLLayerM
Return New BTLPartM
End Function
Public Shared Function CreateBTLLayer(nGroupId As Integer) As BTLLayerM
Dim NewBTLLayer As New BTLLayerM
NewBTLLayer = CreateBTLLayerAsPart(nGroupId)
Return NewBTLLayer
End Function
Public Overloads Shared Function CreateBTLLayerAsPart(nPartId As Integer) As BTLLayerM
Dim NewBTLPart As New BTLLayerM
NewBTLPart.m_nPartId = nPartId
' leggo info pezzo
Dim sValArray() As String
Dim sValue As String = String.Empty
Dim nValue As Integer = 0
EgtGetInfo(nPartId, BTL_PRT_PDN, NewBTLPart.m_nPDN)
Dim nDO As Integer = 1
If EgtGetInfo(nPartId, BTL_PRT_DO, nDO) Then
NewBTLPart.m_bDO = (nDO <> 0)
Else
NewBTLPart.m_bDO = True
End If
EgtGetInfo(nPartId, BTL_PRT_NAM, NewBTLPart.m_sNAM)
EgtGetInfo(nPartId, BTL_PRT_L, NewBTLPart.m_dBtlL)
EgtGetInfo(nPartId, BTL_PRT_W, NewBTLPart.m_dBtlW)
EgtGetInfo(nPartId, BTL_PRT_H, NewBTLPart.m_dBtlH)
EgtGetInfo(nPartId, BTL_PRT_CNT, NewBTLPart.m_nCNT)
EgtGetInfo(nPartId, BTL_PRT_ADDED, NewBTLPart.m_nADDED)
EgtGetInfo(nPartId, BTL_PRT_ASSEMBLYNUM, NewBTLPart.m_sASSEMBLYNUM)
EgtGetInfo(nPartId, BTL_PRT_ORDERNUM, NewBTLPart.m_nORDERNUM)
EgtGetInfo(nPartId, BTL_PRT_DESIGNATION, NewBTLPart.m_sDESIGN)
EgtGetInfo(nPartId, BTL_PRT_ANNOTATION, NewBTLPart.m_sANNOT)
EgtGetInfo(nPartId, BTL_PRT_STOREY, NewBTLPart.m_sSTOREY)
EgtGetInfo(nPartId, BTL_PRT_GROUP, NewBTLPart.m_sGROUP)
EgtGetInfo(nPartId, BTL_PRT_PACKAGE, NewBTLPart.m_sPACKAGE)
EgtGetInfo(nPartId, BTL_PRT_TIMBERGRADE, NewBTLPart.m_sTIMBERGRADE)
EgtGetInfo(nPartId, BTL_PRT_QUALITYGRADE, NewBTLPart.m_sQUALITYGRADE)
EgtGetInfo(nPartId, BTL_PRT_COLOUR, sValue)
NewBTLPart.m_colCOLOR.FromString(sValue)
EgtGetInfo(nPartId, BTL_PRT_PLANINGLENGTH, NewBTLPart.m_dPLANINGLEN)
EgtGetInfo(nPartId, BTL_PRT_STARTOFFSET, NewBTLPart.m_dSTARTOFFSET)
EgtGetInfo(nPartId, BTL_PRT_ENDOFFSET, NewBTLPart.m_dENDOFFSET)
Dim ind As Integer = 1
While EgtGetInfo(nPartId, BTL_PRT_UID & ind, nValue)
NewBTLPart.ocUID.Add(nValue)
EgtGetInfo(nPartId, BTL_PRT_TRANSFORMATION & ind, sValue)
NewBTLPart.m_refTransf = New Frame3d
Dim ptOri As New Point3d
Dim vtVersX As New Vector3d
Dim vtVersY As New Vector3d
sValArray = sValue.Split({","}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 9 Then
StringToLen(sValArray(0), ptOri.x)
StringToLen(sValArray(1), ptOri.y)
StringToLen(sValArray(2), ptOri.z)
StringToDouble(sValArray(3), vtVersX.x)
StringToDouble(sValArray(4), vtVersX.y)
StringToDouble(sValArray(5), vtVersX.z)
StringToDouble(sValArray(6), vtVersY.x)
StringToDouble(sValArray(7), vtVersY.y)
StringToDouble(sValArray(8), vtVersY.z)
NewBTLPart.m_refTransf.ChangeOrigin(ptOri)
NewBTLPart.m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY)
End If
NewBTLPart.refTransfList.Add(NewBTLPart.m_refTransf)
ind = ind + 1
End While
EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 5 Then
StringToLen(sValArray(3), NewBTLPart.m_dCamberLen1)
StringToLen(sValArray(5), NewBTLPart.m_dCamberLen2)
StringToLen(sValArray(7), NewBTLPart.m_dCamberLen3)
StringToLen(sValArray(9), NewBTLPart.m_dCamberCross3)
End If
Dim pFrom As Integer = sValue.IndexOf("SIDE: ") + "SIDE: ".Length
Dim pTo As Integer = sValue.LastIndexOf(" P01")
If pTo >= 0 Then
nValue = CInt(sValue.Substring(pFrom, pTo - pFrom))
NewBTLPart.m_SelCAMBERSIDE = NewBTLPart.ocCAMBERSIDE.IndexOf(CInt(sValue.Substring(pFrom, pTo - pFrom)))
End If
EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 5 Then
StringToLen(sValArray(3), NewBTLPart.m_dPartOffsetSide1)
StringToLen(sValArray(5), NewBTLPart.m_dPartOffsetSide2)
StringToLen(sValArray(7), NewBTLPart.m_dPartOffsetSide3)
StringToLen(sValArray(9), NewBTLPart.m_dPartOffsetSide4)
End If
pFrom = sValue.IndexOf("P04: ") + "P04: ".Length
pTo = sValue.LastIndexOf(" P11")
If pTo >= 0 Then
NewBTLPart.m_SelREFSIDEFIXCLAMP = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue.Substring(pFrom, pTo - pFrom),
NewBTLPart.ocREFSIDEFIXCLAMP),
NewBTLPart.ocREFSIDEFIXCLAMP)
End If
Dim EnumIndex As Integer = 0
EgtGetInfo(nPartId, BTL_PRT_PROCESSINGQUALITY, sValue)
For ind = 1 To NewBTLPart.ocPROCESSINGQUALITY.Count
Dim sEnumName = [Enum].GetName(GetType(ProcessingQuality), ind)
If sEnumName.Equals(sValue) Then
EnumIndex = ind
Exit For
End If
Next
NewBTLPart.m_SelPROCESSINGQUALITY = EnumIndex - 1
EgtGetInfo(nPartId, BTL_PRT_RECESS, sValue)
EnumIndex = 0
For ind = 1 To NewBTLPart.ocRECESS.Count
Dim sEnumName = [Enum].GetName(GetType(Recess), ind)
If sEnumName.Equals(sValue) Then
EnumIndex = ind
Exit For
End If
Next
NewBTLPart.m_SelRECESS = EnumIndex - 1
EgtGetInfo(nPartId, BTL_PRT_STOREYTYPE, sValue)
EnumIndex = 0
For ind = 1 To NewBTLPart.ocSTOREYTYPE.Count
Dim sEnumName = [Enum].GetName(GetType(StoreyType), ind)
If sEnumName.Equals(sValue) Then
EnumIndex = ind
Exit For
End If
Next
NewBTLPart.m_SelSTOREYTYPE = EnumIndex - 1
EgtGetInfo(nPartId, BTL_PRT_ELEMENTNUM, NewBTLPart.m_sELEMENTNUM)
EgtGetInfo(nPartId, BTL_PRT_LAYER, NewBTLPart.m_nLAYER)
EgtGetInfo(nPartId, BTL_PRT_MODULENUM, NewBTLPart.m_sMODULENUM)
'EgtGetInfo(nPartId, BTL_PRT_USERATTRIBUTE, m_sUSERATTRIBUTE)
EgtGetInfo(nPartId, BTL_PRT_COMMENT, NewBTLPart.m_sCOMMENT)
EgtGetInfo(nPartId, BTL_PRT_GRAINDIR, sValue)
NewBTLPart.m_refGrainDir = New Vector3d
sValArray = sValue.Split(New String() {",", ";"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 4 Then
StringToDouble(sValArray(0), NewBTLPart.m_refGrainDir.x)
StringToDouble(sValArray(1), NewBTLPart.m_refGrainDir.y)
StringToDouble(sValArray(2), NewBTLPart.m_refGrainDir.z)
NewBTLPart.m_bGRAINDIRALIGN = (CInt(sValArray(3)) = 1)
End If
EgtGetInfo(nPartId, BTL_PRT_REFSIDE, sValue)
sValArray = sValue.Split({";"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 2 Then
NewBTLPart.m_SelREFSIDE = NewBTLPart.ocREFSIDE.IndexOf(CInt(sValArray(0)))
NewBTLPart.m_bREFSIDEALIGN = (CInt(sValArray(1)) = 1)
End If
EgtGetInfo(nPartId, BTL_PRT_ALIGNMENT, sValue)
sValArray = sValue.Split({":"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 2 Then
NewBTLPart.m_SelALIGNLOCATION = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(0), NewBTLPart.ocALIGNLOCATION),
NewBTLPart.ocALIGNLOCATION)
NewBTLPart.m_SelALIGNENDTYPE = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(1).Trim(),
NewBTLPart.ocALIGNENDTYPE),
NewBTLPart.ocALIGNENDTYPE)
End If
EgtGetInfo(nPartId, BTL_PRT_MATERIALTYPE, sValue)
sValArray = sValue.Split({":"}, StringSplitOptions.RemoveEmptyEntries)
If sValArray.Count() >= 1 Then
NewBTLPart.m_SelMATERIALTYPEGRP = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(0),
NewBTLPart.ocMATERIALTYPEGRP),
NewBTLPart.ocMATERIALTYPEGRP)
If sValArray.Count() >= 2 Then NewBTLPart.m_sMATERIALTYPESPEC = sValArray(1).Trim()
End If
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, NewBTLPart.nROTATED) Then
NewBTLPart.nROTATED = 0
End If
If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, NewBTLPart.nINVERTED) Then
NewBTLPart.nINVERTED = 0
End If
EgtGetInfo(nPartId, BTL_PRT_MATERIAL, NewBTLPart.m_sMATERIAL)
If Not EgtGetInfo(nPartId, LOCK_ROT, NewBTLPart.bLockRotation) Then
NewBTLPart.bLockRotation = False
End If
If Not EgtGetInfo(nPartId, LOCK_FLIP, NewBTLPart.bLockInversion) Then
NewBTLPart.bLockInversion = False
End If
EgtGetInfo(nPartId, BTL_PRT_VOLUME, NewBTLPart.dVolume)
' Leggo outline e features
NewBTLPart.m_BTLFeatureMList = LoadFeatures(nPartId, NewBTLPart)
' leggo calc error
Dim nErr As Integer = 0
Dim nRot As Integer = 0
Dim nFall As Integer = 0
Dim sMsg As String = ""
Dim bCalc As Boolean = False
bCalc = EgtGetInfo(nPartId, ITG_PROJ_ERR, nErr)
EgtGetInfo(nPartId, ITG_PROJ_ROT, nRot)
EgtGetInfo(nPartId, ITG_PROJ_FALL, nFall)
EgtGetInfo(nPartId, ITG_PROJ_MSG, sMsg)
If Not bCalc Then
NewBTLPart.m_nState = CalcStates.NOTCALCULATED
NewBTLPart.nCALC_ERR = 0
NewBTLPart.m_nCALC_ROT = 0
NewBTLPart.nCALC_FALL = 0
NewBTLPart.sCALC_MSG = ""
Else
NewBTLPart.nCALC_ERR = nErr
NewBTLPart.nCALC_ROT = nRot
NewBTLPart.nCALC_FALL = nFall
NewBTLPart.sCALC_MSG = sMsg
Select Case nErr
Case 0
NewBTLPart.nState = CalcStates.OK
Case 22
NewBTLPart.nState = CalcStates.COLLISION
Case 17, 19
NewBTLPart.nState = CalcStates.WARNING
Case < 0
NewBTLPart.nState = CalcStates.INFO
Case > 0
NewBTLPart.nState = CalcStates.ERROR_
End Select
End If
EgtGetInfo(nPartId, ITG_PROJ_TIME, NewBTLPart.m_nCALC_TIME)
Return NewBTLPart
End Function
Private Shared Function LoadFeatures(nPartId As Integer, NewBTLPart As BTLLayerM) As List(Of BTLFeatureM)
Dim TempList As New List(Of BTLFeatureM)
' Leggo outline
Dim nOutlineLayerId As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayerId)
While nOutlineId <> GDB_ID.NULL
' verifico che sia una feature
Dim nGRP As Integer
If EgtGetInfo(nOutlineId, BTL_FTR_GRP, nGRP) Then
' creo la feature
TempList.Add(BTLFeatureM.CreateBTLFeature(NewBTLPart, nOutlineId))
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
' Leggo feature
Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
While nFeatureId <> GDB_ID.NULL
' verifico che sia una feature
Dim nGRP As Integer
If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) AndAlso Not EgtExistsInfo(nFeatureId, BTL_FTR_MAINID) Then
' creo la feature
Dim NewFeature As BTLFeatureM = BTLFeatureM.CreateBTLFeature(NewBTLPart, nFeatureId)
TempList.Add(NewFeature)
' aggiorno Id feature perchè potrebbe essere stata ricalcolata
nFeatureId = NewFeature.nFeatureId
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
Return TempList
End Function
'Sub New(ParentStructure As BTLStructureVM, nPartId As Integer)
' MyBase.New(ParentStructure, nPartId)
' ' leggo info pezzo
' Dim sValArray() As String
' Dim sValue As String = String.Empty
' Dim nValue As Integer = 0
' EgtGetInfo(nPartId, BTL_PRT_PDN, nPDN)
' Dim nDO As Integer = 1
' If EgtGetInfo(nPartId, BTL_PRT_DO, nDO) Then
' m_bDO = (nDO <> 0)
' Else
' m_bDO = True
' End If
' EgtGetInfo(nPartId, BTL_PRT_NAM, m_sNAM)
' EgtGetInfo(nPartId, BTL_PRT_L, m_dL)
' EgtGetInfo(nPartId, BTL_PRT_W, m_dW)
' EgtGetInfo(nPartId, BTL_PRT_H, m_dH)
' EgtGetInfo(nPartId, BTL_PRT_CNT, m_nCNT)
' EgtGetInfo(nPartId, BTL_PRT_ASSEMBLYNUM, m_sASSEMBLYNUM)
' EgtGetInfo(nPartId, BTL_PRT_ORDERNUM, m_nORDERNUM)
' EgtGetInfo(nPartId, BTL_PRT_DESIGNATION, m_sDESIGN)
' EgtGetInfo(nPartId, BTL_PRT_ANNOTATION, m_sANNOT)
' EgtGetInfo(nPartId, BTL_PRT_STOREY, m_sSTOREY)
' EgtGetInfo(nPartId, BTL_PRT_GROUP, m_sGROUP)
' EgtGetInfo(nPartId, BTL_PRT_PACKAGE, m_sPACKAGE)
' EgtGetInfo(nPartId, BTL_PRT_TIMBERGRADE, m_sTIMBERGRADE)
' EgtGetInfo(nPartId, BTL_PRT_QUALITYGRADE, m_sQUALITYGRADE)
' EgtGetInfo(nPartId, BTL_PRT_COLOUR, sValue)
' m_colCOLOR.FromString(sValue)
' EgtGetInfo(nPartId, BTL_PRT_PLANINGLENGTH, m_dPLANINGLEN)
' EgtGetInfo(nPartId, BTL_PRT_STARTOFFSET, m_dSTARTOFFSET)
' EgtGetInfo(nPartId, BTL_PRT_ENDOFFSET, m_dENDOFFSET)
' Dim ind As Integer = 1
' While EgtGetInfo(nPartId, BTL_PRT_UID & ind, nValue)
' ocUID.Add(nValue)
' EgtGetInfo(nPartId, BTL_PRT_TRANSFORMATION & ind, sValue)
' m_refTransf = New Frame3d
' Dim ptOri As New Point3d
' Dim vtVersX As New Vector3d
' Dim vtVersY As New Vector3d
' sValArray = sValue.Split({","}, StringSplitOptions.RemoveEmptyEntries)
' If sValArray.Count() >= 9 Then
' StringToLen(sValArray(0), ptOri.x)
' StringToLen(sValArray(1), ptOri.y)
' StringToLen(sValArray(2), ptOri.z)
' StringToDouble(sValArray(3), vtVersX.x)
' StringToDouble(sValArray(4), vtVersX.y)
' StringToDouble(sValArray(5), vtVersX.z)
' StringToDouble(sValArray(6), vtVersY.x)
' StringToDouble(sValArray(7), vtVersY.y)
' StringToDouble(sValArray(8), vtVersY.z)
' m_refTransf.ChangeOrigin(ptOri)
' m_refTransf.Setup(ptOri, ptOri + vtVersX, ptOri + vtVersY)
' End If
' refTransfList.Add(m_refTransf)
' ind = ind + 1
' End While
' EgtGetInfo(nPartId, BTL_PRT_CAMBER, sValue)
' sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
' If sValArray.Count() >= 5 Then
' StringToLen(sValArray(3), m_dCamberLen1)
' StringToLen(sValArray(5), m_dCamberLen2)
' StringToLen(sValArray(7), m_dCamberLen3)
' StringToLen(sValArray(9), m_dCamberCross3)
' End If
' Dim pFrom As Integer = sValue.IndexOf("SIDE: ") + "SIDE: ".Length
' Dim pTo As Integer = sValue.LastIndexOf(" P01")
' If pTo >= 0 Then
' nValue = CInt(sValue.Substring(pFrom, pTo - pFrom))
' m_SelCAMBERSIDE = ocCAMBERSIDE.IndexOf(CInt(sValue.Substring(pFrom, pTo - pFrom)))
' End If
' EgtGetInfo(nPartId, BTL_PRT_PARTOFFSET, sValue)
' sValArray = sValue.Split(New String() {": ", " P"}, StringSplitOptions.RemoveEmptyEntries)
' If sValArray.Count() >= 5 Then
' StringToLen(sValArray(3), m_dPartOffsetSide1)
' StringToLen(sValArray(5), m_dPartOffsetSide2)
' StringToLen(sValArray(7), m_dPartOffsetSide3)
' StringToLen(sValArray(9), m_dPartOffsetSide4)
' End If
' pFrom = sValue.IndexOf("P04: ") + "P04: ".Length
' pTo = sValue.LastIndexOf(" P11")
' If pTo >= 0 Then
' m_SelREFSIDEFIXCLAMP = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue.Substring(pFrom, pTo - pFrom), ocREFSIDEFIXCLAMP), ocREFSIDEFIXCLAMP)
' End If
' EgtGetInfo(nPartId, BTL_PRT_PROCESSINGQUALITY, sValue)
' m_SelPROCESSINGQUALITY = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, ocPROCESSINGQUALITY), ocPROCESSINGQUALITY)
' EgtGetInfo(nPartId, BTL_PRT_RECESS, sValue)
' m_SelRECESS = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, ocRECESS), ocRECESS)
' EgtGetInfo(nPartId, BTL_PRT_STOREYTYPE, sValue)
' m_SelSTOREYTYPE = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, ocSTOREYTYPE), ocSTOREYTYPE)
' EgtGetInfo(nPartId, BTL_PRT_ELEMENTNUM, m_sELEMENTNUM)
' EgtGetInfo(nPartId, BTL_PRT_LAYER, m_nLAYER)
' EgtGetInfo(nPartId, BTL_PRT_MODULENUM, m_sMODULENUM)
' 'EgtGetInfo(nPartId, BTL_PRT_USERATTRIBUTE, m_sUSERATTRIBUTE)
' EgtGetInfo(nPartId, BTL_PRT_COMMENT, m_sCOMMENT)
' EgtGetInfo(nPartId, BTL_PRT_GRAINDIR, sValue)
' m_refGrainDir = New Vector3d
' sValArray = sValue.Split(New String() {",", ";"}, StringSplitOptions.RemoveEmptyEntries)
' If sValArray.Count() >= 4 Then
' StringToDouble(sValArray(0), m_refGrainDir.x)
' StringToDouble(sValArray(1), m_refGrainDir.y)
' StringToDouble(sValArray(2), m_refGrainDir.z)
' m_bGRAINDIRALIGN = (CInt(sValArray(3)) = 1)
' End If
' EgtGetInfo(nPartId, BTL_PRT_REFSIDE, sValue)
' sValArray = sValue.Split({";"}, StringSplitOptions.RemoveEmptyEntries)
' If sValArray.Count() >= 2 Then
' m_SelREFSIDE = ocREFSIDE.IndexOf(CInt(sValArray(0)))
' m_bREFSIDEALIGN = (CInt(sValArray(1)) = 1)
' End If
' EgtGetInfo(nPartId, BTL_PRT_ALIGNMENT, sValue)
' sValArray = sValue.Split({":"}, StringSplitOptions.RemoveEmptyEntries)
' If sValArray.Count() >= 2 Then
' m_SelALIGNLOCATION = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(0), ocALIGNLOCATION), ocALIGNLOCATION)
' m_SelALIGNENDTYPE = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(1).Trim(), ocALIGNENDTYPE), ocALIGNENDTYPE)
' End If
' EgtGetInfo(nPartId, BTL_PRT_MATERIALTYPE, sValue)
' sValArray = sValue.Split({":"}, StringSplitOptions.RemoveEmptyEntries)
' If sValArray.Count() >= 1 Then
' m_SelMATERIALTYPEGRP = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValArray(0), ocMATERIALTYPEGRP), ocMATERIALTYPEGRP)
' If sValArray.Count() >= 2 Then m_sMATERIALTYPESPEC = sValArray(1).Trim()
' End If
' If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, m_nROTATED) Then
' m_nROTATED = 0
' End If
' If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, m_nINVERTED) Then
' m_nINVERTED = 0
' End If
' If EgtGetInfo(nPartId, BTL_PRT_MATERIAL, m_sMATERIAL) Then
' If Not ParentStructure.MaterialList.Contains(m_sMATERIAL) Then
' ParentStructure.MaterialList.Add(m_sMATERIAL)
' End If
' End If
' If Not ParentStructure.SectionList.Contains(Section) Then
' ParentStructure.SectionList.Add(Section)
' End If
' ' Leggo outline
' Dim nOutlineLayerId As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
' Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayerId)
' While nOutlineId <> GDB_ID.NULL
' ' verifico che sia una feature
' Dim nGRP As Integer
' If EgtGetInfo(nOutlineId, BTL_FTR_GRP, nGRP) Then
' ' creo la feature
' m_FeatureList.Add(New BTLFeatureVM(Me, nOutlineId))
' End If
' nOutlineId = EgtGetNext(nOutlineId)
' End While
' ' Leggo feature
' Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
' Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
' While nFeatureId <> GDB_ID.NULL
' ' verifico che sia una feature
' Dim nGRP As Integer
' If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) Then
' ' creo la feature
' m_FeatureList.Add(New BTLFeatureVM(Me, nFeatureId))
' End If
' nFeatureId = EgtGetNext(nFeatureId)
' End While
' ' Aggiorno check DOALL
' NotifyPropertyChanged("bDOALL")
' ' leggo calc error
' Dim nErr As Integer = 0
' Dim nRot As Integer = 0
' Dim nFall As Integer = 0
' Dim sMsg As String = ""
' Dim bCalc As Boolean = False
' bCalc = EgtGetInfo(nPartId, ITG_PROJ_ERR, nErr)
' EgtGetInfo(nPartId, ITG_PROJ_ROT, nRot)
' EgtGetInfo(nPartId, ITG_PROJ_FALL, sMsg)
' EgtGetInfo(nPartId, ITG_PROJ_MSG, sMsg)
' CalcPartUpdate(bCalc, nErr, nRot, nFall, sMsg)
' CalcFeatureUpdate()
'End Sub
'Sub New(ParentStructure As BTLStructure, nPartId As Integer)
' m_BTLStructureM = ParentStructure
' Me.SetPartId = nPartId
' m_FeatureList = New ObservableCollection(Of BTLFeature)
'End Sub
'#End Region ' CONSTRUCTOR
'#Region "METHODS"
' Public Event BTLFeatureAdded As EventHandler(Of BTLFeatureAddedEventArgs)
' Public Sub AddBTLFeature(BTLFeatureM As BTLFeatureM)
' If IsNothing(BTLFeatureM) Then Return
' If Not m_BTLFeatureMList.Contains(BTLFeatureM) Then
' m_BTLFeatureMList.Add(BTLFeatureM)
' RaiseEvent BTLFeatureAdded(Me, New BTLFeatureAddedEventArgs(BTLFeatureM))
' End If
' End Sub
' Public Function GetBTLFeatures() As List(Of BTLFeatureM)
' Return New List(Of BTLFeatureM)(m_BTLFeatureMList)
' End Function
' Public Function Rotation(IsPositive As Boolean, SelectedMachineType As MachineType, Optional dAng As Double = 90) As Boolean
' ' recupero il box del pezzo
' Dim nLs As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
' Dim b3Solid As New BBox3d
' EgtGetBBoxGlob(nLs, GDB_BB.STANDARD, b3Solid)
' If b3Solid.IsEmpty() Then
' EgtOutLog("ERROR: Box non definito per la trave " & sNAM)
' Return False
' End If
' ' eseguo rotazione di 90 gradi attorno asse X
' Dim dRot = If(IsPositive, 1, -1) * Math.Abs(dAng)
' Dim vtAxes As Vector3d
' ' se travi ruoto attorno all'asse X
' If SelectedMachineType = MachineType.BEAM Then
' vtAxes = Vector3d.X_AX
' ' se pareti ruoto attorno all'asse Z
' ElseIf SelectedMachineType = MachineType.WALL Then
' vtAxes = -Vector3d.Z_AX
' End If
' ' se invertito
' Dim bInverted As Boolean = nINVERTED <> 0
' If bInverted Then
' ' annullo inversione
' Inversion(SelectedMachineType)
' End If
' ' eseguo rotazione
' Dim bOk As Boolean = EgtRotate(nPartId, b3Solid.Center, vtAxes, dRot, GDB_RT.GLOB)
' If bOk Then
' Dim dNewRotation As Double = (nROTATED + dRot) Mod 360
' nROTATED = If(dNewRotation >= 0, dNewRotation, 360 + dNewRotation)
' EgtSetInfo(nPartId, BTL_PRT_ROTATED, nROTATED)
' ' imposto modificato per copie
' EgtDuploSetModified(nPartId)
' End If
' ' se era invertito
' If bInverted Then
' ' ripristino inversione
' Inversion(SelectedMachineType)
' End If
' EgtDraw()
' Return bOk
' End Function
' Public Sub Inversion(SelectedMachineType As MachineType)
' ' recupero il box del pezzo
' Dim nLs As Integer = EgtGetFirstNameInGroup(nPartId, "Box")
' Dim b3Solid As New BBox3d
' EgtGetBBoxGlob(nLs, GDB_BB.STANDARD, b3Solid)
' If b3Solid.IsEmpty() Then
' EgtOutLog("ERROR: Box non definito per la trave " & sNAM)
' Return
' End If
' Dim vtAxes As Vector3d
' ' se travi ruoto attorno all'asse Z
' If SelectedMachineType = MachineType.BEAM Then
' vtAxes = Vector3d.Z_AX
' ' se pareti ruoto attorno all'asse X
' ElseIf SelectedMachineType = MachineType.WALL Then
' vtAxes = Vector3d.X_AX
' End If
' ' eseguo rotazione di 180 gradi
' If EgtRotate(nPartId, b3Solid.Center, vtAxes, 180, GDB_RT.GLOB) Then
' nINVERTED = If(nINVERTED = 0, 180, 0)
' EgtSetInfo(nPartId, BTL_PRT_INVERTED, nINVERTED)
' ' imposto modificato per copie
' EgtDuploSetModified(nPartId)
' End If
' End Sub
' Public Function NewProcId() As Integer
' Dim nMaxProcId As Integer = 0
' If Not IsNothing(BTLFeatureMList) AndAlso BTLFeatureMList.Count > 0 Then
' nMaxProcId = BTLFeatureMList.Max(Function(x) x.nPRID)
' End If
' Return nMaxProcId + 1
' End Function
#End Region ' METHODS
End Class
+123
View File
@@ -18,6 +18,35 @@ Public Class BTLStructureM
End Get
End Property
Private m_nCompositesId As Integer = GDB_ID.NULL
Public ReadOnly Property nCompositesId As Integer
Get
Return m_nCompositesId
End Get
End Property
' composite di tipo Element da BTL
Public m_BTLElementMList As List(Of BTLElementM)
Public Property BTLElementMList As List(Of BTLElementM)
Get
Return m_BTLElementMList
End Get
Set(value As List(Of BTLElementM))
m_BTLElementMList = value
End Set
End Property
' composite di tipo Layer da BTL
Public m_BTLLayerMList As List(Of BTLLayerM)
Public Property BTLLayerMList As List(Of BTLLayerM)
Get
Return m_BTLLayerMList
End Get
Set(value As List(Of BTLLayerM))
m_BTLLayerMList = value
End Set
End Property
' pezzi da BTL
Public m_BTLPartMList As List(Of BTLPartM)
Public Property BTLPartMList As List(Of BTLPartM)
@@ -406,7 +435,35 @@ Public Class BTLStructureM
Else
NewBTLStructure.m_nAsseBaseId = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
NewBTLStructure.m_nBTLInfoId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
NewBTLStructure.m_nCompositesId = EgtGetFirstNameInGroup(GDB_ID.ROOT, COMPOSITES)
End If
' cerco tra i Composites se ci sono Element o Layer per vedere se è un progetto Pareti Layer
Dim nCompositesId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, COMPOSITES)
While nCompositesId <> GDB_ID.NULL
' verifico se il layer appartiene al ProjId
Dim nCompositesProjId As Integer
EgtGetInfo(nCompositesId, BTL_PRT_PROJ, nCompositesProjId)
If nCompositesProjId = ProjId Then
NewBTLStructure.m_nCompositesId = nCompositesProjId
Dim nCompositesSubNodeId As Integer = EgtGetFirstInGroup(nCompositesId)
' se Composites presente recupero i Composites di tipo Element e Layer
NewBTLStructure.m_BTLElementMList = LoadElements(nCompositesSubNodeId)
NewBTLStructure.m_BTLLayerMList = LoadLayers(nCompositesSubNodeId)
' aggiungo i Layer già caricati al BTLElement a seconda del GROUP
For Each BTLElementItem In NewBTLStructure.BTLElementMList
BTLElementItem.BTLLayerMList = New List(Of BTLLayerM)
For Each BTLLayerItem In NewBTLStructure.BTLLayerMList
If BTLLayerItem.sGROUP = BTLElementItem.sGROUP Then
' recupero i pezzi associati al Layer
BTLLayerItem.BTLPartMList = LoadLayerParts(BTLLayerItem.nPartId)
BTLElementItem.BTLLayerMList.Add(BTLLayerItem)
End If
Next
Next
Exit While
End If
nCompositesId = EgtGetNextName(nCompositesId, COMPOSITES)
End While
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJNUM, NewBTLStructure.m_sPROJNUM)
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJNAME, NewBTLStructure.m_sPROJNAME)
EgtGetInfo(NewBTLStructure.m_nBTLInfoId, BTL_GEN_PROJPART, NewBTLStructure.m_sPROJPART)
@@ -465,6 +522,56 @@ Public Class BTLStructureM
Return TempList
End Function
Private Shared Function LoadLayerParts(nLayerId As Integer) As List(Of BTLPartM)
Dim TempList As New List(Of BTLPartM)
Dim nSubLayerId As Integer = EgtGetFirstInGroup(nLayerId)
' devo far passare i vari SubLayerId finchè non trovo quelli di UID.
' dentro questi devo trovare !SOU, il valore di questo è il PartId che ci interessa caricare
While nSubLayerId <> GDB_ID.NULL
Dim sSubLayerName As String = ""
Dim nPartId As Integer
EgtGetName(nSubLayerId, sSubLayerName)
If sSubLayerName.Length > 3 AndAlso sSubLayerName.Substring(0, 4) = "UID-" Then
EgtGetInfo(nSubLayerId, "!SOU", nPartId)
If nPartId <> GDB_ID.NULL Then
TempList.Add(BTLPartM.CreateBTLPart(nPartId))
End If
End If
nSubLayerId = EgtGetNext(nSubLayerId)
End While
Return TempList
End Function
Private Shared Function LoadElements(CompositesSubNodeId As Integer) As List(Of BTLElementM)
Dim TempList As New List(Of BTLElementM)
Dim nCompositesSubNodeId As Integer = CompositesSubNodeId
While nCompositesSubNodeId <> GDB_ID.NULL
Dim sCompositeType As String = ""
Dim nTest As Integer = 0
EgtGetInfo(nCompositesSubNodeId, BTL_PRT_TYPE, sCompositeType)
If sCompositeType = "ELEMENT" Then
TempList.Add(BTLElementM.CreateBTLElement(nCompositesSubNodeId))
End If
nCompositesSubNodeId = EgtGetNextGroup(nCompositesSubNodeId)
End While
Return TempList
End Function
Private Shared Function LoadLayers(CompositesSubNodeId As Integer) As List(Of BTLLayerM)
Dim TempList As New List(Of BTLLayerM)
Dim nCompositesSubNodeId As Integer = CompositesSubNodeId
While nCompositesSubNodeId <> GDB_ID.NULL
Dim sCompositeType As String = ""
Dim nTest As Integer = 0
EgtGetInfo(nCompositesSubNodeId, BTL_PRT_TYPE, sCompositeType)
If sCompositeType = "LAYER" Then
TempList.Add(BTLLayerM.CreateBTLLayer(nCompositesSubNodeId))
End If
nCompositesSubNodeId = EgtGetNextGroup(nCompositesSubNodeId)
End While
Return TempList
End Function
#End Region ' CONSTRUCTOR
#Region "METHODS"
@@ -486,6 +593,22 @@ Public Class BTLStructureM
'RaiseEvent BTLPartAdded(Me, New BTLPartAddedEventArgs(BTLPartM))
End Sub
Public Function GetBTLElements() As List(Of BTLElementM)
If Not IsNothing(m_BTLElementMList) Then
Return New List(Of BTLElementM)(m_BTLElementMList)
Else
Return Nothing
End If
End Function
Public Function GetBTLLayers() As List(Of BTLLayerM)
If Not IsNothing(m_BTLLayerMList) Then
Return New List(Of BTLLayerM)(m_BTLLayerMList)
Else
Return Nothing
End If
End Function
Public Function GetBTLParts() As List(Of BTLPartM)
Return New List(Of BTLPartM)(m_BTLPartMList)
End Function
+17 -5
View File
@@ -113,11 +113,18 @@
PROD = 2
End Enum
' Tipo di progetto (Beam o Wall)
Public Enum BWType As Integer
NULL = 0
BEAM = 1
WALL = 2
' Tipo di progetto (Beam o Wall)
Public Enum BWType As Integer
NULL = 0
BEAM = 1
WALL = 2
End Enum
' Tipo di Composite (Element o Layer)
Public Enum CompositeType As Integer
NULL = 0
ELEMENT = 1
LAYER = 2
End Enum
Public Const PROJ As String = "PROJ"
@@ -129,8 +136,13 @@
' info parametri assemblato
Public Const BTL_ASSEBASE_N As String = "N"
Public Const COMPOSITES As String = "Composites"
Public Const ELEMENT As String = "Element"
Public Const LAYER As String = "Layer"
' info parametri BTL
Public Const BTL_PRT_PROJ As String = "PROJ"
Public Const BTL_PRT_TYPE As String = "TYPE"
Public Const BTL_PRT_PDN As String = "PDN"
Public Const BTL_PRT_DO As String = "DO"
Public Const BTL_PRT_NAM As String = "NAM"
+1
View File
@@ -6,6 +6,7 @@
Public Const PROJECT_OPTIMIZER As String = "Project_Optimizer"
Public Const LEFTPANEL_VIEW As String = "LeftPanel_View"
Public Const LEFTPANEL_OPTIMIZER As String = "LeftPanel_Optimizer"
Public Const LEFTPANEL_LAYERSWALL As String = "LeftPanel_LayersWall"
Public Const TOPPANEL_OPTIMIZER As String = "TopPanel_Optimizer"
Public Const LEFTPANEL_SUPERVISOR As String = "LeftPanel_Supervisor"
Public Const PROJECT_SUPERVISOR As String = "Project_Supervisor"
+1
View File
@@ -32,6 +32,7 @@ Public Module ConstGen
CONFIG = 3
INPUTS = 4
OUTPUTS = 5
LAYERSWALL = 6
End Enum
' Abilitazioni licenza
+8 -4
View File
@@ -47,11 +47,13 @@
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="EgtUILib">
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
<Reference Include="EgtUILib, Version=2.3.7.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtUILib.dll</HintPath>
</Reference>
<Reference Include="EgtWPFLib5">
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
<Reference Include="EgtWPFLib5, Version=2.3.4.3, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
@@ -77,6 +79,8 @@
<Import Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="BTLModel\BTLLayerM.vb" />
<Compile Include="BTLModel\BTLElementM.vb" />
<Compile Include="BTLViewModel\BTLFeatureVM.vb" />
<Compile Include="CALCPanel\CalcEditEndEventArgs.vb" />
<Compile Include="Constants\ConstColumns.vb" />
+2 -2
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
@@ -8,7 +8,7 @@
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
</entityFramework>
<connectionStrings>
@@ -1,16 +1,25 @@
using EgtBEAMWALL.DataLayer.DatabaseModels;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EgtBEAMWALL.DataLayer.DatabaseModels;
namespace EgtBEAMWALL.DataLayer.Controllers
{
public class BTLPartController : IDisposable
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
#region Public Constructors
public BTLPartController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -96,13 +105,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
try
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// Add to database
localDbCtx.BTLPartList.AddRange(partData);
// Commit changes
localDbCtx.SaveChanges();
}
// Add to database
dbCtx.BTLPartList.AddRange(partData);
// Commit changes
dbCtx.SaveChanges();
ResetController();
}
catch (Exception exc)
{
@@ -140,13 +147,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
try
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// Add to database
localDbCtx.BTLPartList.AddRange(partData);
// Commit changes
localDbCtx.SaveChanges();
}
// Add to database
dbCtx.BTLPartList.AddRange(partData);
// Commit changes
dbCtx.SaveChanges();
ResetController();
}
catch (Exception exc)
{
@@ -164,24 +169,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Delete(int PartDbId)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2del = localDbCtx
var item2del = dbCtx
.BTLPartList
.Where(x => x.BTLPartDbId == PartDbId)
.SingleOrDefault();
try
{
// Add to database
localDbCtx.BTLPartList.Remove(item2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: {exc}");
}
try
{
// Add to database
dbCtx.BTLPartList.Remove(item2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: {exc}");
}
return done;
}
@@ -194,29 +197,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool DeleteByProject(int ProjDbId)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var items2del = localDbCtx
var items2del = dbCtx
.BTLPartList
.Where(x => x.ProjDbId == ProjDbId);
try
{
// Add to database
localDbCtx.BTLPartList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByProject: {exc}");
}
try
{
// Add to database
dbCtx.BTLPartList.RemoveRange(items2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByProject: {exc}");
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -226,13 +229,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public BTLPartModel FindByDbId(int PartDbId)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
return dbCtx
.BTLPartList
.Where(x => x.BTLPartDbId == PartDbId)
.SingleOrDefault();
}
}
/// <summary>
@@ -242,13 +242,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public BTLPartModel FindByPartId(int PartId)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
return dbCtx
.BTLPartList
.Where(x => x.PartId == PartId)
.SingleOrDefault();
}
}
/// <summary>
@@ -259,13 +256,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public BTLPartModel FindByPartIdProjDbId(int PartId, int ProjDbId)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
return dbCtx
.BTLPartList
.Where(x => x.PartId == PartId && x.ProjDbId == ProjDbId)
.FirstOrDefault();
}
}
/// <summary>
@@ -275,15 +269,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<BTLPartModel> GetByProjectAsc(int ProjDbId)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
// retrieve
return dbCtx
.BTLPartList
.Where(x => x.ProjDbId == ProjDbId)
.OrderBy(x => x.BTLPartDbId)
.ToList();
}
}
/// <summary>
@@ -293,15 +284,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<BTLPartModel> GetByProjectDesc(int ProjDbId)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
// retrieve
return dbCtx
.BTLPartList
.Where(x => x.ProjDbId == ProjDbId)
.OrderByDescending(x => x.BTLPartDbId)
.ToList();
}
}
/// <summary>
@@ -312,22 +300,17 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<BTLPartModel> GetPaginatedAsc(int PartDbIdStart, int numRecord)
{
List<BTLPartModel> answ = new List<BTLPartModel>();
int numEnd = PartDbIdStart - numRecord;
// check numEnd
if (numEnd < 0)
numEnd = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
answ = localDbCtx
.BTLPartList
.Where(x => x.BTLPartDbId <= PartDbIdStart)
.OrderBy(x => x.BTLPartDbId)
.Take(numRecord)
.ToList();
}
return answ;
// retrieve
return dbCtx
.BTLPartList
.Where(x => x.BTLPartDbId <= PartDbIdStart)
.OrderBy(x => x.BTLPartDbId)
.Take(numRecord)
.ToList();
}
/// <summary>
@@ -338,22 +321,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<BTLPartModel> GetPaginatedDesc(int PartDbIdStart, int numRecord)
{
List<BTLPartModel> answ = new List<BTLPartModel>();
int numEnd = PartDbIdStart - numRecord;
// check numEnd
if (numEnd < 0)
numEnd = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
answ = localDbCtx
.BTLPartList
.Where(x => x.BTLPartDbId <= PartDbIdStart)
.OrderByDescending(x => x.BTLPartDbId)
.Take(numRecord)
.ToList();
}
return answ;
// retrieve
return dbCtx
.BTLPartList
.Where(x => x.BTLPartDbId <= PartDbIdStart)
.OrderByDescending(x => x.BTLPartDbId)
.Take(numRecord)
.ToList();
}
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
/// <summary>
@@ -364,30 +351,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(BTLPartModel updItem)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2update = localDbCtx
var item2update = dbCtx
.BTLPartList
.Where(x => x.BTLPartDbId == updItem.BTLPartDbId)
.SingleOrDefault();
try
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
try
{
// update, vers 1...
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
//// update, vers 2
//localDbCtx.BTLPartList.Remove(item2del);
//localDbCtx.BTLPartList.Add(updItem);
//// update, vers 2
//dbCtx.BTLPartList.Remove(item2del);
//dbCtx.BTLPartList.Add(updItem);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
}
// Commit changes
dbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
}
// reset...
ResetController();
return done;
}
@@ -1,16 +1,25 @@
using EgtBEAMWALL.DataLayer.DatabaseModels;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EgtBEAMWALL.DataLayer.DatabaseModels;
namespace EgtBEAMWALL.DataLayer.Controllers
{
public class LogMachineController : IDisposable
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
#region Public Constructors
public LogMachineController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -70,12 +79,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
try
{
using (var locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (var currDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// Add to database
locallocalDbCtx.LogMachineList.Add(newLogMac);
currDbCtx.LogMachineList.Add(newLogMac);
// Commit changes
locallocalDbCtx.SaveChanges();
currDbCtx.SaveChanges();
ResetController();
}
}
catch (Exception exc)
@@ -107,29 +117,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool DeleteByKey(int LogDbId)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var items2del = localDbCtx
var items2del = dbCtx
.LogMachineList
.Where(x => x.LogDbId == LogDbId);
try
{
// Add to database
localDbCtx.LogMachineList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
}
try
{
// Add to database
dbCtx.LogMachineList.RemoveRange(items2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -139,13 +149,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public LogMachineModel FindByDbId(int LogDbId)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
return dbCtx
.LogMachineList
.Where(x => x.LogDbId == LogDbId)
.SingleOrDefault();
}
}
/// <summary>
@@ -156,15 +163,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<LogMachineModel> GetAsc(DateTime dtStart, DateTime dtEnd)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
// retrieve
return dbCtx
.LogMachineList
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
.OrderBy(x => x.AlarmDatetime)
.ToList();
}
}
/// <summary>
@@ -175,15 +179,21 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<LogMachineModel> GetDesc(DateTime dtStart, DateTime dtEnd)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
// retrieve
return dbCtx
.LogMachineList
.Where(x => x.AlarmDatetime >= dtStart && x.AlarmDatetime <= dtEnd)
.OrderByDescending(x => x.AlarmDatetime)
.ToList();
}
}
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
/// <summary>
@@ -194,25 +204,23 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(LogMachineModel updItem)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2update = localDbCtx
var item2update = dbCtx
.LogMachineList
.Where(x => x.LogDbId == updItem.LogDbId)
.SingleOrDefault();
try
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
try
{
// update, vers 1...
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
}
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
}
return done;
}
@@ -10,6 +10,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
@@ -17,6 +18,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public LogSupportController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -38,26 +41,24 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Create(DateTime dtCreated, Core.LogSupportLevel level, Core.LogSupportTarget target, string message)
{
bool fatto = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
try
{
try
{
try
{
LogSupportModel newItem = new LogSupportModel() { DtEvent = dtCreated, Level = level, Target = target, Message = message };
// Add to database
localDbCtx.LogSupportList.Add(newItem);
// Commit changes
localDbCtx.SaveChanges();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Create LogSupport: {exc}");
}
LogSupportModel newItem = new LogSupportModel() { DtEvent = dtCreated, Level = level, Target = target, Message = message };
// Add to database
dbCtx.LogSupportList.Add(newItem);
// Commit changes
dbCtx.SaveChanges();
ResetController();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Create LogSupport: {exc}");
}
catch
{ }
}
catch
{ }
return fatto;
}
@@ -69,29 +70,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool DeleteByKey(int LogDbId)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var items2del = localDbCtx
var items2del = dbCtx
.LogSupportList
.Where(x => x.LogDbId == LogDbId);
try
{
// Add to database
localDbCtx.LogSupportList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
}
try
{
// Add to database
dbCtx.LogSupportList.RemoveRange(items2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByKey: {exc}");
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -101,13 +102,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public LogSupportModel FindByDbId(int LogDbId)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
return dbCtx
.LogSupportList
.Where(x => x.LogDbId == LogDbId)
.SingleOrDefault();
}
}
/// <summary>
@@ -119,14 +117,11 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public List<LogSupportModel> GetPaginatedAsc(DateTime dtStart, DateTime dtEnd)
{
// retrieve
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
return dbCtx
.LogSupportList
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
.OrderBy(x => x.DtEvent)
.ToList();
}
}
/// <summary>
@@ -138,14 +133,20 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public List<LogSupportModel> GetPaginatedDesc(DateTime dtStart, DateTime dtEnd)
{
// retrieve
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
return dbCtx
.LogSupportList
.Where(x => x.DtEvent >= dtStart && x.DtEvent <= dtEnd)
.OrderByDescending(x => x.DtEvent)
.ToList();
}
}
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
/// <summary>
@@ -156,25 +157,23 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(LogSupportModel updItem)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2update = localDbCtx
var item2update = dbCtx
.LogSupportList
.Where(x => x.LogDbId == updItem.LogDbId)
.SingleOrDefault();
try
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
try
{
// update, vers 1...
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
}
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
}
return done;
}
@@ -7,6 +7,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
public class MachGroupController : IDisposable
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
#region Public Fields
public static MachGroupController man = new MachGroupController();
@@ -17,6 +23,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public MachGroupController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -207,6 +215,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -216,13 +226,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public MachGroupModel FindByMachGroupDbId(int MachGroupDbId)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.MachGroupList
.Where(x => x.MachGroupDbId == MachGroupDbId)
.SingleOrDefault();
}
return dbCtx
.MachGroupList
.Where(x => x.MachGroupDbId == MachGroupDbId)
.SingleOrDefault();
}
/// <summary>
@@ -232,6 +239,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public MachGroupModel FindByMachGroupId(int ProdId, int MachGroupId)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
@@ -250,32 +258,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
// verificare fattibilità in 1 solo passo
int ProdDbId = 0;
List<MachGroupModel> answ = new List<MachGroupModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
try
{
try
var currProd = dbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
{
var currProd = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
{
ProdDbId = currProd.ProdDbId;
}
ProdDbId = currProd.ProdDbId;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
}
answ = localDbCtx
.MachGroupList
.Where(x => x.ProdDbId == ProdDbId)
.OrderBy(x => x.ProdIndex)
.ThenBy(x => x.MachGroupId)
.ToList();
}
return answ;
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
}
return dbCtx
.MachGroupList
.Where(x => x.ProdDbId == ProdDbId)
.OrderBy(x => x.ProdIndex)
.ThenBy(x => x.MachGroupId)
.ToList();
}
/// <summary>
@@ -287,33 +290,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
// recupero
int ProdDbId = 0;
List<MachGroupModel> answ = new List<MachGroupModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
// verificare fattibilità in 1 solo passo
try
{
// verificare fattibilità in 1 solo passo
try
var currProd = dbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
{
var currProd = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
{
ProdDbId = currProd.ProdDbId;
}
ProdDbId = currProd.ProdDbId;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdDesc: {exc}");
}
answ = localDbCtx
.MachGroupList
.Where(x => x.ProdDbId == ProdDbId)
.OrderByDescending(x => x.ProdIndex)
.ThenByDescending(x => x.MachGroupId)
.ToList();
}
return answ;
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdDesc: {exc}");
}
return dbCtx
.MachGroupList
.Where(x => x.ProdDbId == ProdDbId)
.OrderByDescending(x => x.ProdIndex)
.ThenByDescending(x => x.MachGroupId)
.ToList();
}
/// <summary>
@@ -324,15 +323,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public List<MachGroupModel> GetByProdSupervisor(int ProdId, string SupervisorId)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.SupervisorId == SupervisorId)
.OrderBy(x => x.ProdIndex)
.ThenBy(x => x.MachGroupId)
.ToList();
}
return dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.SupervisorId == SupervisorId)
.OrderBy(x => x.ProdIndex)
.ThenBy(x => x.MachGroupId)
.ToList();
}
/// <summary>
@@ -406,6 +402,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return done;
}
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
/// <summary>
/// Set MachGroup as NeedRedo (ripresa = da rigenerare)
/// </summary>
@@ -1,11 +1,19 @@
using EgtBEAMWALL.DataLayer.DatabaseModels;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EgtBEAMWALL.DataLayer.DatabaseModels;
namespace EgtBEAMWALL.DataLayer.Controllers
{
public class PartController : IDisposable
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
#region Public Fields
public static PartController man = new PartController();
@@ -16,6 +24,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public PartController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -32,18 +42,36 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
int BtlPartDbId = 0;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
#if false
var currProj = dbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.FirstOrDefault();
if (currProj != null)
{
var btlPart = locallocalDbCtx
.BTLPartList
.Where(x => x.Project.ProjId == ProjId && x.PDN == PDN)
.SingleOrDefault();
var btlPart = dbCtx
.BTLPartList
.Where(x => x.ProjDbId == currProj.ProjDbId && x.PDN == PDN)
.SingleOrDefault();
if (btlPart != null)
{
BtlPartDbId = btlPart.BTLPartDbId;
}
}
#endif
var btlPart = dbCtx
.BTLPartList
.Where(x => x.Project.ProjId == ProjId && x.PDN == PDN)
.SingleOrDefault();
if (btlPart != null)
{
BtlPartDbId = btlPart.BTLPartDbId;
}
return BtlPartDbId;
}
@@ -57,18 +85,16 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
int BtlPartDbId = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var btlPart = localDbCtx
var btlPart = dbCtx
.BTLPartList
.Where(x => x.Project.ProjId == ProjId && x.PartId == BtlPartId)
.SingleOrDefault();
if (btlPart != null)
{
BtlPartDbId = btlPart.BTLPartDbId;
}
if (btlPart != null)
{
BtlPartDbId = btlPart.BTLPartDbId;
}
return BtlPartDbId;
}
@@ -125,26 +151,24 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Delete(int ProdId, int MachGroupId, int PartId)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2del = localDbCtx
var item2del = dbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.SingleOrDefault();
try
{
// Remove from database
localDbCtx.PartList.Remove(item2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId} | PartId: {PartId}{Environment.NewLine}{exc}");
}
try
{
// Remove from database
dbCtx.PartList.Remove(item2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: ProdId: {ProdId} | MachGroupId: {MachGroupId} | PartId: {PartId}{Environment.NewLine}{exc}");
}
return done;
}
@@ -157,24 +181,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Delete(int PartDbId)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2del = localDbCtx
var item2del = dbCtx
.PartList
.Where(x => x.PartDbId == PartDbId)
.SingleOrDefault();
try
{
// Add to database
localDbCtx.PartList.Remove(item2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: {exc}");
}
try
{
// Add to database
dbCtx.PartList.Remove(item2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on Delete: {exc}");
}
return done;
}
@@ -187,29 +209,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool DeleteByMachGroup(int MachGroupDbId)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var items2del = localDbCtx
var items2del = dbCtx
.PartList
.Where(x => x.MachGroupDbId == MachGroupDbId);
try
{
// Add to database
localDbCtx.PartList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByMachGroup: {exc}");
}
try
{
// Add to database
dbCtx.PartList.RemoveRange(items2del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteByMachGroup: {exc}");
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -219,13 +241,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public PartModel FindByDbId(int PartDbId)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
return localDbCtx
return dbCtx
.PartList
.Where(x => x.PartDbId == PartDbId)
.SingleOrDefault();
}
}
/// <summary>
@@ -236,9 +255,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public PartModel FindByPartId(int ProdId, int PartId)
{
PartModel answ = null;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
answ = locallocalDbCtx
answ = localDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.PartId == PartId)
.FirstOrDefault();
@@ -246,6 +265,15 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return answ;
}
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
/// <summary>
/// Update single Part
/// </summary>
@@ -254,23 +282,23 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(PartModel updItem)
{
bool done = false;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2update = locallocalDbCtx
var item2update = localDbCtx
.PartList
.Where(x => x.PartDbId == updItem.PartDbId)
.SingleOrDefault();
try
{
// update, vers 1...
locallocalDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
//// update, vers 2
//localDbCtx.PartList.Remove(item2del);
//localDbCtx.PartList.Add(updItem);
//dbCtx.PartList.Remove(item2del);
//dbCtx.PartList.Add(updItem);
// Commit changes
locallocalDbCtx.SaveChanges();
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", updItem.MachGroup.Prod.ProdId, updItem.PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
@@ -290,18 +318,18 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateEnd(int ProdId, int MachGroupId, int PartId, DateTime DtEnd)
{
bool done = false;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
// aggiorno
locallocalDbCtx
localDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault()
.DtEnd = DtEnd;
// Commit changes
locallocalDbCtx.SaveChanges();
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtEnd == DateTime.MinValue ? Core.StatusMapOpType.ResetPartEnd : Core.StatusMapOpType.PartEnd, "");
@@ -323,18 +351,18 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateStart(int ProdId, int MachGroupId, int PartId, DateTime DtStart)
{
bool done = false;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
// aggiorno
locallocalDbCtx
localDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault()
.DtStart = DtStart;
// Commit changes
locallocalDbCtx.SaveChanges();
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, DtStart == DateTime.MinValue ? Core.StatusMapOpType.ResetPartStart : Core.StatusMapOpType.PartStart, "");
@@ -357,18 +385,18 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool UpdateStatus(int ProdId, int MachGroupId, int PartId, Core.ItemState newState)
{
bool done = false;
using (DatabaseContext locallocalDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
try
{
// aggiorno
locallocalDbCtx
localDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == MachGroupId && x.PartId == PartId)
.FirstOrDefault()
.State = newState;
// Commit changes
locallocalDbCtx.SaveChanges();
localDbCtx.SaveChanges();
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, PartId, Core.StatusMapItemType.Part, Core.StatusMapOpType.MachGroupMod, "");
@@ -11,6 +11,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
@@ -24,6 +25,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public ProdController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -48,20 +51,17 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
protected List<ProdModel> GetLastDbModelDesc(int numRecord)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
numRecord = localDbCtx.ProdList.Count();
}
// retrieve
return localDbCtx
.ProdList
.OrderByDescending(x => x.ProdId)
.Take(numRecord)
.ToList();
numRecord = dbCtx.ProdList.Count();
}
// retrieve
return dbCtx
.ProdList
.OrderByDescending(x => x.ProdId)
.Take(numRecord)
.ToList();
}
protected List<int> ProjIdByProd(int ProdId)
@@ -83,27 +83,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// cerco Prod
var currProd = localDbCtx
// cerco Prod
var currProd = dbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
// cerco Proj
var currProj = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.FirstOrDefault();
// cerco Proj
var currProj = dbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.FirstOrDefault();
// lo aggiorno
currProj.ProdDbId = currProd.ProdDbId;
currProj.Locked = true;
// lo aggiorno
currProj.ProdDbId = currProd.ProdDbId;
currProj.Locked = true;
// salvo
dbCtx.SaveChanges();
ResetController();
// salvo
localDbCtx.SaveChanges();
}
return done;
}
@@ -111,59 +110,59 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
var currProd = FindByProdId(ProdId);
// sel dei proj da aggiornare...
var proj2update = dbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
// sel dei MachGroup da prod
var machGroup2del = dbCtx
.MachGroupList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
// selezione dei part da machgroup
var part2del = dbCtx
.PartList
.Where(x => x.MachGroup.ProdDbId == currProd.ProdDbId)
.ToList();
try
{
var currProd = FindByProdId(ProdId);
// sel dei proj da aggiornare...
var proj2update = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
// sel dei MachGroup da prod
var machGroup2del = localDbCtx
.MachGroupList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
// selezione dei part da machgroup
var part2del = localDbCtx
.PartList
.Where(x => x.MachGroup.ProdDbId == currProd.ProdDbId)
.ToList();
try
// update proj...
foreach (var item in proj2update)
{
// update proj...
foreach (var item in proj2update)
{
item.ProdDbId = null;
}
//// salvo
//localDbCtx.SaveChanges();
// remove from database
localDbCtx.PartList.RemoveRange(part2del);
//// salvo
//localDbCtx.SaveChanges();
localDbCtx.MachGroupList.RemoveRange(machGroup2del);
//// salvo
//localDbCtx.SaveChanges();
localDbCtx.ProdList.Remove(currProd);
// salvo
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteProd: {exc}");
item.ProdDbId = null;
}
//// salvo
//dbCtx.SaveChanges();
// remove from database
dbCtx.PartList.RemoveRange(part2del);
//// salvo
//dbCtx.SaveChanges();
dbCtx.MachGroupList.RemoveRange(machGroup2del);
//// salvo
//dbCtx.SaveChanges();
dbCtx.ProdList.Remove(currProd);
// salvo
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteProd: {exc}");
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -173,13 +172,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public ProdModel FindByProdDbId(int ProdDbId)
{
ProdModel answ;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
answ = localDbCtx
var answ = dbCtx
.ProdList
.Where(x => x.ProdDbId == ProdDbId)
.SingleOrDefault();
// forzo rilettura
if (answ != null)
{
dbCtx.Entry(answ).Reload();
}
return answ;
}
@@ -191,13 +191,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public ProdModel FindByProdId(int ProdId)
{
ProdModel answ;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
answ = localDbCtx
var answ = dbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
// forzo rilettura
if (answ != null)
{
dbCtx.Entry(answ).Reload();
}
return answ;
}
@@ -240,44 +241,42 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
int nextId = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
// cerco se ne ho ALMENO 1....
var numRec = dbCtx.ProdList.Count();
if (numRec == 0)
{
// cerco se ne ho ALMENO 1....
var numRec = localDbCtx.ProdList.Count();
if (numRec == 0)
{
nextId = 1;
}
else
{
// retrieve ultimo...
var maxRecord = localDbCtx
.ProdList
.OrderByDescending(x => x.ProdId)
.Take(1)
.FirstOrDefault();
// incremento
nextId = maxRecord.ProdId + 1;
}
// creo nuovo PROD...
var newProd = localDbCtx
.ProdList
.Add(new ProdModel() { ProdId = nextId, Locked = true, DtCreated = DateTime.Now });
// cerco Proj
var currProj = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.FirstOrDefault();
// aggiungo proj-prod
currProj.ProdDbId = newProd.ProdDbId;
currProj.Locked = true;
// Commit changes
localDbCtx.SaveChanges();
nextId = 1;
}
else
{
// retrieve ultimo...
var maxRecord = dbCtx
.ProdList
.OrderByDescending(x => x.ProdId)
.Take(1)
.FirstOrDefault();
// incremento
nextId = maxRecord.ProdId + 1;
}
// creo nuovo PROD...
var newProd = dbCtx
.ProdList
.Add(new ProdModel() { ProdId = nextId, Locked = true, DtCreated = DateTime.Now });
// cerco Proj
var currProj = dbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.FirstOrDefault();
// aggiungo proj-prod
currProj.ProdDbId = newProd.ProdDbId;
currProj.Locked = true;
// Commit changes
dbCtx.SaveChanges();
return nextId;
}
@@ -289,15 +288,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public bool IsAnyInSupervisor(int ProdId)
{
int numAssigned = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// cerco se ci siano assegnati a supervisor
numAssigned = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && (!string.IsNullOrEmpty(x.SupervisorId) || x.State >= 0))
.Count();
}
// cerco se ci siano assegnati a supervisor
var numAssigned = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && (!string.IsNullOrEmpty(x.SupervisorId) || x.State >= 0))
.Count();
return numAssigned > 0;
}
@@ -309,35 +305,33 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public ProdModel LockByProdId(int ProdId, bool Locked)
{
ProdModel currProd;
// seleziono il prod...
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
var currProd = dbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
if (currProd != null)
{
currProd = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
currProd.Locked = Locked;
dbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
if (currProd != null)
var currProj = dbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
//currProj.ForEach(x => x.Locked = Locked);
foreach (var item in currProj)
{
currProd.Locked = Locked;
localDbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
var currProj = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
//currProj.ForEach(x => x.Locked = Locked);
foreach (var item in currProj)
{
item.Locked = Locked;
localDbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
}
item.Locked = Locked;
dbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
}
localDbCtx.SaveChanges();
}
dbCtx.SaveChanges();
ResetController();
return currProd;
}
@@ -348,30 +342,28 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public bool IsLockByProdId(int ProdId)
{
bool bIsLock = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// seleziono il prod...
var currProd = localDbCtx
// seleziono il prod...
var currProd = dbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
var bIsLock = false;
if (currProd != null)
{
bIsLock = currProd.Locked;
var currProj = dbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
if (currProj != null && !bIsLock)
{
bIsLock = currProd.Locked;
var currProj = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId)
.ToList();
if (currProj != null && !bIsLock)
{
bIsLock = currProj.Any(x => x.Locked);
}
bIsLock = currProj.Any(x => x.Locked);
}
}
return bIsLock;
}
@@ -380,7 +372,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// </summary>
public void ResetController()
{
}
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
/// <summary>
/// Update single PROD
@@ -390,28 +384,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(ProdModel updItem)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
var item2update = localDbCtx
var item2update = dbCtx
.ProdList
.Where(x => x.ProdDbId == updItem.ProdDbId)
.SingleOrDefault();
try
{
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
try
{
// update, vers 1...
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
//// update, vers 2
//localDbCtx.PartList.Remove(item2del);
//localDbCtx.PartList.Add(updItem);
//// update, vers 2
//dbCtx.PartList.Remove(item2del);
//dbCtx.PartList.Add(updItem);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch
{ }
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch
{ }
return done;
}
@@ -429,124 +421,129 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Recupero il PROD
ProdModel currData = FindByProdId(ProdId);
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
try
{
try
{
// preparo elenco
List<MachGroupModel> itemsMG2Add = new List<MachGroupModel>();
// preparo elenco
List<MachGroupModel> itemsMG2Add = new List<MachGroupModel>();
List<Core.MyMachGroupM> MachGroupList2Add = new List<Core.MyMachGroupM>();
List<PartModel> PartList2Add = new List<PartModel>();
// cerco le MG esistenti --> aggiorno
foreach (var item in MachGroupList)
List<Core.MyMachGroupM> MachGroupList2Add = new List<Core.MyMachGroupM>();
List<PartModel> PartList2Add = new List<PartModel>();
// cerco le MG esistenti --> aggiorno
foreach (var item in MachGroupList)
{
#if false
var currMG = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == item.Id)
.SingleOrDefault();
#endif
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
var convCurrMG = MachGroupController.ConvertFromCore(item, currData.ProdDbId);
if (currMG != null)
{
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
var convCurrMG = MachGroupController.ConvertFromCore(item, currData.ProdDbId);
if (currMG != null)
// se non identico x equality limitata a ViewOptim...
if (!currMG.ViewOptimEquals(convCurrMG))
{
// aggiorno con nuovi valori ricevuti
currMG.H = convCurrMG.H;
currMG.L = convCurrMG.L;
currMG.W = convCurrMG.W;
currMG.Material = convCurrMG.Material;
currMG.Name = convCurrMG.Name;
// salvo
dbCtx.SaveChanges();
// registro modifica StatusMap
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
}
else
{
itemsMG2Add.Add(convCurrMG);
// registro modifica StatusMap
StatusMapController.man.UpdateAction("", ProdId, item.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
}
}
// aggiungo MachGroup
dbCtx.MachGroupList.AddRange(itemsMG2Add);
// Commit changes
dbCtx.SaveChanges();
// verifico di nuovo l'elenco delle MG x le relative PART...
foreach (var item in MachGroupList)
{
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
int MachGroupDbId = currMG.MachGroupDbId;
bool modMg = false;
// verifico se uguali o meno...
foreach (var currPartM in item.PartMList)
{
var currPart = dbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == item.Id && x.PartId == currPartM.nPartId)
.SingleOrDefault();
var convCurrPartM = PartController.ConvertFromCore(currPartM, MachGroupDbId);
if (currPart != null)
{
// se non identico x equality limitata a ViewOptim...
if (!currMG.ViewOptimEquals(convCurrMG))
if (!currPart.ViewOptimEquals(convCurrPartM))
{
// aggiorno con nuovi valori ricevuti
currMG.H = convCurrMG.H;
currMG.L = convCurrMG.L;
currMG.W = convCurrMG.W;
currMG.Material = convCurrMG.Material;
currMG.Name = convCurrMG.Name;
currPart.H = convCurrPartM.H;
currPart.L = convCurrPartM.L;
currPart.W = convCurrPartM.W;
currPart.Material = convCurrPartM.Material;
currPart.CALC_State = convCurrPartM.CALC_State;
currPart.ROT = convCurrPartM.ROT;
currPart.PDN = convCurrPartM.PDN;
currPart.NAM = convCurrPartM.NAM;
// salvo
localDbCtx.SaveChanges();
// registro modifica StatusMap
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
dbCtx.SaveChanges();
modMg = true;
}
}
else
{
itemsMG2Add.Add(convCurrMG);
// registro modifica StatusMap
StatusMapController.man.UpdateAction("", ProdId, item.Id, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupAdd, "");
PartList2Add.Add(convCurrPartM);
modMg = true;
}
}
// aggiungo MachGroup
localDbCtx.MachGroupList.AddRange(itemsMG2Add);
// Commit changes
localDbCtx.SaveChanges();
// verifico di nuovo l'elenco delle MG x le relative PART...
foreach (var item in MachGroupList)
// verifico se salvare...
if (modMg)
{
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
int MachGroupDbId = currMG.MachGroupDbId;
bool modMg = false;
// verifico se uguali o meno...
foreach (var currPartM in item.PartMList)
{
var currPart = localDbCtx
.PartList
.Where(x => x.MachGroup.Prod.ProdId == ProdId && x.MachGroup.MachGroupId == item.Id && x.PartId == currPartM.nPartId)
.SingleOrDefault();
var convCurrPartM = PartController.ConvertFromCore(currPartM, MachGroupDbId);
if (currPart != null)
{
// se non identico x equality limitata a ViewOptim...
if (!currPart.ViewOptimEquals(convCurrPartM))
{
// aggiorno con nuovi valori ricevuti
currPart.H = convCurrPartM.H;
currPart.L = convCurrPartM.L;
currPart.W = convCurrPartM.W;
currPart.Material = convCurrPartM.Material;
currPart.CALC_State = convCurrPartM.CALC_State;
currPart.ROT = convCurrPartM.ROT;
currPart.PDN = convCurrPartM.PDN;
currPart.NAM = convCurrPartM.NAM;
// salvo
localDbCtx.SaveChanges();
modMg = true;
}
}
else
{
PartList2Add.Add(convCurrPartM);
modMg = true;
}
}
// verifico se salvare...
if (modMg)
{
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
StatusMapController.man.UpdateAction(currMG.SupervisorId, ProdId, currMG.MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
}
// aggiungo PartList
localDbCtx.PartList.AddRange(PartList2Add);
// Commit changes
localDbCtx.SaveChanges();
// sel dei MachGroup da prod OLD
List<MachGroupModel> itemsMGOld = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId)
.ToList();
// elenco degli ID del MachGroup NON trovati
List<int> MgId2rem = itemsMGOld.Select(x => x.MachGroupId).Except(MachGroupList.Select(y => y.Id)).ToList();
// processo i MachGroup eliminati
foreach (var item in MgId2rem)
{
MachGroupController.man.Delete(ProdId, item);
}
// aggiorno valore isNew a false x PROD
currData.IsNew = false;
// Commit changes
localDbCtx.SaveChanges();
}
catch (Exception exc)
// aggiungo PartList
dbCtx.PartList.AddRange(PartList2Add);
// Commit changes
dbCtx.SaveChanges();
// sel dei MachGroup da prod OLD
List<MachGroupModel> itemsMGOld = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId)
.ToList();
// elenco degli ID del MachGroup NON trovati
List<int> MgId2rem = itemsMGOld.Select(x => x.MachGroupId).Except(MachGroupList.Select(y => y.Id)).ToList();
// processo i MachGroup eliminati
foreach (var item in MgId2rem)
{
Console.WriteLine($"EXCEPTION on UpdateMachGroup: {exc}");
MachGroupController.man.Delete(ProdId, item);
}
// aggiorno valore isNew a false x PROD
currData.IsNew = false;
// Commit changes
dbCtx.SaveChanges();
ResetController();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateMachGroup: {exc}");
}
return currData;
}
@@ -558,19 +555,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProdFileM UpdatePType(int ProdId, BWType PType)
{
ProdModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
// aggiorno valore BTL
currData.PType = PType;
var currData = FindByProdId(ProdId);
// aggiorno valore BTL
currData.PType = PType;
// Commit changes
dbCtx.SaveChanges();
ResetController();
// Commit changes
localDbCtx.SaveChanges();
}
return coreConv(currData);
}
@@ -582,19 +574,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProdFileM UpdateMachine(int ProdId, String Machine)
{
ProdModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
// aggiorno valore BTL
currData.Machine = Machine;
var currData = FindByProdId(ProdId);
// aggiorno valore BTL
currData.Machine = Machine;
// Commit changes
dbCtx.SaveChanges();
ResetController();
// Commit changes
localDbCtx.SaveChanges();
}
return coreConv(currData);
}
@@ -11,6 +11,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
@@ -18,6 +19,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public ProjController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -47,19 +50,16 @@ namespace EgtBEAMWALL.DataLayer.Controllers
protected List<ProjModel> GetLastDbModelDesc(int numRecord)
{
// se numRecord = 0 --> passo tutti
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
if (numRecord == 0)
{
if (numRecord == 0)
{
numRecord = localDbCtx.ProjList.Count();
}
// retrieve
return localDbCtx
.ProjList
.OrderByDescending(x => x.ProjId)
.Take(numRecord)
.ToList();
numRecord = dbCtx.ProjList.Count();
}
// retrieve
return dbCtx
.ProjList
.OrderByDescending(x => x.ProjId)
.Take(numRecord)
.ToList();
}
/// <summary>
@@ -71,19 +71,16 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
int answ = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
if (ProdDbId != null)
{
if (ProdDbId != null)
{
var prodRecord = localDbCtx
.ProdList
.Where(x => x.ProdDbId == ProdDbId)
.SingleOrDefault();
var prodRecord = dbCtx
.ProdList
.Where(x => x.ProdDbId == ProdDbId)
.SingleOrDefault();
if (prodRecord != null)
{
answ = prodRecord.ProdId;
}
if (prodRecord != null)
{
answ = prodRecord.ProdId;
}
}
return answ;
@@ -125,32 +122,32 @@ namespace EgtBEAMWALL.DataLayer.Controllers
var currProj = FindByProjId(ProjId);
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// sel delle BTLParts da proj
var parts2del = localDbCtx
.BTLPartList
.Where(x => x.ProjDbId == currProj.ProjDbId);
// sel delle BTLParts da proj
var parts2del = dbCtx
.BTLPartList
.Where(x => x.ProjDbId == currProj.ProjDbId);
try
{
// remove from database
localDbCtx.BTLPartList.RemoveRange(parts2del);
localDbCtx.ProjList.Remove(currProj);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteProj: {exc}");
}
try
{
// remove from database
dbCtx.BTLPartList.RemoveRange(parts2del);
dbCtx.ProjList.Remove(currProj);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteProj: {exc}");
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -175,7 +172,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// cerco eventuali dati "child" puliti
var childRec = localDbCtx
.ProjList
.Where(x => x.BTLFileName.StartsWith(BtlFileName + "_"))
.Where(x => x.BTLFileName.StartsWith(BtlFileName+"_"))
.ToList();
// faccio filtro con ricerca regexp x scartare "falsi positivi" come BtlFileName_nonNumero...
if (childRec.Count > 0)
@@ -205,13 +202,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public ProjModel FindByProjDbId(int ProjDbId)
{
ProjModel answ;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
ProjModel answ = dbCtx
.ProjList
.Where(x => x.ProjDbId == ProjDbId)
.SingleOrDefault();
// forzo rilettura
if (answ != null)
{
answ = localDbCtx
.ProjList
.Where(x => x.ProjDbId == ProjDbId)
.SingleOrDefault();
dbCtx.Entry(answ).Reload();
}
return answ;
}
@@ -223,13 +221,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public ProjModel FindByProjId(int ProjId)
{
ProjModel answ;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
answ = localDbCtx
var answ = dbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// forzo rilettura
if (answ != null)
{
dbCtx.Entry(answ).Reload();
}
return answ;
}
@@ -253,32 +252,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
int ProdDbId = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
try
{
try
var currProd = dbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
{
var currProd = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
{
ProdDbId = currProd.ProdDbId;
}
ProdDbId = currProd.ProdDbId;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
}
// retrieve
var dbRes = localDbCtx
.ProjList
.Where(x => x.ProdDbId == ProdDbId)
.OrderBy(x => x.ProdDbId)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
}
// retrieve
var dbRes = dbCtx
.ProjList
.Where(x => x.ProdDbId == ProdDbId)
.OrderBy(x => x.ProdDbId)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
return answ;
}
@@ -291,32 +287,29 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
int ProdDbId = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
try
{
try
var currProd = dbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
{
var currProd = localDbCtx
.ProdList
.Where(x => x.ProdId == ProdId)
.FirstOrDefault();
if (currProd != null)
{
ProdDbId = currProd.ProdDbId;
}
ProdDbId = currProd.ProdDbId;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
}
// retrieve
var dbRes = localDbCtx
.ProjList
.Where(x => x.ProdDbId == ProdDbId)
.OrderByDescending(x => x.ProdDbId)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on GetByProdAsc: {exc}");
}
// retrieve
var dbRes = dbCtx
.ProjList
.Where(x => x.ProdDbId == ProdDbId)
.OrderByDescending(x => x.ProdDbId)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
return answ;
}
@@ -349,22 +342,19 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
List<Core.ProjFileM> answ = new List<Core.ProjFileM>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
// se numRecord = 0 --> passo tutti
if (numRecord == 0)
{
numRecord = localDbCtx.ProjList.Count();
}
// retrieve
var dbRes = localDbCtx
.ProjList
.OrderByDescending(x => x.ProjId)
.Take(numRecord)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
numRecord = dbCtx.ProjList.Count();
}
// retrieve
var dbRes = dbCtx
.ProjList
.OrderByDescending(x => x.ProjId)
.Take(numRecord)
.ToList();
// conversione
answ = dbRes.Select(x => coreConv(x)).ToList();
return answ;
}
@@ -376,34 +366,32 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
int nextId = 0;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
// cerco se ne ho ALMENO 1....
var numRec = dbCtx.ProjList.Count();
if (numRec == 0)
{
// cerco se ne ho ALMENO 1....
var numRec = localDbCtx.ProjList.Count();
if (numRec == 0)
{
nextId = 1;
}
else
{
// retrieve ultimo...
var maxRecord = localDbCtx
.ProjList
.OrderByDescending(x => x.ProjId)
.Take(1)
.FirstOrDefault();
// incremento
nextId = maxRecord.ProjId + 1;
}
// creo nuovo...
var newRec = localDbCtx
.ProjList
.Add(new ProjModel() { ProjId = nextId, BTLFileName = "", IsNew = true, Locked = true, DtCreated = DateTime.Now });
// Commit changes
localDbCtx.SaveChanges();
nextId = 1;
}
else
{
// retrieve ultimo...
var maxRecord = dbCtx
.ProjList
.OrderByDescending(x => x.ProjId)
.Take(1)
.FirstOrDefault();
// incremento
nextId = maxRecord.ProjId + 1;
}
// creo nuovo...
var newRec = dbCtx
.ProjList
.Add(new ProjModel() { ProjId = nextId, BTLFileName = "", IsNew = true, Locked = true, DtCreated = DateTime.Now });
// Commit changes
dbCtx.SaveChanges();
return nextId;
}
@@ -415,46 +403,44 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProjFileM LockByProjId(int ProjId, bool Locked)
{
ProjModel currProj;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
var currProj = dbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// aggiorno stato del proj
currProj.Locked = Locked;
dbCtx.Entry(currProj).State = System.Data.Entity.EntityState.Modified;
// seleziono il prod e lo blocco...
var currProd = dbCtx
.ProdList
.Where(x => x.ProdDbId == currProj.ProdDbId)
.SingleOrDefault();
if (currProd != null)
{
currProj = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// aggiorno stato del proj
currProj.Locked = Locked;
localDbCtx.Entry(currProj).State = System.Data.Entity.EntityState.Modified;
// blocco prod corrente
currProd.Locked = Locked;
dbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
// seleziono il prod e lo blocco...
var currProd = localDbCtx
.ProdList
.Where(x => x.ProdDbId == currProj.ProdDbId)
.SingleOrDefault();
// ora blocco altri proj del prod...
var currProjs = dbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId && x.ProjId != ProjId)
.ToList();
if (currProd != null)
//currProjs.ForEach(x => x.Locked = Locked);
foreach (var item in currProjs)
{
// blocco prod corrente
currProd.Locked = Locked;
localDbCtx.Entry(currProd).State = System.Data.Entity.EntityState.Modified;
// ora blocco altri proj del prod...
var currProjs = localDbCtx
.ProjList
.Where(x => x.ProdDbId == currProd.ProdDbId && x.ProjId != ProjId)
.ToList();
//currProjs.ForEach(x => x.Locked = Locked);
foreach (var item in currProjs)
{
//item.ProdDbId = currProd.ProdDbId;
item.Locked = Locked;
localDbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
}
//item.ProdDbId = currProd.ProdDbId;
item.Locked = Locked;
dbCtx.Entry(item).State = System.Data.Entity.EntityState.Modified;
}
// salvataggio
localDbCtx.SaveChanges();
}
// salvataggio
dbCtx.SaveChanges();
ResetController();
return coreConv(currProj);
}
@@ -463,7 +449,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// </summary>
public void ResetController()
{
}
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
/// <summary>
/// Reimposta come NEW
@@ -473,18 +461,16 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProjFileM ResetNew(int ProjId)
{
ProjModel currProj;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currProj = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
var currProj = dbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// aggiorno stato
currProj.IsNew = false;
dbCtx.SaveChanges();
ResetController();
// aggiorno stato
currProj.IsNew = false;
localDbCtx.SaveChanges();
}
return coreConv(currProj);
}
@@ -496,29 +482,27 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public bool Update(ProjModel updItem)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
var item2update = dbCtx
.ProjList
.Where(x => x.ProjId == updItem.ProjId)
.SingleOrDefault();
try
{
var item2update = localDbCtx
.ProjList
.Where(x => x.ProjId == updItem.ProjId)
.SingleOrDefault();
try
{
updItem.ProjDbId = item2update.ProjDbId;
// update, vers 1...
localDbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
updItem.ProjDbId = item2update.ProjDbId;
// update, vers 1...
dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
//// update, vers 2
//dbCtx.PartList.Remove(item2del);
//dbCtx.PartList.Add(updItem);
//// update, vers 2
//dbCtx.PartList.Remove(item2del);
//dbCtx.PartList.Add(updItem);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception ex)
{ }
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception ex)
{ }
return done;
}
@@ -533,74 +517,73 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// record del proj corrente
var currData = FindByProjId(ProjId);
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
// 2021.05.03 modifica update: esistenti le MODIFICO, nuove aggiungo, inesistenti elimino in cascata con Part
// sel delle BTLParts del proj
List<BTLPartModel> oldBtlParts = dbCtx
.BTLPartList
.Where(x => x.ProjDbId == currData.ProjDbId)
.ToList();
// converto le BtlParts da core --> DB
List<BTLPartModel> newBtlParts = BtlPartList.Select(x => BTLPartController.ConvertFromCore(x, currData.ProjDbId)).ToList();
try
{
// 2021.05.03 modifica update: esistenti le MODIFICO, nuove aggiungo, inesistenti elimino in cascata con Part
// elementi BtlPartId NON + presenti da eliminare
List<int> bpi2rem = oldBtlParts.Select(x => x.PartId).Except(newBtlParts.Select(y => y.PartId)).ToList();
List<int> bpi2add = newBtlParts.Select(x => x.PartId).Except(oldBtlParts.Select(y => y.PartId)).ToList();
List<int> bpiExis = newBtlParts.Select(x => x.PartId).Intersect(oldBtlParts.Select(y => y.PartId)).ToList();
// sel delle BTLParts del proj
List<BTLPartModel> oldBtlParts = localDbCtx
.BTLPartList
.Where(x => x.ProjDbId == currData.ProjDbId)
.ToList();
// converto le BtlParts da core --> DB
List<BTLPartModel> newBtlParts = BtlPartList.Select(x => BTLPartController.ConvertFromCore(x, currData.ProjDbId)).ToList();
try
// aggiorno existing...
foreach (var currPartId in bpiExis)
{
// elementi BtlPartId NON + presenti da eliminare
List<int> bpi2rem = oldBtlParts.Select(x => x.PartId).Except(newBtlParts.Select(y => y.PartId)).ToList();
List<int> bpi2add = newBtlParts.Select(x => x.PartId).Except(oldBtlParts.Select(y => y.PartId)).ToList();
List<int> bpiExis = newBtlParts.Select(x => x.PartId).Intersect(oldBtlParts.Select(y => y.PartId)).ToList();
// aggiorno existing...
foreach (var currPartId in bpiExis)
// recupero item da aggiornare...
var oldItem = oldBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
// dati nuovo item
var newItem = newBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
if (newItem != null && oldItem != null)
{
// recupero item da aggiornare...
var oldItem = oldBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
// dati nuovo item
var newItem = newBtlParts.Where(x => x.PartId == currPartId).FirstOrDefault();
if (newItem != null && oldItem != null)
{
oldItem.CALC_State = newItem.CALC_State;
oldItem.CNT = newItem.CNT;
oldItem.DO = newItem.DO;
oldItem.H = newItem.H;
oldItem.L = newItem.L;
oldItem.W = newItem.W;
oldItem.Material = newItem.Material;
oldItem.NAM = newItem.NAM;
oldItem.PDN = newItem.PDN;
}
}
// aggiungo le nuove part
foreach (var newPartId in bpi2add)
{
var newItem = newBtlParts.Where(x => x.PartId == newPartId).FirstOrDefault();
localDbCtx.BTLPartList.Add(newItem);
}
// elimino dal DB i non + esistenti
foreach (var oldPartId in bpi2rem)
{
// elimino parts nei MachGroup
var oldIstPartList = localDbCtx.PartList.Where(x => x.BTLPart.PartId == oldPartId).ToList();
localDbCtx.PartList.RemoveRange(oldIstPartList);
// elimino BtlParts
var oldItem = oldBtlParts.Where(x => x.PartId == oldPartId).FirstOrDefault();
localDbCtx.BTLPartList.Remove(oldItem);
oldItem.CALC_State = newItem.CALC_State;
oldItem.CNT = newItem.CNT;
oldItem.DO = newItem.DO;
oldItem.H = newItem.H;
oldItem.L = newItem.L;
oldItem.W = newItem.W;
oldItem.Material = newItem.Material;
oldItem.NAM = newItem.NAM;
oldItem.PDN = newItem.PDN;
}
}
catch
{ }
// aggiorno valore isNew a false
currData.IsNew = false;
// aggiungo le nuove part
foreach (var newPartId in bpi2add)
{
var newItem = newBtlParts.Where(x => x.PartId == newPartId).FirstOrDefault();
dbCtx.BTLPartList.Add(newItem);
}
// Commit changes
localDbCtx.SaveChanges();
// elimino dal DB i non + esistenti
foreach (var oldPartId in bpi2rem)
{
// elimino parts nei MachGroup
var oldIstPartList = dbCtx.PartList.Where(x => x.BTLPart.PartId == oldPartId).ToList();
dbCtx.PartList.RemoveRange(oldIstPartList);
// elimino BtlParts
var oldItem = oldBtlParts.Where(x => x.PartId == oldPartId).FirstOrDefault();
dbCtx.BTLPartList.Remove(oldItem);
}
}
catch
{ }
// aggiorno valore isNew a false
currData.IsNew = false;
// Commit changes
dbCtx.SaveChanges();
ResetController();
return currData;
}
@@ -615,57 +598,51 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public Core.ProjFileM UpdateInfo(int ProjId, string BTLFileName, string ListName, DateTime DtExported, BWType PType, string Machine)
{
// cerco specifico Proj
ProjModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
var currData = FindByProjId(ProjId);
// 2022.01.24: verifico UNIVOCITA' nel nome del file: SE fosse duplicato --> nuovo nome, nel formato nomeOriginale_idx, dove idx è il contatore libero successivo
var duplicateList = FindByBtlFileName(BTLFileName);
// devo verificare SOLO SE la lista non è vuota
if (duplicateList != null && duplicateList.Count > 0)
// 2022.01.24: verifico UNIVOCITA' nel nome del file: SE fosse duplicato --> nuovo nome, nel formato nomeOriginale_idx, dove idx è il contatore libero successivo
var duplicateList = FindByBtlFileName(BTLFileName);
// devo verificare SOLO SE la lista non è vuota
if (duplicateList != null && duplicateList.Count > 0)
{
// se ne ho esattamente 1 nel DB allora DEVE essere il record Parent
if (duplicateList.Count == 1)
{
// se ne ho esattamente 1 nel DB allora DEVE essere il record Parent
if (duplicateList.Count == 1)
// verifico se ProjId variato
if (!duplicateList[0].ProjId.Equals(currData.ProjId))
{
// verifico se ProjId variato
if (!duplicateList[0].ProjId.Equals(currData.ProjId))
{
// in questo caso ho il PRIMO duplicato
BTLFileName = $"{BTLFileName}_1";
}
}
// se ne ho + di 1 --> so che il maxId interno avrò il valore ULTIMO x prendere il successivo
else
{
var lastRec = duplicateList.OrderByDescending(x => x.ProjDbId).FirstOrDefault();
// cerco indice
string maybeNumber = lastRec.BTLFileName.Replace($"{BTLFileName}_", "");
int index = 0;
bool isNumber = int.TryParse(maybeNumber, out index);
// fasccio comunque verifica sia numerico
if (isNumber)
{
// in questo caso ho il l'ULTIMO duplicato e faccio +1
BTLFileName = $"{BTLFileName}_{index + 1}";
}
// in questo caso ho il PRIMO duplicato
BTLFileName = $"{BTLFileName}_1";
}
}
// se ne ho + di 1 --> so che il maxId interno avrò il valore ULTIMO x prendere il successivo
else
{
var lastRec = duplicateList.OrderByDescending(x => x.ProjDbId).FirstOrDefault();
// cerco indice
string maybeNumber = lastRec.BTLFileName.Replace($"{BTLFileName}_", "");
int index = 0;
bool isNumber = int.TryParse(maybeNumber, out index);
// fasccio comunque verifica sia numerico
if (isNumber)
{
// in questo caso ho il l'ULTIMO duplicato e faccio +1
BTLFileName = $"{BTLFileName}_{index + 1}";
}
}
// aggiorno valore BTL
currData.BTLFileName = BTLFileName;
currData.DtExported = DtExported;
currData.ListName = ListName;
currData.PType = PType;
currData.Machine = Machine;
// Commit changes
localDbCtx.SaveChanges();
}
// aggiorno valore BTL
currData.BTLFileName = BTLFileName;
currData.DtExported = DtExported;
currData.ListName = ListName;
currData.PType = PType;
currData.Machine = Machine;
// Commit changes
dbCtx.SaveChanges();
ResetController();
return coreConv(currData);
}
@@ -677,19 +654,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProjFileM UpdateListName(int ProjId, string ListName)
{
ProjModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// aggiorno valore BTL
currData.ListName = ListName;
var currData = FindByProjId(ProjId);
// aggiorno valore BTL
currData.ListName = ListName;
// Commit changes
dbCtx.SaveChanges();
ResetController();
// Commit changes
localDbCtx.SaveChanges();
}
return coreConv(currData);
}
@@ -701,19 +673,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public Core.ProjFileM UpdateMachine(int ProjId, String Machine)
{
ProjModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
// aggiorno valore BTL
currData.Machine = Machine;
var currData = FindByProjId(ProjId);
// aggiorno valore BTL
currData.Machine = Machine;
// Commit changes
dbCtx.SaveChanges();
ResetController();
// Commit changes
localDbCtx.SaveChanges();
}
return coreConv(currData);
}
@@ -9,6 +9,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
#region Private Fields
private DatabaseContext dbCtx;
#endregion Private Fields
@@ -25,6 +26,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public StatusMapController()
{
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endregion Public Constructors
@@ -42,40 +45,41 @@ namespace EgtBEAMWALL.DataLayer.Controllers
DateTime adesso = DateTime.Now;
List<StatusMapModel> SM2Del = new List<StatusMapModel>();
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
// svuoto la tab mappa precedente (da rivalutare in futuro)
if (string.IsNullOrEmpty(Session))
{
// svuoto la tab mappa precedente (da rivalutare in futuro)
if (string.IsNullOrEmpty(Session))
{
SM2Del = localDbCtx
.StatusMapList
.ToList();
}
else
{
SM2Del = localDbCtx
.StatusMapList
.Where(x => x.Session == Session)
.ToList();
}
try
{
// Remove to database
localDbCtx.StatusMapList.RemoveRange(SM2Del);
// Commit changes
localDbCtx.SaveChanges();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteSession: {exc}");
}
SM2Del = dbCtx
.StatusMapList
.ToList();
}
else
{
SM2Del = dbCtx
.StatusMapList
.Where(x => x.Session == Session)
.ToList();
}
try
{
// Remove to database
dbCtx.StatusMapList.RemoveRange(SM2Del);
// Commit changes
dbCtx.SaveChanges();
ResetController();
done = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on DeleteSession: {exc}");
}
return done;
}
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
@@ -83,51 +87,44 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// </summary>
/// <param name="Session"></param>
/// <returns></returns>
public List<StatusMapModel> GetBySession(string Session)
public List<StatusMapModel> GetBySession(string Session = "")
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
// retrieve
return dbCtx
.StatusMapList
.Where(x => x.Session == Session)
.OrderByDescending(x => x.Index)
.ToList();
}
}
/// <summary>
/// Get data for session where Index > minIndex ordered by index DESC
/// </summary>
/// <param name="Session"></param>
/// <param name="minIndex"></param>
/// <returns></returns>
public List<StatusMapModel> GetFrom(string Session, int minIndex = 0)
public List<StatusMapModel> GetFrom(int minIndex = 0)
{
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
return localDbCtx
ResetController();
// retrieve
return dbCtx
.StatusMapList
.Where(x => x.Session == Session && x.Index >= minIndex)
.Where(x => x.Index >= minIndex)
.OrderBy(x => x.Index)
.ToList();
}
}
/// <summary>
/// Get PROD (all)
/// Get PROD data for session
/// </summary>
/// <param name="Session"></param>
/// <returns></returns>
public List<StatusMapModel> GetProd()
{
List<StatusMapModel> answ = new List<StatusMapModel>();
// Initialize database context
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
using (DatabaseContext myDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
answ = localDbCtx
answ = myDbCtx
.StatusMapList
.Where(x => x.ItemType == Core.StatusMapItemType.Prod)
.OrderByDescending(x => x.Index)
@@ -137,24 +134,12 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
/// <summary>
/// Get PROD for session
/// Reinizializzaizone del controller
/// </summary>
/// <param name="Session"></param>
/// <returns></returns>
public List<StatusMapModel> GetProd(string Session)
public void ResetController()
{
List<StatusMapModel> answ = new List<StatusMapModel>();
// Initialize database context
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// retrieve
answ = localDbCtx
.StatusMapList
.Where(x => x.Session == Session && x.ItemType == Core.StatusMapItemType.Prod)
.OrderByDescending(x => x.Index)
.ToList();
}
return answ;
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
/// <summary>
@@ -178,25 +163,22 @@ namespace EgtBEAMWALL.DataLayer.Controllers
done = false;
// inserisco dato prod
StatusMapModel prodSMRecord = new StatusMapModel() { Session = SupervisorId, Index = 0, ItemId = ProdId, ItemType = Core.StatusMapItemType.Prod, Operation = Core.StatusMapOpType.Startup, DtEvent = adesso, Val = "" };
// Initialize database context
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
// aggiungo
localDbCtx.StatusMapList.Add(prodSMRecord);
// aggiungo
dbCtx.StatusMapList.Add(prodSMRecord);
// recupero MachGroup da PROD
var MGList = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId)
.ToList();
// recupero MachGroup da PROD
var MGList = dbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId)
.ToList();
var mgSMRecords = MGList.Select(x => new StatusMapModel() { Session = SupervisorId, Index = 0, ItemId = x.MachGroupId, ItemType = Core.StatusMapItemType.MachGroup, Operation = Core.StatusMapOpType.Startup, DtEvent = adesso, Val = "" }).ToList();
// aggiungo
localDbCtx.StatusMapList.AddRange(mgSMRecords);
var mgSMRecords = MGList.Select(x => new StatusMapModel() { Session = SupervisorId, Index = 0, ItemId = x.MachGroupId, ItemType = Core.StatusMapItemType.MachGroup, Operation = Core.StatusMapOpType.Startup, DtEvent = adesso, Val = "" }).ToList();
// aggiungo
dbCtx.StatusMapList.AddRange(mgSMRecords);
// salvo
localDbCtx.SaveChanges();
}
// salvo
dbCtx.SaveChanges();
ResetController();
done = true;
}
return done;
@@ -212,54 +194,51 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <param name="Operation"></param>
/// <param name="Value"></param>
/// <returns></returns>
public bool UpdateAction(string Session, int ProdId, int ItemId, Core.StatusMapItemType ItemType, Core.StatusMapOpType Operation, string Value)
public bool UpdateAction(String Session, int ProdId, int ItemId, Core.StatusMapItemType ItemType, Core.StatusMapOpType Operation, string Value)
{
bool fatto = false;
// Recupero il record PROD (che è ultimo indice)
StatusMapModel prodData = new StatusMapModel();
// Initialize database context
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
// se è un prod --> vado x ID
if (Session == "")
{
// se è un prod --> vado x ID
if (Session == "")
prodData = dbCtx
.StatusMapList
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.ItemId == ProdId)
.FirstOrDefault();
}
else
{
prodData = dbCtx
.StatusMapList
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.Session == Session)
.FirstOrDefault();
}
// se ho trovato
if (prodData != null)
{
try
{
prodData = localDbCtx
.StatusMapList
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.ItemId == ProdId)
.FirstOrDefault();
}
else
{
prodData = localDbCtx
.StatusMapList
.Where(x => x.ItemType == Core.StatusMapItemType.Prod && x.Session == Session)
.FirstOrDefault();
}
// se ho trovato
if (prodData != null)
{
try
// aggiorno indice PROD
prodData.Index++;
// se session è nulla ma ho un PROD --> calcolo da li la sessione
if (string.IsNullOrEmpty(Session))
{
// aggiorno indice PROD
prodData.Index++;
// se session è nulla ma ho un PROD --> calcolo da li la sessione
if (string.IsNullOrEmpty(Session))
{
Session = prodData.Session;
}
// creo un nuovo record
DateTime adesso = DateTime.Now;
var newRec = new StatusMapModel() { Session = Session, Index = prodData.Index, ItemId = ItemId, ItemType = ItemType, Operation = Operation, DtEvent = adesso, Val = Value };
localDbCtx.StatusMapList.Add(newRec);
Session = prodData.Session;
}
// creo un nuovo record
DateTime adesso = DateTime.Now;
var newRec = new StatusMapModel() { Session = Session, Index = prodData.Index, ItemId = ItemId, ItemType = ItemType, Operation = Operation, DtEvent = adesso, Val = Value };
dbCtx.StatusMapList.Add(newRec);
// Commit changes
localDbCtx.SaveChanges();
fatto = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateAction: {exc}");
}
// Commit changes
dbCtx.SaveChanges();
ResetController();
fatto = true;
}
catch (Exception exc)
{
Console.WriteLine($"EXCEPTION on UpdateAction: {exc}");
}
}
return fatto;
@@ -38,7 +38,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="EgtWPFLib5">
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
<HintPath>..\..\..\EgtProg\DllD32\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
@@ -46,11 +46,11 @@
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="MySql.Data">
<HintPath>..\ExtLibs\MySql.Data.dll</HintPath>
<Reference Include="MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.10.9\lib\net452\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySql.Data.Entity.EF6">
<HintPath>..\ExtLibs\MySql.Data.Entity.EF6.dll</HintPath>
<Reference Include="MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.Entity.6.10.9\lib\net452\MySql.Data.Entity.EF6.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+2
View File
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="MySql.Data" version="6.10.9" targetFramework="net452" />
<package id="MySql.Data.Entity" version="6.10.9" targetFramework="net452" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
</packages>
@@ -106,13 +106,13 @@
<Reference Include="Csv, Version=1.0.31.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Csv.1.0.31\lib\net40\Csv.dll</HintPath>
</Reference>
<Reference Include="EgtUILib, Version=2.4.3.1, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="EgtUILib, Version=2.3.2.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtUILib.dll</HintPath>
</Reference>
<Reference Include="EgtWPFLib5, Version=2.4.2.1, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="EgtWPFLib5, Version=2.3.1.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
@@ -124,18 +124,15 @@
<HintPath>..\packages\FluentFTP.19.2.2\lib\net45\FluentFTP.dll</HintPath>
</Reference>
<Reference Include="Interop.FXLog">
<HintPath>..\ExtLibs\Interop.FXLog.dll</HintPath>
<HintPath>..\..\..\EgtProg\EgtBEAMWALL\Interop.FXLog.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Interop.FXServer">
<HintPath>..\ExtLibs\Interop.FXServer.dll</HintPath>
<HintPath>..\..\..\EgtProg\EgtBEAMWALL\Interop.FXServer.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<HintPath>..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="ISOCNC.Remoting">
<HintPath>..\ExtLibs\ISOCNC.Remoting.dll</HintPath>
<HintPath>..\..\..\Albatros\Bin\ISOCNC.Remoting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.DotNet.PlatformAbstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
@@ -144,11 +141,11 @@
<Reference Include="Microsoft.Extensions.DependencyModel, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyModel.2.1.0\lib\net451\Microsoft.Extensions.DependencyModel.dll</HintPath>
</Reference>
<Reference Include="MySql.Data">
<HintPath>..\ExtLibs\MySql.Data.dll</HintPath>
<Reference Include="MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.10.9\lib\net452\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySql.Data.Entity.EF6">
<HintPath>..\ExtLibs\MySql.Data.Entity.EF6.dll</HintPath>
<Reference Include="MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.Entity.6.10.9\lib\net452\MySql.Data.Entity.EF6.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -559,18 +556,6 @@
<ItemGroup>
<Resource Include="Resources\ProjectManager\Save.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
+1 -1
View File
@@ -7,7 +7,7 @@
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
+2 -1
View File
@@ -3,10 +3,11 @@
<package id="Csv" version="1.0.31" targetFramework="net472" />
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="FluentFTP" version="19.2.2" targetFramework="net472" />
<package id="Ionic.Zip" version="1.9.1.8" targetFramework="net472" />
<package id="Lextm.SharpSnmpLib" version="10.0.9" targetFramework="net472" />
<package id="Microsoft.DotNet.PlatformAbstractions" version="2.1.0" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyModel" version="2.1.0" targetFramework="net472" />
<package id="MySql.Data" version="6.10.9" targetFramework="net452" />
<package id="MySql.Data.Entity" version="6.10.9" targetFramework="net452" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="Portable.BouncyCastle" version="1.8.2" targetFramework="net472" />
<package id="System.Collections.Specialized" version="4.3.0" targetFramework="net472" />
+11 -11
View File
@@ -1,31 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6"/>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
<connectionStrings>
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=EgtUser;password=viacremasca;Persist Security Info=True;database=EgtBwDb;SslMode=none" providerName="MySql.Data.MySqlClient" />
<add name="DefaultConnection" connectionString="server=localhost;port=3306;User Id=EgtUser;password=viacremasca;Persist Security Info=True;database=EgtBwDb;SslMode=none" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.10.9.0" newVersion="6.10.9.0" />
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.10.9.0" newVersion="6.10.9.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
<remove invariant="MySql.Data.MySqlClient"/>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1500,6 +1500,21 @@ Public Class BTLPartVM
EgtDeselectAll()
End If
Map.refLeftPanelVM.FeatureSelectionChanged()
ElseIf Map.refMainMenuVM.SelPage = Pages.LAYERSWALL Then
If Not IsNothing(m_SelBTLFeatureVM) Then
DirectCast(m_SelBTLFeatureVM, BTLFeatureVM).SelGeomFeature()
' imposto path disegno da mostrare in BottomPanel
Map.refLayersWallBottomPanelVM.SetCurrDraw(DirectCast(m_SelBTLFeatureVM, BTLFeatureVM).sDrawPath)
' seleziono pagina BottomPanel
Map.refLayersWallBottomPanelVM.SetSelPartFeatureTab(LayersWallBottomPanelVM.PartFeatureTab.FEATURE)
' deseleziono i parametri
If Not IsNothing(SelBTLFeatureVM.SelPBTLParam) Then SelBTLFeatureVM.SelPBTLParam = Nothing
' rinfresco bottoni freecontour
m_SelBTLFeatureVM.RefreshFCMBtnVisibility()
Else
EgtDeselectAll()
End If
Map.refLayersWallLeftPanelVM.FeatureSelectionChanged()
End If
EgtDraw()
NotifyPropertyChanged(NameOf(SelBTLFeatureVM))
@@ -1548,8 +1563,10 @@ Public Class BTLPartVM
CreateBTLFeatureVMList()
m_BTLFeatureVMList_ViewSource = New CollectionViewSource With {.Source = m_BTLFeatureVMList}
m_BTLFeatureVMList_View = m_BTLFeatureVMList_ViewSource.View
m_BTLFeatureVMList_View.CustomSort = New FeatureSorter
m_BTLFeatureVMList_View.Filter = AddressOf FeatureFilter
If Not IsNothing(m_BTLFeatureVMList_View) Then
m_BTLFeatureVMList_View.CustomSort = New FeatureSorter
m_BTLFeatureVMList_View.Filter = AddressOf FeatureFilter
End If
' Aggiorno check DOALL
NotifyPropertyChanged(NameOf(bDOALL))
' Aggiorno stato da stati feature
@@ -1576,7 +1593,7 @@ Public Class BTLPartVM
#Region "METHODS"
Private Sub CreateBTLFeatureVMList()
Protected Overridable Sub CreateBTLFeatureVMList()
Dim all As List(Of BTLFeatureVM) = (From BTLFeatureM In m_BTLPartM.GetBTLFeatures()
Select New BTLFeatureVM(BTLFeatureM, m_BTLPartM)).ToList()
@@ -2071,12 +2088,12 @@ Public Class BTLPartVM
#Region "EVENTS"
Private Sub OnBTLFeatureAdded(sender As Object, e As BTLFeatureAddedEventArgs)
Protected Sub OnBTLFeatureAdded(sender As Object, e As BTLFeatureAddedEventArgs)
Dim BTLFeatureVM As BTLFeatureVM = New BTLFeatureVM(e.NewBTLFeature, m_BTLPartM)
BTLFeatureVMList.Add(BTLFeatureVM)
End Sub
Private Sub OnBTLFeatureVMListChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
Protected Sub OnBTLFeatureVMListChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
If Not IsNothing(e.NewItems) AndAlso e.NewItems.Count > 0 Then
For Each BTLFeatureVM As BTLFeatureVM In e.NewItems
AddHandler BTLFeatureVM.PropertyChanged, AddressOf OnBTLFeatureVMPropertyChanged
@@ -20,6 +20,136 @@ Public Class BTLStructureVM
End Get
End Property
' pezzi da BTL
Private m_BTLElementVMList_View As CollectionView = Nothing
Private m_BTLElementVMList As ObservableCollection(Of BTLElementVM)
Public Property BTLElementVMList As ObservableCollection(Of BTLElementVM)
Get
Return m_BTLElementVMList
End Get
Set(value As ObservableCollection(Of BTLElementVM))
m_BTLElementVMList = value
End Set
End Property
' pezzi da BTL
Private m_BTLLayerVMList_View As CollectionView = Nothing
Private m_BTLLayerVMList As ObservableCollection(Of BTLLayerVM)
Public Property BTLLayerVMList As ObservableCollection(Of BTLLayerVM)
Get
Return m_BTLLayerVMList
End Get
Set(value As ObservableCollection(Of BTLLayerVM))
m_BTLLayerVMList = value
End Set
End Property
Private m_SelBTLLayer As BTLLayerVM = Nothing
Public Property SelBTLLayer As BTLLayerVM
Get
Return m_SelBTLLayer
End Get
Set(value As BTLLayerVM)
If Not IsNothing(m_SelBTLLayer) Then
' se necessario tolgo solido dal precedentemente selezionato
If Map.refShowBeamPanelVM.ShowSolid_IsChecked Then
Map.refShowBeamPanelVM.SetShowSolid(False)
End If
' disabilito eventuale feature selezionata
If Not IsNothing(m_SelBTLLayer.m_SelBTLFeatureVM) Then m_SelBTLLayer.SelBTLFeatureVM = Nothing
End If
m_SelBTLLayer = value
' se seleziono un layer
If Not IsNothing(m_SelBTLLayer) Then
If Map.refMainMenuVM.SelPage = Pages.VIEW Then
' se modalità building, la tolgo
If Map.refShowBeamPanelVM.ShowBuilding_IsChecked Then
ShowBuilding(False, False)
End If
' seleziono pezzo nella scena
SceneSelPartSelection()
' seleziono pezzo in Db geometrico
EgtBeamSetPart(m_SelBTLLayer.nPartId)
' seleziono pagina BottomPanel
Map.refBottomPanelVM.SetSelPartFeatureTab(BottomPanelVM.PartFeatureTab.PART)
' mostro barra di gestione pezzo
Map.refProjectVM.SetPartManager_Visibility(True)
Map.refProjectVM.NotifyPropertyChanged(NameOf(Map.refProjectVM.PartManager_Visibility))
' deseleziono le feature
If Not IsNothing(m_SelBTLLayer.SelBTLFeatureVM) Then SelBTLLayer.SelBTLFeatureVM = Nothing
' aggiorno stato selezionato tutto
Map.refShowBeamPanelVM.bShowAll = False
Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False)
EgtZoom(ZM.ALL)
ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then
' resetto gruppo di lavorazione corrente
EgtResetCurrMachGroup()
' trovo ed evidenzio MachGroup e Duplo di questo pezzo
If Not IsNothing(Map.refProjectVM.MachGroupPanelVM) Then
Dim MachGroupList As New List(Of MyMachGroupVM)
For Each Machgroup As MyMachGroupVM In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList
Dim bFound As Boolean = False
For Each Layer As PartVM In Machgroup.PartVMList
If EgtDuploGetOriginal(Layer.nPartId) = m_SelBTLLayer.nPartId Then
Layer.SetSearchFound()
bFound = True
Else
Layer.ResetSearchFound()
End If
Next
If bFound Then
Machgroup.SetSearchFound()
Else
Machgroup.ResetSearchFound()
End If
Next
End If
' seleziono pezzo nella scena
SceneSelPartSelection()
Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False)
EgtZoom(ZM.ALL)
ElseIf Map.refMainMenuVM.SelPage = Pages.LAYERSWALL Then
' se c'era un Part selezionato lo deseleziono
SelBTLLayer.SelBTLPart = Nothing
' se modalità building, la tolgo
If Map.refShowBeamPanelVM.ShowBuilding_IsChecked Then
ShowBuilding(False, False)
End If
' seleziono pezzo nella scena
SceneSelPartSelection()
' seleziono pezzo in Db geometrico
EgtBeamSetPart(m_SelBTLLayer.nPartId)
' mostro tutti i pezzi
Map.refShowBeamPanelVM.ShowAll(True)
' seleziono pagina LayersWallBottomPanel
Map.refLayersWallBottomPanelVM.SetSelPartFeatureTab(LayersWallBottomPanelVM.PartFeatureTab.LAYER)
' mostro barra di gestione pezzo
Map.refProjectVM.SetLayersWallLayerPartManager_Visibility(True)
' deseleziono le feature
If Not IsNothing(m_SelBTLLayer.SelBTLFeatureVM) Then SelBTLLayer.SelBTLFeatureVM = Nothing
If Not IsNothing(m_SelBTLLayer.SelBTLPart) AndAlso Not IsNothing(m_SelBTLLayer.SelBTLPart.SelBTLFeatureVM) Then SelBTLLayer.SelBTLPart.SelBTLFeatureVM = Nothing
' aggiorno FeatureList, FeatureManager e Parametri P e Q da far vedere
Map.refFeatureListVM.SetLayerFeatureList_Visibility(True)
Map.refFeatureListVM.SetPartFeatureList_Visibility(False)
Map.refFeatureManagerVM.SetLayerFeature_Visibility(True)
Map.refFeatureManagerVM.SetPartFeature_Visibility(False)
Map.refLayersWallBottomPanelVM.SetLayerFeature_Visibility(True)
Map.refLayersWallBottomPanelVM.SetPartFeature_Visibility(False)
' aggiorno stato selezionato tutto
Map.refShowBeamPanelVM.bShowAll = False
Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False)
EgtZoom(ZM.ALL)
End If
End If
NotifyPropertyChanged(NameOf(SelBTLLayer))
End Set
End Property
' funzione che imposta layer BTL selezionato senza aggiornare nulla
Friend Sub SetSelBTLLayer(BTLLayer As BTLLayerVM)
m_SelBTLLayer = BTLLayer
NotifyPropertyChanged(NameOf(SelBTLLayer))
End Sub
' pezzi da BTL
Private m_BTLPartVMList_View As CollectionView = Nothing
Private m_BTLPartVMList As ObservableCollection(Of BTLPartVM)
@@ -60,9 +190,9 @@ Public Class BTLStructureVM
EgtBeamSetPart(m_SelBTLPart.nPartId)
' seleziono pagina BottomPanel
Map.refBottomPanelVM.SetSelPartFeatureTab(BottomPanelVM.PartFeatureTab.PART)
' mostro barra di gestione pezzo
Map.refProjectVM.SetPartManager_Visibility(True)
Map.refProjectVM.NotifyPropertyChanged(NameOf(Map.refProjectVM.PartManager_Visibility))
'' mostro barra di gestione pezzo
'Map.refProjectVM.SetPartManager_Visibility(True)
'Map.refProjectVM.NotifyPropertyChanged(NameOf(Map.refProjectVM.PartManager_Visibility))
' deseleziono le feature
If Not IsNothing(m_SelBTLPart.SelBTLFeatureVM) Then SelBTLPart.SelBTLFeatureVM = Nothing
' aggiorno stato selezionato tutto
@@ -96,6 +226,26 @@ Public Class BTLStructureVM
SceneSelPartSelection()
Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False)
EgtZoom(ZM.ALL)
ElseIf Map.refMainMenuVM.SelPage = Pages.LAYERSWALL Then
' se modalità building, la tolgo
If Map.refShowBeamPanelVM.ShowBuilding_IsChecked Then
ShowBuilding(False, False)
End If
' seleziono pezzo nella scena
SceneSelPartSelection()
' seleziono pezzo in Db geometrico
EgtBeamSetPart(m_SelBTLPart.nPartId)
' seleziono pagina BottomPanel
Map.refBottomPanelVM.SetSelPartFeatureTab(BottomPanelVM.PartFeatureTab.PART)
' mostro barra di gestione pezzo
Map.refProjectVM.SetPartManager_Visibility(True)
Map.refProjectVM.NotifyPropertyChanged(NameOf(Map.refProjectVM.PartManager_Visibility))
' deseleziono le feature
If Not IsNothing(m_SelBTLPart.SelBTLFeatureVM) Then SelBTLPart.SelBTLFeatureVM = Nothing
' aggiorno stato selezionato tutto
Map.refShowBeamPanelVM.bShowAll = False
Core.ViewPanelVM.BWSetView(If(Core.ViewPanelVM.Type = BWType.BEAM, VT.ISO_SW, VT.TOP), False)
EgtZoom(ZM.ALL)
End If
End If
NotifyPropertyChanged(NameOf(SelBTLPart))
@@ -311,6 +461,8 @@ Public Class BTLStructureVM
Return Map.refProjManagerVM.nProjType
Case Pages.MACHINING
Return Map.refProdManagerVM.nProdType
Case Pages.LAYERSWALL
Return Map.refProjManagerVM.nProjType
Case Else
Return BWType.NULL
End Select
@@ -641,8 +793,24 @@ Public Class BTLStructureVM
Sub New(BTLStructureM As BTLStructureM)
m_BTLStructureM = BTLStructureM
AddHandler m_BTLStructureM.BTLPartAdded, AddressOf OnBTLPartAdded
CreateBTLElementVMList()
' creo lista di BTLLayerVM
CreateBTLLayerVMList()
If Not IsNothing(BTLElementVMList) Then
For Each BTLElementVMItem In BTLElementVMList
BTLElementVMItem.m_BTLLayerVMList = New ObservableCollection(Of BTLLayerVM)
For Each BTLLayerVMItem In BTLLayerVMList
If Not IsNothing(BTLElementVMItem.BTLElementM.sGROUP) AndAlso
Not IsNothing(BTLLayerVMItem.BTLLayerM.sGROUP) AndAlso
BTLElementVMItem.BTLElementM.sGROUP = BTLLayerVMItem.BTLLayerM.sGROUP Then
BTLElementVMItem.m_BTLLayerVMList.Add(BTLLayerVMItem)
End If
Next
Next
End If
' creo lista di BTLPartVM
CreateBTLPartVMList()
m_BTLPartVMList = Me.m_BTLPartVMList
m_BTLPartVMList_View = CollectionViewSource.GetDefaultView(m_BTLPartVMList)
m_GroupList_View = CollectionViewSource.GetDefaultView(m_GroupList)
m_SubGroupList_View = CollectionViewSource.GetDefaultView(m_SubGroupList)
@@ -664,6 +832,32 @@ Public Class BTLStructureVM
#Region "METHODS"
Private Sub CreateBTLElementVMList()
If IsNothing(m_BTLStructureM.GetBTLElements()) Then Return
Dim all As List(Of BTLElementVM) = (From BTLElementM In m_BTLStructureM.GetBTLElements()
Select New BTLElementVM(BTLElementM, m_BTLStructureM)).ToList()
'For Each BTLElementVM As BTLElementVM In all
' AddHandler BTLElementVM.PropertyChanged, AddressOf OnBTLElementVMPropertyChanged
'Next
m_BTLElementVMList = New ObservableCollection(Of BTLElementVM)(all)
'AddHandler m_BTLElementVMList.CollectionChanged, AddressOf OnBTLElementVMListChanged
End Sub
Private Sub CreateBTLLayerVMList()
If IsNothing(m_BTLStructureM.GetBTLLayers()) Then Return
Dim all As List(Of BTLLayerVM) = (From BTLLayerM In m_BTLStructureM.GetBTLLayers()
Select New BTLLayerVM(BTLLayerM, m_BTLStructureM)).ToList()
'For Each BTLLayerVM As BTLLayerVM In all
' AddHandler BTLLayerVM.PropertyChanged, AddressOf OnBTLLayerVMPropertyChanged
'Next
m_BTLLayerVMList = New ObservableCollection(Of BTLLayerVM)(all)
'AddHandler m_BTLLayerVMList.CollectionChanged, AddressOf OnBTLLayerVMListChanged
End Sub
Private Sub CreateBTLPartVMList()
Dim all As List(Of BTLPartVM) = (From BTLPartM In m_BTLStructureM.GetBTLParts()
Select New BTLPartVM(BTLPartM, m_BTLStructureM)).ToList()
@@ -703,14 +897,14 @@ Public Class BTLStructureVM
Next
End Sub
Private Sub SceneSelPartSelection()
Friend Sub SceneSelPartSelection()
' deseleziono tutto
EgtDeselectAll()
' disabilito impostazione modificato
Dim DisableMgr As New DisableModifiedMgr
' ciclo sui pezzi
For Each Part As BTLPartVM In m_BTLPartVMList
' se non è quello selezionato, lo nasondo
' se non è quello selezionato, lo nascondo
If Part IsNot m_SelBTLPart Then
EgtSetMode(Part.nPartId, GDB_MD.HIDDEN)
Else
@@ -721,6 +915,26 @@ Public Class BTLStructureVM
DisableMgr.ReEnable()
End Sub
Friend Sub SceneSelPartInLayerSelection()
' deseleziono tutto
EgtDeselectAll()
' disabilito impostazione modificato
Dim DisableMgr As New DisableModifiedMgr
' ciclo sui pezzi
If Not IsNothing(m_SelBTLLayer.SelBTLPart) Then
For Each Part As BTLPartVM In m_SelBTLLayer.BTLPartVMList
' se non è quello selezionato, lo nascondo
If Not Part.nPartId = m_SelBTLLayer.SelBTLPart.nPartId Then
EgtSetMode(Part.nPartId, GDB_MD.HIDDEN)
Else
EgtSetMode(Part.nPartId, GDB_MD.STD)
End If
Next
End If
' ripristino precedente impostazione modificato
DisableMgr.ReEnable()
End Sub
Friend Sub ShowAll(Optional bRedraw As Boolean = True)
' disabilito impostazione modificato
Dim DisableMgr As New DisableModifiedMgr
@@ -741,7 +955,7 @@ Public Class BTLStructureVM
BTLPartIdList.Sort()
Dim nGeomPartId As Integer = EgtGetFirstPart()
While nGeomPartId <> GDB_ID.NULL
Dim CurrPart As BTLPartVM = BTLPartVMList.FirstOrDefault(Function(x) x.nPartId = nGeomPartId)
Dim CurrPart As BTLPartVM = If(Not IsNothing(SelBTLLayer), SelBTLLayer.BTLPartVMList.FirstOrDefault(Function(x) x.nPartId = nGeomPartId), BTLPartVMList.FirstOrDefault(Function(x) x.nPartId = nGeomPartId))
If Not IsNothing(CurrPart) Then
Dim nMode As Integer
EgtGetMode(CurrPart.nPartId, nMode)
@@ -103,13 +103,11 @@
<ApplicationIcon>Resources\EgtBEAMWALL.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="EgtUILib, Version=2.4.3.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtLibs\EgtUILib.dll</HintPath>
<Reference Include="EgtUILib">
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtUILib.dll</HintPath>
</Reference>
<Reference Include="EgtWPFLib5, Version=2.4.2.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
<Reference Include="EgtWPFLib5">
<HintPath>..\..\..\..\..\..\EgtProg\Dll32\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
@@ -118,7 +116,8 @@
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<HintPath>..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\EgtProg\EgtBEAMWALL\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="MigraDoc.DocumentObjectModel-wpf, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>..\packages\PDFsharp-MigraDoc-wpf.1.50.5147\lib\net30\MigraDoc.DocumentObjectModel-wpf.dll</HintPath>
@@ -129,11 +128,11 @@
<Reference Include="MigraDoc.RtfRendering-wpf, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>..\packages\PDFsharp-MigraDoc-wpf.1.50.5147\lib\net30\MigraDoc.RtfRendering-wpf.dll</HintPath>
</Reference>
<Reference Include="MySql.Data">
<HintPath>..\ExtLibs\MySql.Data.dll</HintPath>
<Reference Include="MySql.Data, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.10.9\lib\net40\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySql.Data.Entity.EF6">
<HintPath>..\ExtLibs\MySql.Data.Entity.EF6.dll</HintPath>
<Reference Include="MySql.Data.Entity.EF6, Version=6.10.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.Entity.6.10.9\lib\net40\MySql.Data.Entity.EF6.dll</HintPath>
</Reference>
<Reference Include="PdfSharp-wpf, Version=1.50.5147.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
<HintPath>..\packages\PDFsharp-MigraDoc-wpf.1.50.5147\lib\net30\PdfSharp-wpf.dll</HintPath>
@@ -166,10 +165,28 @@
<Compile Include="AboutBoxWindow\AboutBoxV.xaml.vb">
<DependentUpon>AboutBoxV.xaml</DependentUpon>
</Compile>
<Compile Include="LayersWallBottomPanel\LayersWallBottomPanelV.xaml.vb">
<DependentUpon>LayersWallBottomPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="LayersWallBottomPanel\LayersWallBottomPanelVM.vb" />
<Compile Include="BTLViewModel\BTLLayerVM.vb" />
<Compile Include="BTLViewModel\BTLElementVM.vb" />
<Compile Include="ChangeMaterialWnd\ChangeMaterialWndV.xaml.vb">
<DependentUpon>ChangeMaterialWndV.xaml</DependentUpon>
</Compile>
<Compile Include="ChangeMaterialWnd\ChangeMaterialWndVM.vb" />
<Compile Include="ElementLayerTreeView\ElementLayerTreeView.vb" />
<Compile Include="ElementLayerTreeView\ElementLayerTreeViewV.xaml.vb">
<DependentUpon>ElementLayerTreeViewV.xaml</DependentUpon>
</Compile>
<Compile Include="ElementLayerTreeView\ElementLayerTreeViewVM.vb" />
<Compile Include="LayersWallFeatureList\LayersWallFeatureListV.xaml.vb">
<DependentUpon>LayersWallFeatureListV.xaml</DependentUpon>
</Compile>
<Compile Include="LayersWallLeftPanel\LayersWallLeftPanelV.xaml.vb">
<DependentUpon>LayersWallLeftPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="LayersWallLeftPanel\LayersWallLeftPanelVM.vb" />
<Compile Include="MovePartInRawPartWnd\MovePartInRawPartWndV.xaml.vb">
<DependentUpon>MovePartInRawPartWndV.xaml</DependentUpon>
</Compile>
@@ -234,11 +251,19 @@
<DependentUpon>NestingRunningWndV.xaml</DependentUpon>
</Compile>
<Compile Include="NestingRunningWnd\NestingRunningWndVM.vb" />
<Compile Include="LayersWallPartManager\LayersWallPartManagerV.xaml.vb">
<DependentUpon>LayersWallPartManagerV.xaml</DependentUpon>
</Compile>
<Compile Include="LayersWallPartManager\LayersWallPartManagerVM.vb" />
<Compile Include="ProjectTypeWnd\ProjectTypeWndV.xaml.vb">
<DependentUpon>ProjectTypeWndV.xaml</DependentUpon>
</Compile>
<Compile Include="ProjectTypeWnd\ProjectTypeWndVM.vb" />
<Compile Include="ProjectFileVM\ProdFileVM.vb" />
<Compile Include="LayersWallProjManager\LayersWallProjManagerV.xaml.vb">
<DependentUpon>LayersWallProjManagerV.xaml</DependentUpon>
</Compile>
<Compile Include="LayersWallProjManager\LayersWallProjManagerVM.vb" />
<Compile Include="SetUp\SetUpSupportClass.vb" />
<Compile Include="SetUp\SetUpV.xaml.vb">
<DependentUpon>SetUpV.xaml</DependentUpon>
@@ -369,10 +394,26 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="LayersWallBottomPanel\LayersWallBottomPanelV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ChangeMaterialWnd\ChangeMaterialWndV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ElementLayerTreeView\ElementLayerTreeViewV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="LayersWallFeatureList\LayersWallFeatureListV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="LayersWallLeftPanel\LayersWallLeftPanelV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MovePartInRawPartWnd\MovePartInRawPartWndV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -437,10 +478,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="LayersWallPartManager\LayersWallPartManagerV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ProjectTypeWnd\ProjectTypeWndV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="LayersWallProjManager\LayersWallProjManagerV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SetUp\SetUpV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -0,0 +1,123 @@
Imports EgtUILib
''' <summary>
''' Class that represent a Machining in the treeview.
''' It's an element in the treeview that represent the child of familymachiningtreeviewitem, but also the class that read and write in the machining's database
''' </summary>
Public Class ElementLayerTreeViewItem
Inherits ChildItem
#Region "Machining Property"
Private m_Type As MCH_MY
Public ReadOnly Property Type As Integer
Get
Return m_Type
End Get
End Property
''' <summary>
''' Property that determines if the Machining is selected or not
''' </summary>
Public Overrides Property IsSelected As Boolean
Get
Return m_isSelected
End Get
Set(value As Boolean)
If (value <> m_isSelected) Then
m_isSelected = value
' If Machining is selected, set it as current and notify all machining's property
' to refresh them values with those of the new selected machining
If value Then
EgtMdbSetCurrMachining(Me.Name)
Else
End If
End If
End Set
End Property
Private m_Tool As String
Public Property Tool As String
Get
Return m_Tool
End Get
Set(value As String)
m_Tool = value
End Set
End Property
#End Region ' Machining Property
#Region "Constructors"
Sub New(Name As String, Tool As String)
MyBase.New(Name)
Me.Tool = If(Not String.IsNullOrEmpty(Tool), "(" & Tool & ")", String.Empty)
End Sub
#End Region ' Constructors
End Class
''' <summary>
''' Class that represent a FamilyMachining in the treeview.
''' It's an element in the treeview that represent a folder, but also a machining family
''' </summary>
Public Class FamilyElementLayerTreeViewItem
Inherits ParentItem
Private m_MachiningType As MCH_MY
''' <summary>
''' Property that determines the machining type of the family
''' </summary>
Public Property MachiningType As MCH_MY
Get
Return m_MachiningType
End Get
Set(value As MCH_MY)
m_MachiningType = value
End Set
End Property
''' <summary>
''' Property that determines if the Machining is selected or not
''' </summary>
Public Overrides Property IsSelected As Boolean
Get
Return m_isSelected
End Get
Set(value As Boolean)
If (value <> m_isSelected) Then
m_isSelected = value
End If
End Set
End Property
Public ReadOnly Property sName As String
Get
Return "Prova"
End Get
End Property
''' <summary>
''' Constructor that receive the name of the FamilyMachiningTreeViewItem, the MachiningType, and set
''' the picture(Folder.png)
''' </summary>
Sub New(Name As String)
MyBase.New(Name)
Me.PictureString = "/Resources/TreeView/Folder.png"
End Sub
End Class
Public Class Element
End Class
Public Class Layer
End Class
@@ -0,0 +1,78 @@
<UserControl x:Class="ElementLayerTreeViewV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:local="clr-namespace:EgtBEAMWALL.ViewerOptimizer">
<UniformGrid MaxHeight="300">
<TreeView Name="ElementLayersTreeView" Grid.Row="1"
ItemsSource="{Binding Tag.BTLElementVMList,
RelativeSource={RelativeSource AncestorType={x:Type local:ElementLayerTreeViewV}}}">
<!--ItemsSource="{Binding Path=ElementLayersList}">-->
<!--<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="MouseDoubleClick">
<interactivity:InvokeCommandAction Command="{Binding TreeViewDoubleClickCommand}" CommandParameter="{Binding ElementName=MachiningsTreeView,Path=SelectedItem}"/>
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>-->
<!--<TreeView.InputBindings>
<KeyBinding Key="Escape" Command="{Binding CancelNewCommand}" CommandParameter="Escape"/>
</TreeView.InputBindings>-->
<TreeView.Resources>
<!--Modifico HierarchicalDataTemplate del CathegoryItem per poter inserire immagine e testo e per -->
<!--renderlo apribile con un solo click -->
<HierarchicalDataTemplate DataType="{x:Type local:BTLElementVM}" ItemsSource="{Binding BTLLayerVMList}">
<!--<HierarchicalDataTemplate DataType="{x:Type local:FamilyElementLayerTreeViewItem}" ItemsSource="{Binding Items}">-->
<!--<HierarchicalDataTemplate DataType="{x:Type local:FamilyElementLayerTreeViewItem}" ItemsSource="{Binding ElementLayersList}">-->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="{Binding PictureString}" Height="15" Margin="0,0,5,0"/>
<TextBlock Grid.Column="1" Text="{Binding sNAMplus}"/>
</Grid>
<!--Assegna ai nodi ToolItem lo Style normale dei TreeViewItem, eliminando l'ombra, data dal
multibinding quando sono attivi.-->
<HierarchicalDataTemplate.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}" >
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Style>
</HierarchicalDataTemplate.ItemContainerStyle>
</HierarchicalDataTemplate>
<!--Modifico DataTemplate del ToolItem per poter inserire immagine e testo-->
<DataTemplate DataType="{x:Type local:BTLLayerVM}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding sNAMplus}" Margin="0,0,5,0"/>
<!--<TextBlock Grid.Column="1" Text="{Binding Tool}"/>-->
</Grid>
</DataTemplate>
</TreeView.Resources>
<!--Style dei nodi CathegoryItem che li riquadra di azzurro quando clicckati ed elimina l'ombra grigia -->
<!--che si presenta quando la categoria rimane vuota (ombra causata dal multibinding). -->
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<EventSetter Event="PreviewMouseDown" Handler="ElementLayerTreeView_PreviewMouseDown"/>
<EventSetter Event="PreviewMouseUp" Handler="ElementLayerTreeView_PreviewMouseUp"/>
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
</UniformGrid>
</UserControl>
@@ -0,0 +1,28 @@
Public Class ElementLayerTreeViewV
Dim nPrevPartId As Integer = 0
Private Sub ElementLayerTreeView_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
' se ci troviamo nella pagina LayersWall e un Layer è già selezionato
If Map.refMainMenuVM.SelPage = EgtBEAMWALL.Core.ConstGen.Pages.LAYERSWALL AndAlso
Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLLayer) AndAlso
Map.refProjectVM.BTLStructureVM.SelBTLLayer.IsSelected Then
' salvo il PartId dell'elemento che era già selezionato
nPrevPartId = Map.refProjectVM.BTLStructureVM.SelBTLLayer.nPartId
End If
End Sub
Private Sub ElementLayerTreeView_PreviewMouseUp(sender As Object, e As MouseButtonEventArgs)
' se ci troviamo nella pagina LayersWall e un Layer è già selezionato
If Map.refMainMenuVM.SelPage = EgtBEAMWALL.Core.ConstGen.Pages.LAYERSWALL AndAlso
Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLLayer) AndAlso
Map.refProjectVM.BTLStructureVM.SelBTLLayer.IsSelected Then
' se l'elemento su cui ho clickato è lo stesso che era selezionato
If Map.refProjectVM.BTLStructureVM.SelBTLLayer.nPartId = nPrevPartId Then
' riassegno SelBTLLayer a se stesso per eseguire la riselezione di se stesso
Map.refProjectVM.BTLStructureVM.SelBTLLayer = Map.refProjectVM.BTLStructureVM.SelBTLLayer
End If
End If
End Sub
End Class
@@ -0,0 +1,156 @@
Imports System.Collections.ObjectModel
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class ElementLayerTreeViewVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Friend CodeCommand As Boolean = False
Private m_IsEnabled As Boolean
Public Property IsEnabled As Boolean
Get
Return m_IsEnabled
End Get
Set(value As Boolean)
If value <> m_IsEnabled Then
'Map.refMachiningOptionPanelVM.Set_IsExpanded(MachiningOptionPanelVM.MachiningOptionPanelExpander.NEWMACHININGS, value)
End If
End Set
End Property
' Lista delle lavorazioni
Private m_ElementLayersList As New ObservableCollection(Of FamilyElementLayerTreeViewItem)
Public Property ElementLayersList As ObservableCollection(Of FamilyElementLayerTreeViewItem)
Get
Return m_ElementLayersList
End Get
Set(value As ObservableCollection(Of FamilyElementLayerTreeViewItem))
m_ElementLayersList = value
End Set
End Property
Public ReadOnly Property LayersWallPage_Visibility As Visibility
Get
Return If(Map.refMainMenuVM.SelPage = Pages.LAYERSWALL, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
' Operazione correntemente selezionata, che permette di aggiungere al posto giusto quella nuova
Friend nSelectedOperationId As Integer = GDB_ID.NULL
'Public ReadOnly Property MachListHdr As String
' Get
' Return EgtMsg(MSG_OPERATION + 12) ' Nuove Lavorazioni
' End Get
'End Property
' Definizione comandi
Private m_cmdTreeViewDoubleClick As ICommand
Private m_cmdCancelNew As ICommand
#End Region
#Region "CONSTRUCTOR"
Sub New()
Map.SetRefElementLayerTreeViewVM(Me)
' Per caricare l'albero la prima volta che viene aperto
IsEnabled = False
'LoadSelectedMachineMachinings()
End Sub
#End Region
#Region "COMMANDS"
#End Region ' Commands
#Region "METHODS"
Friend Function InitMachiningTreeExpander() As Boolean
'm_IsEnabled = True
'Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = False
'Map.refSimulationExpanderVM.Simulation_IsEnabled = False
'Map.refEstimationsExpanderVM.Estimation_IsEnabled = False
'' Abilito la selezione delle geometrie di lavorazione
'Map.refProjectVM.SceneSelType = SceneSelTypeOpt.MACHINING
'' Abilito la selezione di curve e superfici del pezzo
'Map.refProjectVM.SceneSelMode = SceneSelModeOpt.ALL
'CodeCommand = False
'OnPropertyChanged("IsEnabled")
Return True
End Function
Friend Function ExitMachiningTreeExpander() As Boolean
'm_IsEnabled = False
'Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = True
'Map.refSimulationExpanderVM.Simulation_IsEnabled = True
'Map.refEstimationsExpanderVM.Estimation_IsEnabled = True
'If Not CodeCommand Then
' Map.refOperationsListExpanderVM.CancelOperationCmd()
' CodeCommand = False
' OnPropertyChanged("IsEnabled")
' Return False
'End If
'CodeCommand = False
'OnPropertyChanged("IsEnabled")
Return True
End Function
''' <summary>
''' Method that search the machines in the correct folder and add to the MachinesList those valid.
''' </summary>
Private Sub LoadSelectedMachineMachinings()
'Dim ActiveMachiningsTypes() As MachiningsType = MachineModel.ReadActiveMachiningsFamilies()
'For Each MachiningsType In ActiveMachiningsTypes
' Dim FamilyTreeView As New FamilyMachiningTreeViewExpanderItem(MachiningsType.TypeName, MachiningsType.TypeId)
' MachiningsList.Add(FamilyTreeView)
' Dim MachiningName As String = String.Empty
' Dim MachiningToolName As String = String.Empty
' EgtMdbGetFirstMachining(MachiningsType.TypeId, MachiningName)
' While Not String.IsNullOrEmpty(MachiningName)
' EgtMdbSetCurrMachining(MachiningName)
' EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, MachiningToolName)
' FamilyTreeView.Items.Add(New MachiningTreeViewExpanderItem(MachiningName, MachiningsType.TypeId, MachiningToolName))
' EgtMdbGetNextMachining(MachiningsType.TypeId, MachiningName)
' End While
'Next
'' Se esiste almeno una famiglia di lavorazioni, la seleziono
'If MachiningsList.Count > 0 Then
' MachiningsList(0).IsSelected = True
' MachiningsList(0).NotifyPropertyChanged("IsSelected")
'End If
Dim ActiveMachiningsTypes() As String = {"A", "B", "C"}
For Each MachiningsType In ActiveMachiningsTypes
Dim FamilyTreeView As New FamilyElementLayerTreeViewItem(MachiningsType)
ElementLayersList.Add(FamilyTreeView)
Dim MachiningName As String = "1"
FamilyTreeView.Items.Add(New ElementLayerTreeViewItem(MachiningName, MachiningsType))
Next
' Se esiste almeno una famiglia di lavorazioni, la seleziono
If ElementLayersList.Count > 0 Then
ElementLayersList(0).IsSelected = True
ElementLayersList(0).NotifyPropertyChanged("IsSelected")
End If
End Sub
Friend Sub UpdateOperationMachiningList()
m_ElementLayersList.Clear()
LoadSelectedMachineMachinings()
End Sub
#End Region
End Class
@@ -16,6 +16,34 @@ Public Class FeatureManagerVM
End Set
End Property
Private m_LayerFeature_Visibility As Boolean = False
Public Property LayerFeature_Visibility As Visibility
Get
Return If(m_LayerFeature_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_LayerFeature_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetLayerFeature_Visibility(IsVisible As Boolean)
m_LayerFeature_Visibility = IsVisible
NotifyPropertyChanged(NameOf(LayerFeature_Visibility))
End Sub
Private m_PartFeature_Visibility As Boolean = False
Public Property PartFeature_Visibility As Visibility
Get
Return If(m_PartFeature_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_PartFeature_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetPartFeature_Visibility(IsVisible As Boolean)
m_PartFeature_Visibility = IsVisible
NotifyPropertyChanged(NameOf(PartFeature_Visibility))
End Sub
#Region "Messages"
Public ReadOnly Property Face_Msg As String
@@ -4,7 +4,11 @@
If TypeOf sender Is DataGridRow Then
Dim Row As DataGridRow = DirectCast(sender, DataGridRow)
If Not IsNothing(Row) AndAlso Row.IsSelected Then
Map.refProjectVM.BTLStructureVM.SelBTLPart = Map.refProjectVM.BTLStructureVM.SelBTLPart
If Map.refMainMenuVM.SelPage = EgtBEAMWALL.Core.ConstGen.Pages.LAYERSWALL Then
Map.refProjectVM.BTLStructureVM.SelBTLLayer.SelBTLPart = Map.refProjectVM.BTLStructureVM.SelBTLLayer.SelBTLPart
Else
Map.refProjectVM.BTLStructureVM.SelBTLPart = Map.refProjectVM.BTLStructureVM.SelBTLPart
End If
End If
End If
End Sub
@@ -1,8 +1,10 @@
Imports System.Collections.ObjectModel
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class BTLPartListVM
Inherits VMBase
Private m_colPart_Do As EgtDataGridColumn
Public ReadOnly Property colPart_Do As EgtDataGridColumn
@@ -21,6 +23,18 @@ Public Class BTLPartListVM
End Set
End Property
Public ReadOnly Property ViewMachiningPage_Visibility As Visibility
Get
Return If(Map.refMainMenuVM.SelPage = Pages.VIEW Or Map.refMainMenuVM.SelPage = Pages.MACHINING, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Public ReadOnly Property LayersWallPage_Visibility As Visibility
Get
Return If(Map.refMainMenuVM.SelPage = Pages.LAYERSWALL, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
#Region "Messages"
Public ReadOnly Property PDN_Msg As String
@@ -4,6 +4,7 @@ Imports EgtUILib
Imports EgtWPFLib5
Public Class FeatureListVM
Inherits VMBase
Private m_colFeature_Do As EgtDataGridColumn
Public ReadOnly Property colFeature_Do As EgtDataGridColumn
@@ -22,6 +23,34 @@ Public Class FeatureListVM
End Set
End Property
Private m_LayerFeatureList_Visibility As Boolean = True
Public Property LayerFeatureList_Visibility As Visibility
Get
Return If(m_LayerFeatureList_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_LayerFeatureList_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetLayerFeatureList_Visibility(IsVisible As Boolean)
m_LayerFeatureList_Visibility = IsVisible
NotifyPropertyChanged(NameOf(LayerFeatureList_Visibility))
End Sub
Private m_PartFeatureList_Visibility As Boolean = True
Public Property PartFeatureList_Visibility As Visibility
Get
Return If(m_PartFeatureList_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_PartFeatureList_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetPartFeatureList_Visibility(IsVisible As Boolean)
m_PartFeatureList_Visibility = IsVisible
NotifyPropertyChanged(NameOf(PartFeatureList_Visibility))
End Sub
#Region "Messages"
Public ReadOnly Property Description_Msg As String
@@ -0,0 +1,170 @@
<Grid x:Class="LayersWallBottomPanelV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
Height="350"
Visibility="{Binding LayersWallBottomPanel_Visibility}">
<!--<EgtWPFLib5:EgtScrollViewer Focusable="False">-->
<TabControl SelectedIndex="{Binding SelPartFeatureTab}"
TabStripPlacement="Right"
Margin="5">
<TabControl.ItemContainerStyle>
<Style TargetType="{x:Type TabItem}">
<Setter Property="Visibility" Value="Collapsed"/>
</Style>
</TabControl.ItemContainerStyle>
<TabItem Header="STRUCTURE">
<TabItem.Content>
<EgtWPFLib5:EgtScrollViewer Focusable="False">
<EgtBEAMWALL:BTLDataV DataContext="{StaticResource BTLDataWndVM}"
Tag="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Margin="5"/>
</EgtWPFLib5:EgtScrollViewer>
</TabItem.Content>
</TabItem>
<TabItem Header="LAYER">
<TabItem.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<EgtWPFLib5:EgtScrollViewer Focusable="False">
<EgtBEAMWALL:PartParametersV DataContext="{StaticResource PartParametersVM}"
Tag="{Binding Tag.SelBTLLayer, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Margin="5"/>
</EgtWPFLib5:EgtScrollViewer>
<TextBlock Grid.Row="1"
Text="{Binding Tag.SelBTLLayer.sCALC_MSG, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Foreground="{Binding Tag.SelBTLLayer.CALC_ERR_Foreground, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Margin="5,0,5,0"
Visibility="{Binding Tag.SelBTLLayer.CALC_MSG_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"/>
</Grid>
</TabItem.Content>
</TabItem>
<TabItem Header="PART">
<TabItem.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<EgtWPFLib5:EgtScrollViewer Focusable="False">
<EgtBEAMWALL:PartParametersV DataContext="{StaticResource PartParametersVM}"
Tag="{Binding Tag.SelBTLLayer.SelBTLPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Margin="5"/>
</EgtWPFLib5:EgtScrollViewer>
<TextBlock Grid.Row="1"
Text="{Binding Tag.SelBTLLayer.SelBTLPart.sCALC_MSG, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Foreground="{Binding Tag.SelBTLLayer.SelBTLPart.CALC_ERR_Foreground, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Margin="5,0,5,0"
Visibility="{Binding Tag.SelBTLLayer.SelBTLPart.CALC_MSG_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"/>
</Grid>
</TabItem.Content>
</TabItem>
<TabItem Header="FEATURE">
<TabItem.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="300"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.Resources>
<Style TargetType="TextBlock">
<Style.Triggers>
<Trigger Property="Text" Value="">
<Setter Property="Visibility" Value="Collapsed"/>
</Trigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<!--Viste per Feature del Part del Layer-->
<EgtBEAMWALL:FeatureManagerV DataContext="{StaticResource FeatureManagerVM}"
Tag="{Binding Tag.SelBTLLayer.SelBTLPart.SelBTLFeatureVM, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Visibility="{Binding PartFeature_Visibility}"/>
<TabControl Grid.Row="1"
TabStripPlacement="Left"
Margin="5,5,2.5,5"
Visibility="{Binding PartFeature_Visibility}">
<TabItem Header="P">
<TabItem.Content>
<EgtBEAMWALL:PParameterListV DataContext="{StaticResource PParameterListVM}"
Tag="{Binding Tag.SelBTLLayer.SelBTLPart.SelBTLFeatureVM, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Margin="5"/>
</TabItem.Content>
</TabItem>
<TabItem Header="Q">
<TabItem.Content>
<EgtBEAMWALL:QParameterListV DataContext="{StaticResource QParameterListVM}"
Tag="{Binding Tag.SelBTLLayer.SelBTLPart.SelBTLFeatureVM, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Margin="5"/>
</TabItem.Content>
</TabItem>
</TabControl>
<!--Viste per Feature del Layer-->
<EgtBEAMWALL:FeatureManagerV DataContext="{StaticResource FeatureManagerVM}"
Tag="{Binding Tag.SelBTLLayer.SelBTLFeatureVM, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Visibility="{Binding LayerFeature_Visibility}"/>
<TabControl Grid.Row="1"
TabStripPlacement="Left"
Margin="5,5,2.5,5"
Visibility="{Binding LayerFeature_Visibility}">
<TabItem Header="P">
<TabItem.Content>
<EgtBEAMWALL:PParameterListV DataContext="{StaticResource PParameterListVM}"
Tag="{Binding Tag.SelBTLLayer.SelBTLFeatureVM, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Margin="5"/>
</TabItem.Content>
</TabItem>
<TabItem Header="Q">
<TabItem.Content>
<EgtBEAMWALL:QParameterListV DataContext="{StaticResource QParameterListVM}"
Tag="{Binding Tag.SelBTLLayer.SelBTLFeatureVM, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Margin="5"/>
</TabItem.Content>
</TabItem>
</TabControl>
<!--<TabControl Grid.Column="1"
Grid.Row="1"
TabStripPlacement="Bottom"
Margin="2.5,5,5,5">
<TabControl.ItemContainerStyle>
<Style TargetType="{x:Type TabItem}">
<Setter Property="Visibility" Value="Collapsed"/>
</Style>
</TabControl.ItemContainerStyle>
<TabItem Header="Parameter">
<TabItem.Content>-->
<Image Grid.Column="1"
Grid.Row="1"
Source="{Binding sCurrDraw}"
Margin="5"/>
<!--</TabItem.Content>
</TabItem>
</TabControl>-->
<TextBlock Grid.Row="2" Grid.ColumnSpan="2"
Text="{Binding Tag.SelBTLLayer.SelBTLPart.SelBTLFeatureVM.sCALC_MSG, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Foreground="{Binding Tag.SelBTLPart.SelBTLFeatureVM.Calc_Background, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Margin="5,0,5,0"/>
</Grid>
</TabItem.Content>
</TabItem>
<TabItem Header="STATISTICS">
<TabItem.Content>
<EgtBEAMWALL:StatisticsV DataContext="{StaticResource StatisticsVM}"
Tag="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallBottomPanelV}}}"
Margin="5"/>
</TabItem.Content>
</TabItem>
</TabControl>
<!--</EgtWPFLib5:EgtScrollViewer>-->
</Grid>
@@ -0,0 +1,3 @@
Public Class LayersWallBottomPanelV
End Class
@@ -0,0 +1,79 @@
Imports EgtWPFLib5
Public Class LayersWallBottomPanelVM
Inherits VMBase
Friend Enum PartFeatureTab As Integer
STRUCTURE_ = 0
LAYER = 1
PART = 2
FEATURE = 3
STATISTICS = 4
End Enum
Private m_SelPartFeatureTab As PartFeatureTab
Public Property SelPartFeatureTab As Integer
Get
Return m_SelPartFeatureTab
End Get
Set(value As Integer)
m_SelPartFeatureTab = value
End Set
End Property
Friend Sub SetSelPartFeatureTab(SelPartFeatureTab As PartFeatureTab)
If m_SelPartFeatureTab = PartFeatureTab.STATISTICS Then
Map.refInstrumentPanelVM.SetStatisticsIsChecked(False)
End If
m_SelPartFeatureTab = SelPartFeatureTab
NotifyPropertyChanged(NameOf(SelPartFeatureTab))
End Sub
Private m_sCurrDraw As String
Public ReadOnly Property sCurrDraw As String
Get
Return m_sCurrDraw
End Get
End Property
Friend Sub SetCurrDraw(sCurrDraw As String)
m_sCurrDraw = sCurrDraw
NotifyPropertyChanged(NameOf(sCurrDraw))
End Sub
Private m_LayerFeature_Visibility As Boolean = False
Public Property LayerFeature_Visibility As Visibility
Get
Return If(m_LayerFeature_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_LayerFeature_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetLayerFeature_Visibility(IsVisible As Boolean)
m_LayerFeature_Visibility = IsVisible
NotifyPropertyChanged(NameOf(LayerFeature_Visibility))
End Sub
Private m_PartFeature_Visibility As Boolean = False
Public Property PartFeature_Visibility As Visibility
Get
Return If(m_PartFeature_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_PartFeature_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetPartFeature_Visibility(IsVisible As Boolean)
m_PartFeature_Visibility = IsVisible
NotifyPropertyChanged(NameOf(PartFeature_Visibility))
End Sub
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefLayersWallBottomPanelVM(Me)
End Sub
#End Region ' CONSTRUCTOR
End Class
@@ -0,0 +1,103 @@
<UserControl x:Class="LayersWallFeatureListV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core">
<EgtBEAMWALLCORE:EgtDataGrid ItemsSource="{Binding Tag.BTLFeatureVMList,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallFeatureListV}}}"
SelectedItem="{Binding Tag.SelBTLFeatureVM,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallFeatureListV}}}"
CanUserAddRows="False"
AutoGenerateColumns="False"
CanUserResizeRows="False"
SelectionMode="Single"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Margin="0,0,0,5"
BindingColumns="{Binding FeatureColumns}"
Style="{StaticResource DataGrid_CustomHighLight}">
<DataGrid.Resources>
<!--DO - Abilitazione-->
<DataGridCheckBoxColumn x:Key="colDO" Binding="{Binding bDO, UpdateSourceTrigger=PropertyChanged}"
MinWidth="28">
<DataGridCheckBoxColumn.Header>
<CheckBox IsChecked="{Binding Path=Tag.bFeatureDOALL, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallFeatureListV}}}"/>
</DataGridCheckBoxColumn.Header>
</DataGridCheckBoxColumn>
<!--Validità feature-->
<DataGridTemplateColumn x:Key="colCALC">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<Border Width="{Binding ActualHeight, RelativeSource={RelativeSource self}}"
Background="{Binding Calc_Background}"/>
<!--Width="{Binding ActualHeigth, Source=Self}"/>-->
<Grid Grid.Column="1"
HorizontalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Ellipse Width="5"
Height="5"
Fill="Red"
Visibility="{Binding CALC_ROT_Visibility}"
HorizontalAlignment="Center"/>
<TextBlock Grid.Row="1"
Text="{Binding CALC_ERR_Letter}"
Foreground="{Binding CALC_ERR_Foreground}"
TextAlignment="Center"
FontWeight="Bold"
FontSize="12"
Margin="0,-6,0,-2"/>
<!--<Ellipse Width="5"
Height="5"
Fill="Red"
Visibility="{Binding CALC_ROT_Visibility}"/>
<TextBlock Text="{Binding CALC_ERR_Letter}"
Foreground="{Binding CALC_ERR_Foreground}"
FontWeight="Bold"
FontSize="10"/>-->
<!--<TextBlock Text="&#x2794;"
Visibility="{Binding CALC_FALL_Visibility}"/>-->
</Grid>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--Descrizione-->
<DataGridTextColumn x:Key="colDESC" Binding="{Binding sDesc}">
<DataGridTextColumn.Header>
<TextBlock Text="{Binding Path=DataContext.Description_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallFeatureListV}}}"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!-- Menu' tasto destro -->
<ContextMenu x:Key="RowMenu" ItemsSource="{Binding MenuList}" >
<ContextMenu.ItemContainerStyle>
<Style TargetType="MenuItem">
<Setter Property="Command" Value="{Binding MenuItem_Command}"/>
<Setter Property="Header" Value="{Binding sMsg}"/>
</Style>
</ContextMenu.ItemContainerStyle>
</ContextMenu>
</DataGrid.Resources>
<DataGrid.InputBindings>
<KeyBinding Key="Delete" Command="{Binding Tag.SelBTLFeatureVM.DeleteFeature_Command,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallFeatureListV}}}" />
</DataGrid.InputBindings>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource RowDataGrid_CustomHighLight}">
<Setter Property="ContextMenu" Value="{StaticResource RowMenu}" />
<EventSetter Event="PreviewMouseDown" Handler="LayersWallFeatureList_PreviewMouseDown"/>
</Style>
</DataGrid.RowStyle>
</EgtBEAMWALLCORE:EgtDataGrid>
</UserControl>
@@ -0,0 +1,12 @@
Public Class LayersWallFeatureListV
Private Sub LayersWallFeatureList_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
If TypeOf sender Is DataGridRow Then
Dim Row As DataGridRow = DirectCast(sender, DataGridRow)
If Not IsNothing(Row) AndAlso Row.IsSelected AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart) Then
Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM = Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM
End If
End If
End Sub
End Class
@@ -0,0 +1,186 @@
<Grid x:Class="LayersWallLeftPanelV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="{Binding GridDims[0].GridLen, Mode=TwoWay}"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="{Binding GridDims[1].GridLen, Mode=TwoWay}"/>
</Grid.RowDefinitions>
<!--<GroupBox Header="{Binding SearchFilter_Msg}"
Margin="3,1,3,3">
<Expander>
<Expander.Header>
<Grid HorizontalAlignment="{Binding HorizontalAlignment, RelativeSource={RelativeSource AncestorType=ContentPresenter}, Mode=OneWayToSource}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*" x:Name="ComboColumn"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Section_Msg}"
VerticalAlignment="Center"/>
<ComboBox ItemsSource="{Binding Tag.SectionList, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallLeftPanelV}}}"
SelectedItem="{Binding Tag.SelSection, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallLeftPanelV}}}"
DisplayMemberPath="sSectionXMaterial"
Grid.Column="1"/>
</Grid>
</Expander.Header>
<Grid Margin="1,0,1,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="24"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding Group_Msg}"
Grid.ColumnSpan="2"
VerticalAlignment="Center"/>
<ComboBox ItemsSource="{Binding Tag.GroupList, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallLeftPanelV}}}"
SelectedItem="{Binding Tag.SelGroup, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallLeftPanelV}}}"
Grid.Column="2"
Margin="0,2,0,2"/>
<TextBlock Text="{Binding SubGroup_Msg}"
Grid.Row="1"
Grid.ColumnSpan="2"
VerticalAlignment="Center"/>
<ComboBox ItemsSource="{Binding Tag.SubGroupList, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallLeftPanelV}}}"
SelectedItem="{Binding Tag.SelSubGroup, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallLeftPanelV}}}"
Grid.Column="2"
Grid.Row="1"
Margin="0,2,0,2"/>
<TextBlock Text="{Binding ParType_Msg}"
Grid.Row="2"
Grid.ColumnSpan="2"
VerticalAlignment="Center"/>
<ComboBox ItemsSource="{Binding Tag.SearchParamList, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallLeftPanelV}}}"
SelectedItem="{Binding Tag.SelSearchParam, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallLeftPanelV}}}"
Grid.Column="2"
Grid.Row="2"
Margin="0,2,0,2"/>
<TextBlock Text="{Binding ParValue_Msg}"
Grid.Row="3"
Grid.ColumnSpan="2"
VerticalAlignment="Center"/>
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.SearchText, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallLeftPanelV}}}"
Grid.Column="2"
Grid.Row="3"
Margin="0,2,0,0"/>
</Grid>
</Expander>
</GroupBox>-->
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<EgtBEAMWALL:ElementLayerTreeViewV DataContext="{StaticResource ElementLayerTreeViewVM}"
Tag="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallLeftPanelV}}}"
Grid.Row="0"
MaxHeight="100"/>
<StackPanel Orientation="Horizontal"
Grid.Row="1"
HorizontalAlignment="Right">
<Button Command="{Binding NewRawPart_Command}"
Visibility="{Binding MachiningPage_Visibility}"
ToolTip="{Binding NewRawPart_ToolTip}"
IsEnabled="{Binding LayersWallLeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/NewRawPart.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding AddToRawPart_Command}"
Visibility="{Binding MachiningPage_Visibility}"
ToolTip="{Binding AddToRawPart_ToolTip}"
IsEnabled="{Binding LayersWallLeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/AddToRawPart.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding CopyPart_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding CopyPart_ToolTip}"
IsEnabled="{Binding CopyPart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/CopyPart.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding AddPart_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding AddPart_ToolTip}"
IsEnabled="{Binding LayersWallLeftPanel_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/AddPart.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding RemovePart_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding RemovePart_ToolTip}"
IsEnabled="{Binding RemovePart_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/RemovePart.png" Stretch="Uniform"/>
</Button>
</StackPanel>
<EgtBEAMWALL:BTLPartListV DataContext="{StaticResource PartListVM}"
Tag="{Binding Tag.SelBTLLayer, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallLeftPanelV}}}"
Grid.Row="2"/>
</Grid>
<GridSplitter Height="3" HorizontalAlignment="Stretch" Grid.Row="2"/>
<Grid Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Right">
<Button Command="{Binding CopyFeature_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding CopyFeature_ToolTip}"
IsEnabled="{Binding CopyFeature_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/CopyFeature.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding MacroFeature_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding MacroFeature_ToolTip}"
IsEnabled="{Binding MacroFeature_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/MacroFeature.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding AddFeature_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding AddFeature_ToolTip}"
IsEnabled="{Binding AddFeature_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/AddFeature.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding RemoveFeature_Command}"
Visibility="{Binding ViewPage_Visibility}"
ToolTip="{Binding RemoveFeature_ToolTip}"
IsEnabled="{Binding RemoveFeature_IsEnabled}"
Style="{StaticResource LeftPanel_Button}">
<Image Source="/Resources/LeftPanel/RemoveFeature.png" Stretch="Uniform"/>
</Button>
</StackPanel>
<!--Lista feature per Layer-->
<EgtBEAMWALL:LayersWallFeatureListV DataContext="{ StaticResource FeatureListVM}"
Tag="{Binding Tag.SelBTLLayer, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallLeftPanelV}}}"
Visibility="{Binding LayerFeatureList_Visibility}"
Grid.Row="1"/>
<!--Lista feature per Part-->
<EgtBEAMWALL:FeatureListV DataContext="{ StaticResource FeatureListVM}"
Tag="{Binding Tag.SelBTLLayer.SelBTLPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallLeftPanelV}}}"
Visibility="{Binding PartFeatureList_Visibility}"
Grid.Row="1"/>
</Grid>
</Grid>
@@ -0,0 +1,3 @@
Public Class LayersWallLeftPanelV
End Class
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,104 @@
<StackPanel x:Class="LayersWallPartManagerV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer"
Orientation="Horizontal"
Height="28"
IsEnabled="{Binding LayersWallPartManager_IsEnabled}">
<TextBlock Text="BTL Qty"
Style="{StaticResource OptionTextBlock}"/>
<TextBlock Text="{Binding Tag.sCNT,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallPartManagerV}},
UpdateSourceTrigger=Explicit}"
Width="25"
Style="{StaticResource OptionTextBlock}"/>
<TextBlock Text="Added Qty"
Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sADDED,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallPartManagerV}},
UpdateSourceTrigger=Explicit}"
Width="25"/>
<TextBlock Text="W"
Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sW,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallPartManagerV}},
UpdateSourceTrigger=Explicit}" Width="45"/>
<TextBlock Text="H"
Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sH,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallPartManagerV}},
UpdateSourceTrigger=Explicit}" Width="45"/>
<TextBlock Text="L"
Style="{StaticResource OptionTextBlock}"/>
<EgtWPFLib5:EgtTextBox Text="{Binding Tag.sL,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallPartManagerV}},
UpdateSourceTrigger=Explicit}" Width="65"/>
<TextBlock Text="Inverti"
Style="{StaticResource OptionTextBlock}"
Margin="10,0,0,0"/>
<Image IsEnabled="{Binding Tag.bLockInversion,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallPartManagerV}}}"
Height="15"
Stretch="Uniform"
Visibility="{Binding Lock_Visibility}"
Style="{StaticResource LockImage}"/>
<Button Command="{Binding Tag.Invert_Command,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallPartManagerV}}}"
Style="{StaticResource ToolBar_SmallButton}"
Margin="5,0,0,0">
<Image Source="/Resources/PartManager/LeftInvert.png" Stretch="Uniform"/>
</Button>
<TextBlock Text="{Binding Tag.sINVERTED,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallPartManagerV}}}"
TextAlignment="Center"
Width="25"
Style="{StaticResource OptionTextBlock}"/>
<Button Command="{Binding Tag.Invert_Command,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallPartManagerV}}}"
Style="{StaticResource ToolBar_SmallButton}"
Margin="0,0,5,0">
<Image Source="/Resources/PartManager/RightInvert.png" Stretch="Uniform"/>
</Button>
<TextBlock Text="Ruota"
Style="{StaticResource OptionTextBlock}"
Margin="10,0,0,0"/>
<Image IsEnabled="{Binding Tag.bLockRotation,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallPartManagerV}}}"
Height="15"
Stretch="Uniform"
Visibility="{Binding Lock_Visibility}"
Style="{StaticResource LockImage}"/>
<Button Command="{Binding Tag.BackRotation_Command,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallPartManagerV}}}"
Style="{StaticResource ToolBar_SmallButton}"
Margin="5,0,0,0">
<Image Source="/Resources/PartManager/LeftRotate.png" Stretch="Uniform"/>
</Button>
<TextBlock Text="{Binding Tag.sROTATED,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallPartManagerV}}}"
TextAlignment="Center"
Width="25"
Style="{StaticResource OptionTextBlock}"/>
<Button Command="{Binding Tag.ForwardRotation_Command,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:LayersWallPartManagerV}}}"
Style="{StaticResource ToolBar_SmallButton}"
Margin="0,0,10,0">
<Image Source="/Resources/PartManager/RightRotate.png" Stretch="Uniform"/>
</Button>
<!--Comando inutilizzato ma conservato per eventuale rotazione a causa di importazione con rotazione sbagliata-->
<!--<Button Command="{Binding Tag.XRotation_Command,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}}}"
Style="{StaticResource ToolBar_SmallButton}"
Margin="0,0,10,0">
<Image Source="/Resources/PartManager/RightRotate.png" Stretch="Uniform"/>
</Button>-->
<TextBlock Text="{Binding Tag.sNAM,
RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:PartManagerV}}}"
Style="{StaticResource OptionTextBlock}"/>
</StackPanel>
@@ -0,0 +1,3 @@
Public Class LayersWallPartManagerV
End Class
@@ -0,0 +1,38 @@
Imports EgtBEAMWALL.Core.ConstGen
Imports EgtWPFLib5
Public Class LayersWallPartManagerVM
Inherits VMBase
Private m_LayersWallPartManager_IsEnabled As Boolean = True
Public ReadOnly Property LayersWallPartManager_IsEnabled As Boolean
Get
Return m_LayersWallPartManager_IsEnabled
End Get
End Property
Private m_Lock_Visibility As Visibility
Public ReadOnly Property Lock_Visibility As Visibility
Get
'Return Visibility.Collapsed
Return If(Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso
Map.refProjectVM.BTLStructureVM.nPROJTYPE = Core.ConstBeam.BWType.WALL AndAlso
Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NESTING_AUTO), Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Sub New()
' salvo riferimento in Map
Map.SetRefLayersWallPartManagerVM(Me)
End Sub
Friend Sub SetLayersWallPartManagerIsEnabled(bIsEnabled As Boolean)
m_LayersWallPartManager_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(LayersWallPartManager_IsEnabled))
End Sub
Friend Sub LockVisibilityUpdate()
NotifyPropertyChanged(NameOf(Lock_Visibility))
End Sub
End Class
@@ -0,0 +1,83 @@
<EgtFloating:EgtFloatingPanel x:Class="LayersWallProjManagerV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
IsTopDockable="True" IsBottomDockable="False" IsLeftDockable="False"
IsRightDockable="False"
IsEnabled="{Binding LayersWallProjManager_IsEnabled}"
Style="{StaticResource ToolBar_EgtFloatingPanel}">
<!--Barra superiore dei comandi-->
<Button Command="{Binding New_Command}"
ToolTip="{Binding NewToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/New.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding OpenCommand}"
ToolTip="{Binding OpenToolTip}"
ContextMenuService.Placement="Bottom"
Tag="{Binding}"
IsEnabled="False"
Style="{StaticResource ToolBar_Button}">
<Button.ContextMenu>
<ContextMenu ItemsSource="{Binding MruFileNames}">
<ContextMenu.Resources>
<Style TargetType="{x:Type MenuItem}">
<Setter Property="Command"
Value="{Binding PlacementTarget.Tag.OpenMruFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}" />
<Setter Property="CommandParameter" Value="{Binding}" />
</Style>
</ContextMenu.Resources>
</ContextMenu>
</Button.ContextMenu>
<Image Source="/Resources/ProjectManager/Open.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding SaveCommand}"
ToolTip="{Binding SaveToolTip}"
IsEnabled="False"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/Save.png" Stretch="Uniform"/>
</Button>
<!--<Button Command="{Binding SaveAsCommand}"
ToolTip="{Binding SaveAsToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/SaveAs.png" Stretch="Uniform"/>
</Button>-->
<Button Command="{Binding ImportBTL_Command}"
ToolTip="{Binding ImportBTL_ToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/ImportBTL.png" Stretch="Uniform"/>
</Button>
<!--<Button Command="{Binding OptionsCommand}"
ToolTip="{Binding OptionsToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/Options.png" Height="22"/>
</Button>-->
<!--<Button Command="{Binding SendFeedbackCommand}"
ToolTip="{Binding SendFeedbackToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/Send.png" Height="22" Margin="3,0,3,0" />
</Button>-->
<!--<Button Command="{Binding UpdateBTL_Command}"
ToolTip="{Binding UpdateBTL_ToolTip}"
Visibility="{Binding UpdateBTL_Visibility}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/UpdateBTL.png" Stretch="Uniform"/>
</Button>-->
<!--<Button Command="{Binding ExportProject_Command}"
ToolTip="{Binding ExportProject_ToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/ExportProject.png" Stretch="Uniform"/>
</Button>-->
<!--<Button Command="{Binding ImportProject_Command}"
ToolTip="{Binding ImportProject_ToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/ImportProject.png" Stretch="Uniform"/>
</Button>-->
<!--<Button Command="{Binding GoToProd_Command}"
ToolTip="{Binding GoToProd_ToolTip}"
Style="{StaticResource ToolBar_Button}">
<Image Source="/Resources/ProjectManager/GoToprod.png" Stretch="Uniform"/>
</Button>-->
</EgtFloating:EgtFloatingPanel>
@@ -0,0 +1,3 @@
Public Class LayersWallProjManagerV
End Class
File diff suppressed because it is too large Load Diff
@@ -12,6 +12,10 @@
<RadioButton Content="{Binding Optimizer_Msg}"
IsChecked="{Binding Machining_IsChecked}"
Style="{StaticResource MainMenu_ToggleButton}"/>
<RadioButton Content="{Binding LayersWall_Msg}"
IsChecked="{Binding LayersWall_IsChecked}"
Style="{StaticResource MainMenu_ToggleButton}"
Visibility="{Binding LayersWall_Visibility}"/>
<Button Content="{Binding Supervisor_Msg}"
Command="{Binding Supervisor_Command}"
Visibility="{Binding Supervisor_Visibility}"
@@ -61,6 +61,21 @@ Public Class MainMenuVM
End Set
End Property
Public Property LayersWall_IsChecked As Boolean
Get
Return m_SelPage = Pages.LAYERSWALL
End Get
Set(value As Boolean)
If value Then
'If Not IsNothing(Map.refProjManagerVM.CurrProj) AndAlso Not IsNothing(Map.refProdManagerVM.CurrProd) AndAlso
' Map.refProjManagerVM.CurrProj.nProdId = Map.refProdManagerVM.CurrProd.nProdId Then
' Map.refProdManagerVM.CurrProd.SetReloadProject(False)
'End If
SelPage = Pages.LAYERSWALL
End If
End Set
End Property
Public Property Supervisor_IsChecked As Boolean
Get
Return m_SelPage = Pages.SUPERVISOR
@@ -79,6 +94,13 @@ Public Class MainMenuVM
End Set
End Property
'Private m_LayersWall_Visibility As Visibility
Public ReadOnly Property LayersWall_Visibility As Visibility
Get
Return Map.refMainWindowVM.MainWindowM.nUserLevel > 5 ' m_LayersWall_Visibility
End Get
End Property
Private m_Supervisor_Visibility As Visibility
Public ReadOnly Property Supervisor_Visibility As Visibility
Get
@@ -106,6 +128,8 @@ Public Class MainMenuVM
bOk = ExitVIEW(bVerifyModification)
Case Pages.MACHINING
bOk = ExitMACHINING(bVerifyModification)
Case Pages.LAYERSWALL
bOk = ExitLAYERSWALL(bVerifyModification)
Case Pages.CONFIG
bOk = ExitCONFIG()
End Select
@@ -121,6 +145,10 @@ Public Class MainMenuVM
' Map.refMachGroupPanelVM.SetMachGroupState(True)
InitMACHINING()
'Map.refTopCommandBarVM.IsEnabled = True
Case Pages.LAYERSWALL
' Map.refMachGroupPanelVM.SetMachGroupState(True)
InitLAYERSWALL()
'Map.refTopCommandBarVM.IsEnabled = True
Case Pages.CONFIG
InitCONFIG()
'Map.refMachGroupPanelVM.SetMachGroupState(False)
@@ -131,6 +159,7 @@ Public Class MainMenuVM
' aggiorno visualizzazione RadioButton
NotifyPropertyChanged("View_IsChecked")
NotifyPropertyChanged("Machining_IsChecked")
NotifyPropertyChanged("LayersWall_IsChecked")
NotifyPropertyChanged("Supervisor_IsChecked")
NotifyPropertyChanged("Config_IsChecked")
Map.refProjectVM.NotifyPropertyChanged("SelItem")
@@ -150,6 +179,12 @@ Public Class MainMenuVM
End Get
End Property
Public ReadOnly Property LayersWall_Msg As String
Get
Return "LayersWall" 'EgtMsg(61831)
End Get
End Property
Public ReadOnly Property Configuration_Msg As String
Get
Return EgtMsg(61832)
@@ -210,14 +245,19 @@ Public Class MainMenuVM
Private Function InitVIEW() As Boolean
Map.refProjectVM.SetBottomPanel_Visibility(True)
Map.refProjectVM.SetLeftPanel_Visibility(True)
Map.refProjectVM.SetLayersWallLeftPanel_Visibility(False)
Map.refProjectVM.SetLayersWallBottomPanel_Visibility(False)
Map.refLeftPanelVM.UpdateView()
Map.refProjectVM.SetPartManager_Visibility(False)
Map.refProjectVM.SetLayersWallLayerPartManager_Visibility(False)
Map.refProjectVM.SetLayersWallPartPartManager_Visibility(False)
Map.refProjectVM.SetFeatureManager_Visibility(True)
Map.refProjectVM.SetTopPanel_Visibility(False)
Map.refProjectVM.SetShowBeamPanel_Visibility(True)
Map.refProjectVM.SetProjManager_Visibility(True)
Map.refProjectVM.SetProdManager_Visibility(False)
Map.refProjectVM.SetOptimizePanel_Visibility(Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NESTING_AUTO))
Map.refProjectVM.SetLayersWallProjManager_Visibility(False)
Map.refProjectVM.NotifyAllPanelVisibility()
Map.refCALCPanelVM.SetChooseMachineBtn_Visibility(True)
If Not IsNothing(Map.refFeatureListVM.colFeature_Do) Then
@@ -298,13 +338,18 @@ Public Class MainMenuVM
Map.refInstrumentPanelVM.ResetStatisticsIsChecked()
Map.refProjectVM.SetBottomPanel_Visibility(False)
Map.refProjectVM.SetLeftPanel_Visibility(True)
Map.refProjectVM.SetLayersWallLeftPanel_Visibility(False)
Map.refProjectVM.SetLayersWallBottomPanel_Visibility(False)
Map.refProjectVM.SetPartManager_Visibility(False)
Map.refProjectVM.SetLayersWallLayerPartManager_Visibility(False)
Map.refProjectVM.SetLayersWallPartPartManager_Visibility(False)
Map.refProjectVM.SetFeatureManager_Visibility(False)
Map.refProjectVM.SetTopPanel_Visibility(True)
Map.refProjectVM.SetShowBeamPanel_Visibility(False)
Map.refProjectVM.SetProjManager_Visibility(False)
Map.refProjectVM.SetProdManager_Visibility(True)
Map.refProjectVM.SetOptimizePanel_Visibility(True)
Map.refProjectVM.SetLayersWallProjManager_Visibility(False)
Map.refCALCPanelVM.SetChooseMachine_Visibility(False)
Return True
End Function
@@ -380,13 +425,18 @@ Public Class MainMenuVM
Map.refTopPanelVM.NotifyPropertyChanged(NameOf(Map.refTopPanelVM.MovePart_Visibility))
Map.refProjectVM.SetBottomPanel_Visibility(False)
Map.refProjectVM.SetLeftPanel_Visibility(True)
Map.refProjectVM.SetLayersWallLeftPanel_Visibility(False)
Map.refProjectVM.SetLayersWallBottomPanel_Visibility(False)
Map.refLeftPanelVM.UpdateView()
Map.refProjectVM.SetPartManager_Visibility(False)
Map.refProjectVM.SetLayersWallLayerPartManager_Visibility(False)
Map.refProjectVM.SetLayersWallPartPartManager_Visibility(False)
Map.refProjectVM.SetFeatureManager_Visibility(False)
Map.refProjectVM.SetTopPanel_Visibility(True)
Map.refProjectVM.SetShowBeamPanel_Visibility(False)
Map.refProjectVM.SetProjManager_Visibility(False)
Map.refProjectVM.SetProdManager_Visibility(True)
Map.refProjectVM.SetLayersWallProjManager_Visibility(False)
Map.refProjectVM.NotifyAllPanelVisibility()
Map.refCALCPanelVM.SetChooseMachineBtn_Visibility(False)
Map.refTopPanelVM.UpdateQParameterVisibility()
@@ -425,18 +475,135 @@ Public Class MainMenuVM
Map.refInstrumentPanelVM.ResetStatisticsIsChecked()
Map.refProjectVM.SetBottomPanel_Visibility(True)
Map.refProjectVM.SetLeftPanel_Visibility(False)
Map.refProjectVM.SetLayersWallLeftPanel_Visibility(False)
Map.refProjectVM.SetLayersWallBottomPanel_Visibility(False)
Map.refProjectVM.SetPartManager_Visibility(False)
Map.refProjectVM.SetLayersWallLayerPartManager_Visibility(False)
Map.refProjectVM.SetLayersWallPartPartManager_Visibility(False)
Map.refProjectVM.SetFeatureManager_Visibility(True)
Map.refProjectVM.SetTopPanel_Visibility(False)
Map.refProjectVM.SetShowBeamPanel_Visibility(True)
Map.refProjectVM.SetProjManager_Visibility(True)
Map.refProjectVM.SetProdManager_Visibility(False)
Map.refProjectVM.SetLayersWallProjManager_Visibility(False)
Map.refProjectVM.SetOptimizePanel_Visibility(Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NESTING_AUTO))
Map.refCALCPanelVM.SetChooseMachine_Visibility(False)
EgtResetCurrMachGroup()
Return True
End Function
Private Function InitLAYERSWALL() As Boolean
Map.refProjectVM.SetBottomPanel_Visibility(False)
Map.refProjectVM.SetLeftPanel_Visibility(False)
Map.refProjectVM.SetLayersWallLeftPanel_Visibility(True)
Map.refProjectVM.SetLayersWallBottomPanel_Visibility(True)
Map.refLeftPanelVM.UpdateView()
Map.refProjectVM.SetPartManager_Visibility(False)
Map.refProjectVM.SetLayersWallLayerPartManager_Visibility(False)
Map.refProjectVM.SetLayersWallPartPartManager_Visibility(False)
Map.refProjectVM.SetFeatureManager_Visibility(True)
Map.refProjectVM.SetTopPanel_Visibility(False)
Map.refProjectVM.SetShowBeamPanel_Visibility(True)
Map.refProjectVM.SetProjManager_Visibility(False)
Map.refProjectVM.SetProdManager_Visibility(False)
Map.refProjectVM.SetOptimizePanel_Visibility(Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refProjectVM.BTLStructureVM.nPROJTYPE = BWType.WALL AndAlso Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.NESTING_AUTO))
Map.refProjectVM.SetLayersWallProjManager_Visibility(True)
Map.refProjectVM.NotifyAllPanelVisibility()
Map.refCALCPanelVM.SetChooseMachineBtn_Visibility(True)
If Not IsNothing(Map.refFeatureListVM.colFeature_Do) Then
Map.refFeatureListVM.colFeature_Do.ColumnVisibility = Visibility.Visible
End If
' aggiorno la visibilità delle colonne
For Each col In Map.refFeatureListVM.FeatureColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
For Each col In Map.refPartListVM.PartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
For Each col In Map.refStatisticsVM.StatisticsColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
For Each col In Map.refPParameterListVM.PParameterListColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
For Each col In Map.refQParameterListVM.QParameterListColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
' imposto dimensioni colonne/righe della Grid
DimensionsIniFile.ReadGridDimensions(ConstDims.PROJECT_VIEW, Map.refProjectVM.GridDims)
DimensionsIniFile.ReadGridDimensions(ConstDims.LEFTPANEL_VIEW, Map.refLeftPanelVM.GridDims)
'' apro progetto proj
'If Not IsNothing(Map.refProjManagerVM.CurrProj) Then
' If Map.refProjManagerVM.CurrProj.bReloadProject Then
' LoadingWndHelper.UpdateLoadingWnd(ActiveIds.GOTOPROJ, 2, EgtMsg(63005), 10, 100) ' Loading parts
' Map.refProjManagerVM.OpenProject(Map.refProjManagerVM.CurrProj)
' ' aggiorno le colonne in base al tipo progetto
' If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then
' Map.refRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
' Map.refTopPanelVM.ManageQParamsRowVisibility(Map.refProjectVM.BTLStructureVM.nPROJTYPE <> BWType.BEAM)
' Map.refPartInRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
' Else
' Map.refRawPartListVM.UpdateColumns(BWType.BEAM)
' Map.refTopPanelVM.ManageQParamsRowVisibility(BWType.BEAM)
' Map.refPartInRawPartListVM.UpdateColumns(BWType.BEAM)
' End If
' DbControllers.m_ProjController.LockByProjId(Map.refProjManagerVM.CurrProj.nProjId, True)
' Map.refProjManagerVM.NotifyPropertyChanged(NameOf(Map.refProjManagerVM.MruFileNames))
' Else
' LoadingWndHelper.UpdateLoadingWnd(ActiveIds.GOTOPROJ, 2, EgtMsg(63005), 10, 100) ' Loading parts
' ' verifico se il prod di provenienza ha piu' proj
' If Not IsNothing(Map.refProdManagerVM.CurrProd) AndAlso Map.refProdManagerVM.CurrProd.nProjIdList.Count > 1 Then
' ' se si rigenero BTLStructure
' Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(Map.refProjManagerVM.CurrProj.nProjId))
' ' carico filtri di ricerca
' Map.refProjectVM.BTLStructureVM.LoadFilters()
' End If
' ' mostro tutti i pezzi
' Map.refShowBeamPanelVM.ShowAll(True)
' Map.refProjManagerVM.CurrProj.SetReloadProject(True)
' End If
' ' aggiorno titolo
' Map.refMainWindowVM.UpdateTitle()
' DbControllers.m_ProjController.LockByProjId(Map.refProjManagerVM.CurrProj.nProjId, True)
'Else
Map.refSceneHostVM.MainController.NewProject()
Map.refProjectVM.BTLStructureVM = Nothing
Map.refProjectVM.MachGroupPanelVM = Nothing
'End If
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
Map.refMainMenuVM.NotifyPropertyChanged(NameOf(Map.refMainMenuVM.SendFeedbackIsEnabled))
Map.refInstrumentPanelVM.NotifyPropertyChanged(NameOf(Map.refInstrumentPanelVM.ChangeParam_Visibility))
Map.refInstrumentPanelVM.NotifyPropertyChanged(NameOf(Map.refInstrumentPanelVM.ChangeMaterial_Visibility))
Return True
End Function
Private Function ExitLAYERSWALL(bVerifyModification As Boolean) As Boolean
' verifico se progetto modificato, e chiedo se salvare
If bVerifyModification Then
If Not ProjFileVM.VerifyProjectModification(Map.refProjManagerVM.CurrProj, ProjectType.PROJ) Then
Return False
End If
End If
' resetto eventuale visualizzazione statistiche
Map.refInstrumentPanelVM.ResetStatisticsIsChecked()
Map.refProjectVM.SetBottomPanel_Visibility(True)
Map.refProjectVM.SetLeftPanel_Visibility(True)
Map.refProjectVM.SetLayersWallLeftPanel_Visibility(True)
Map.refProjectVM.SetLayersWallBottomPanel_Visibility(True)
Map.refProjectVM.SetPartManager_Visibility(False)
Map.refProjectVM.SetLayersWallLayerPartManager_Visibility(False)
Map.refProjectVM.SetLayersWallPartPartManager_Visibility(False)
Map.refProjectVM.SetFeatureManager_Visibility(False)
Map.refProjectVM.SetTopPanel_Visibility(True)
Map.refProjectVM.SetShowBeamPanel_Visibility(False)
Map.refProjectVM.SetProjManager_Visibility(False)
Map.refProjectVM.SetProdManager_Visibility(True)
Map.refProjectVM.SetOptimizePanel_Visibility(True)
Map.refProjectVM.SetLayersWallProjManager_Visibility(False)
Map.refCALCPanelVM.SetChooseMachine_Visibility(False)
Return True
End Function
Private Function InitCONFIG() As Boolean
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
Map.refMainMenuVM.NotifyPropertyChanged(NameOf(Map.refMainMenuVM.SendFeedbackIsEnabled))
@@ -41,7 +41,7 @@ Public Class MainWindowVM
' proprietà che seleziona la giusta pagina del TabControl
Public Property nSelTabPage As Integer
Get
Return If(IsNothing(Map.refMainMenuVM.SelPage) OrElse Map.refMainMenuVM.SelPage = -1 OrElse Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.MACHINING, 0, 1)
Return If(IsNothing(Map.refMainMenuVM.SelPage) OrElse Map.refMainMenuVM.SelPage = -1 OrElse Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.MACHINING OrElse Map.refMainMenuVM.SelPage = Pages.LAYERSWALL, 0, 1)
End Get
Set(value As Integer)
End Set
@@ -11,6 +11,8 @@
Visibility="{Binding DataContext.ProdManager_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"/>
<EgtBEAMWALL:OptimizePanelV DataContext="{StaticResource OptimizePanelVM}"
Visibility="{Binding DataContext.OptimizePanel_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"/>
<EgtBEAMWALL:LayersWallProjManagerV DataContext="{StaticResource LayersWallProjManagerVM}"
Visibility="{Binding DataContext.LayersWallProjManager_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"/>
</EgtFloating:EgtFloatingTray>
<EgtBEAMWALL:FreeContourInputV DockPanel.Dock="Right"
@@ -34,6 +36,11 @@
DataContext="{StaticResource LeftPanelVM}"
Tag="{Binding DataContext.BTLStructureVM, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"
Visibility="{Binding DataContext.LeftPanel_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"/>
<EgtBEAMWALL:LayersWallLeftPanelV Grid.Column="0"
Grid.RowSpan="4"
DataContext="{StaticResource LayersWallLeftPanelVM}"
Tag="{Binding DataContext.BTLStructureVM, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"
Visibility="{Binding DataContext.LayersWallLeftPanel_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"/>
<GridSplitter Grid.Column="1"
Grid.RowSpan="4"
Width="3"
@@ -79,6 +86,18 @@
DataContext="{StaticResource PartManagerVM}"
Tag="{Binding DataContext.BTLStructureVM.SelBTLPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"
Visibility="{Binding DataContext.PartManager_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"/>
<!--PartManager per Layer nella pagina LayersWall-->
<EgtBEAMWALL:LayersWallPartManagerV Grid.Row="0"
DataContext="{StaticResource PartManagerVM}"
Tag="{Binding DataContext.BTLStructureVM.SelBTLLayer, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"
Visibility="{Binding DataContext.LayersWallLayerPartManager_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"/>
<!--PartManager per Part nel Layer nella pagina LayersWall-->
<EgtBEAMWALL:LayersWallPartManagerV Grid.Row="0"
DataContext="{StaticResource PartManagerVM}"
Tag="{Binding DataContext.BTLStructureVM.SelBTLLayer.SelBTLPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"
Visibility="{Binding DataContext.LayersWallPartPartManager_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"/>
<Grid Grid.Column="2" Grid.Row="1">
<EgtBEAMWALL:TopPanelV
DataContext="{StaticResource TopPanelVM}"
@@ -90,6 +109,11 @@
Tag="{Binding DataContext.BTLStructureVM, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"
Visibility="{Binding DataContext.BottomPanel_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"
Height="Auto"/>
<EgtBEAMWALL:LayersWallBottomPanelV
DataContext="{StaticResource LayersWallBottomPanelVM}"
Tag="{Binding DataContext.BTLStructureVM, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"
Visibility="{Binding DataContext.LayersWallBottomPanel_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"
Height="Auto"/>
</Grid>
</Grid>
@@ -65,6 +65,19 @@ Public Class ProjectVM
m_LeftPanel_Visibility = IsVisible
End Sub
Private m_LayersWallLeftPanel_Visibility As Boolean = False
Public Property LayersWallLeftPanel_Visibility As Visibility
Get
Return If(m_LayersWallLeftPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_LayersWallLeftPanel_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetLayersWallLeftPanel_Visibility(IsVisible As Boolean)
m_LayersWallLeftPanel_Visibility = IsVisible
End Sub
Private m_TopPanel_Visibility As Boolean = False
Public Property TopPanel_Visibility As Visibility
Get
@@ -91,6 +104,19 @@ Public Class ProjectVM
m_BottomPanel_Visibility = IsVisible
End Sub
Private m_LayersWallBottomPanel_Visibility As Boolean = False
Public Property LayersWallBottomPanel_Visibility As Visibility
Get
Return If(m_LayersWallBottomPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_LayersWallBottomPanel_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetLayersWallBottomPanel_Visibility(IsVisible As Boolean)
m_LayersWallBottomPanel_Visibility = IsVisible
End Sub
Private m_PartManager_Visibility As Boolean = True
Public Property PartManager_Visibility As Visibility
Get
@@ -104,6 +130,34 @@ Public Class ProjectVM
m_PartManager_Visibility = IsVisible
End Sub
Private m_LayersWallLayerPartManager_Visibility As Boolean = True
Public Property LayersWallLayerPartManager_Visibility As Visibility
Get
Return If(m_LayersWallLayerPartManager_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_LayersWallLayerPartManager_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetLayersWallLayerPartManager_Visibility(IsVisible As Boolean)
m_LayersWallLayerPartManager_Visibility = IsVisible
NotifyPropertyChanged(NameOf(LayersWallLayerPartManager_Visibility))
End Sub
Private m_LayersWallPartPartManager_Visibility As Boolean = True
Public Property LayersWallPartPartManager_Visibility As Visibility
Get
Return If(m_LayersWallPartPartManager_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_LayersWallPartPartManager_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetLayersWallPartPartManager_Visibility(IsVisible As Boolean)
m_LayersWallPartPartManager_Visibility = IsVisible
NotifyPropertyChanged(NameOf(LayersWallPartPartManager_Visibility))
End Sub
Private m_FeatureManager_Visibility As Boolean = True
Public Property FeatureManager_Visibility As Visibility
Get
@@ -176,6 +230,19 @@ Public Class ProjectVM
Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.NestingOption_Visibility))
End Sub
Private m_LayersWallProjManager_Visibility As Boolean = True
Public Property LayersWallProjManager_Visibility As Visibility
Get
Return If(m_LayersWallProjManager_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_LayersWallProjManager_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetLayersWallProjManager_Visibility(IsVisible As Boolean)
m_LayersWallProjManager_Visibility = IsVisible
End Sub
Friend Sub NotifyCalcPanel_Visibility()
Map.refCALCPanelVM.NotifyPropertyChanged(NameOf(Map.refCALCPanelVM.ViewPage_Visibility))
End Sub
@@ -196,13 +263,17 @@ Public Class ProjectVM
Friend Sub NotifyAllPanelVisibility()
NotifyPropertyChanged("LeftPanel_Visibility")
NotifyPropertyChanged("LayersWallLeftPanel_Visibility")
NotifyPropertyChanged("TopPanel_Visibility")
NotifyPropertyChanged("BottomPanel_Visibility")
NotifyPropertyChanged("LayersWallBottomPanel_Visibility")
NotifyPropertyChanged("PartManager_Visibility")
NotifyPropertyChanged("LayersWallPartManager_Visibility")
NotifyPropertyChanged("FeatureManager_Visibility")
NotifyPropertyChanged("ShowBeamPanel_Visibility")
NotifyPropertyChanged("ProjManager_Visibility")
NotifyPropertyChanged("ProdManager_Visibility")
NotifyPropertyChanged("LayersWallProjManager_Visibility")
NotifyCalcPanel_Visibility()
End Sub
@@ -234,7 +305,9 @@ Public Class ProjectVM
Map.refCALCPanelVM.SetCalcPanelIsEnabled(bIsEnabled)
Map.refMainMenuVM.SetMainMenuIsEnabled(bIsEnabled)
Map.refPartManagerVM.SetPartManagerIsEnabled(bIsEnabled)
Map.refLayersWallPartManagerVM.SetLayersWallPartManagerIsEnabled(bIsEnabled)
Map.refLeftPanelVM.SetLeftPanelIsEnabled(bIsEnabled)
Map.refLayersWallLeftPanelVM.SetLayersWallLeftPanelIsEnabled(bIsEnabled)
Map.refProjManagerVM.SetProjManagerIsEnabled(bIsEnabled)
Map.refProdManagerVM.SetProdManagerIsEnabled(bIsEnabled)
Map.refTopPanelVM.SetTopPanelIsEnabled(bIsEnabled)
@@ -664,41 +664,80 @@ Public Class MySceneHostVM
Private Sub OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
WriteMainPrivateProfileString(S_GENERAL, K_LASTIMPDIR, Path.GetDirectoryName(sFile))
Dim bFirstPart As Boolean = EgtGetFirstPart() <> GDB_ID.NULL
If bOk OrElse bFirstPart Then
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.IMPORTBTL, 2, EgtMsg(63005), 50, 70) ' Loading parts
' leggo struttura BTL
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(0))
Dim nPartId As Integer = EgtGetFirstPart()
While nPartId <> GDB_ID.NULL
' scrivo in ogni pezzo ProjId
EgtSetInfo(nPartId, BTL_PRT_PROJ, Map.refProjManagerVM.nLoadingProjId)
nPartId = EgtGetNextPart(nPartId)
' scrivo Id negli outline
Dim nPRId As Integer = 1
Dim nOutlineLayer As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
If EgtExistsInfo(nOutlineId, MGR_FTR_PRC) Then
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
nPRId += 1
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
End While
' scrivo info proj e type su layer BtlInfo
Dim nBTLInfoLayer As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
EgtSetInfo(nBTLInfoLayer, BTL_PRT_PROJ, Map.refProjManagerVM.nLoadingProjId)
EgtSetInfo(nBTLInfoLayer, BTL_GEN_PROJTYPE, Map.refProjManagerVM.CurrProj.nType)
' scrivo info proj su layer AsseBase
Dim nAsseBaseLayer As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
EgtSetInfo(nAsseBaseLayer, BTL_PRT_PROJ, Map.refProjManagerVM.nLoadingProjId)
If Map.refMainMenuVM.SelPage = Pages.LAYERSWALL Then
If bOk OrElse bFirstPart Then
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.IMPORTBTL, 2, EgtMsg(63005), 50, 70) ' Loading parts
' leggo struttura BTL
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(0))
Dim nPartId As Integer = EgtGetFirstPart()
While nPartId <> GDB_ID.NULL
' scrivo in ogni pezzo ProjId
EgtSetInfo(nPartId, BTL_PRT_PROJ, Map.refLayersWallProjManagerVM.nLoadingProjId)
nPartId = EgtGetNextPart(nPartId)
' scrivo Id negli outline
Dim nPRId As Integer = 1
Dim nOutlineLayer As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
If EgtExistsInfo(nOutlineId, MGR_FTR_PRC) Then
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
nPRId += 1
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
End While
' scrivo info proj e type su layer BtlInfo
Dim nBTLInfoLayer As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
EgtSetInfo(nBTLInfoLayer, BTL_PRT_PROJ, Map.refLayersWallProjManagerVM.nLoadingProjId)
EgtSetInfo(nBTLInfoLayer, BTL_GEN_PROJTYPE, Map.refLayersWallProjManagerVM.CurrProj.nType)
' scrivo info proj su layer AsseBase
Dim nAsseBaseLayer As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
EgtSetInfo(nAsseBaseLayer, BTL_PRT_PROJ, Map.refLayersWallProjManagerVM.nLoadingProjId)
Else
Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file
MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
Map.refLayersWallProjManagerVM.NewProject()
End If
Else
Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file
MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
Map.refProjManagerVM.NewProject()
If bOk OrElse bFirstPart Then
LoadingWndHelper.UpdateLoadingWnd(ActiveIds.IMPORTBTL, 2, EgtMsg(63005), 50, 70) ' Loading parts
' leggo struttura BTL
Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(0))
Dim nPartId As Integer = EgtGetFirstPart()
While nPartId <> GDB_ID.NULL
' scrivo in ogni pezzo ProjId
EgtSetInfo(nPartId, BTL_PRT_PROJ, Map.refProjManagerVM.nLoadingProjId)
nPartId = EgtGetNextPart(nPartId)
' scrivo Id negli outline
Dim nPRId As Integer = 1
Dim nOutlineLayer As Integer = EgtGetFirstNameInGroup(nPartId, OUTLINE)
If nOutlineLayer <> GDB_ID.NULL Then
Dim nOutlineId As Integer = EgtGetFirstInGroup(nOutlineLayer)
While nOutlineId <> GDB_ID.NULL
' verifico che sia feature
If EgtExistsInfo(nOutlineId, MGR_FTR_PRC) Then
EgtSetInfo(nOutlineId, MGR_FTR_PRID, nPRId)
nPRId += 1
End If
nOutlineId = EgtGetNext(nOutlineId)
End While
End If
End While
' scrivo info proj e type su layer BtlInfo
Dim nBTLInfoLayer As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
EgtSetInfo(nBTLInfoLayer, BTL_PRT_PROJ, Map.refProjManagerVM.nLoadingProjId)
EgtSetInfo(nBTLInfoLayer, BTL_GEN_PROJTYPE, Map.refProjManagerVM.CurrProj.nType)
' scrivo info proj su layer AsseBase
Dim nAsseBaseLayer As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, ASSEBASE)
EgtSetInfo(nAsseBaseLayer, BTL_PRT_PROJ, Map.refProjManagerVM.nLoadingProjId)
Else
Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file
MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
Map.refProjManagerVM.NewProject()
End If
End If
MainScene.SetStatusNull()
@@ -50,6 +50,10 @@
<OmagOFFICE:MachiningTabVM x:Key="MachiningTabVM"/>
<OmagOFFICE:SimulTabVM x:Key="SimulTabVM"/>-->
<EgtBEAMWALL:MyMachGroupPanelVM x:Key="MachGroupPanelVM"/>
<EgtBEAMWALL:ElementLayerTreeViewVM x:Key="ElementLayerTreeViewVM"/>
<EgtBEAMWALL:LayersWallLeftPanelVM x:Key="LayersWallLeftPanelVM"/>
<EgtBEAMWALL:LayersWallBottomPanelVM x:Key="LayersWallBottomPanelVM"/>
<EgtBEAMWALL:LayersWallProjManagerVM x:Key="LayersWallProjManagerVM"/>
<!--Colori predefiniti-->
<SolidColorBrush x:Key="Omag_Blue" Color="#FF095CA8" />
+63 -1
View File
@@ -33,6 +33,11 @@ Module Map
Private m_refQParameterListVM As QParameterListVM
Private m_refFeatureManagerVM As FeatureManagerVM
Private m_refAddSectionXMaterialWndVM As AddSectionXMaterialWndVM
Private m_refElementLayerTreeViewVM As ElementLayerTreeViewVM
Private m_refLayersWallLeftPanelVM As LayersWallLeftPanelVM
Private m_refLayersWallBottomPanelVM As LayersWallBottomPanelVM
Private m_refLayersWallPartManagerVM As LayersWallPartManagerVM
Private m_refLayersWallProjManagerVM As LayersWallProjManagerVM
'Private m_refOpenProjectFileDialogVM As OpenProjectFileDialogVM
'Private m_refRawPartTabVM As RawPartTabVM
'Private m_refNestingTabVM As NestingTabVM
@@ -234,6 +239,36 @@ Module Map
End Get
End Property
Public ReadOnly Property refElementLayerTreeViewVM As ElementLayerTreeViewVM
Get
Return m_refElementLayerTreeViewVM
End Get
End Property
Public ReadOnly Property refLayersWallLeftPanelVM As LayersWallLeftPanelVM
Get
Return m_refLayersWallLeftPanelVM
End Get
End Property
Public ReadOnly Property refLayersWallBottomPanelVM As LayersWallBottomPanelVM
Get
Return m_refLayersWallBottomPanelVM
End Get
End Property
Public ReadOnly Property refLayersWallPartManagerVM As LayersWallPartManagerVM
Get
Return m_refLayersWallPartManagerVM
End Get
End Property
Public ReadOnly Property refLayersWallProjManagerVM As LayersWallProjManagerVM
Get
Return m_refLayersWallProjManagerVM
End Get
End Property
'Public ReadOnly Property refOpenProjectFileDialogVM As OpenProjectFileDialogVM
' Get
' Return m_refOpenProjectFileDialogVM
@@ -441,6 +476,31 @@ Module Map
Return Not IsNothing(m_refAddSectionXMaterialWndVM)
End Function
Friend Function SetRefElementLayerTreeViewVM(ElementLayerTreeViewVM As ElementLayerTreeViewVM) As Boolean
m_refElementLayerTreeViewVM = ElementLayerTreeViewVM
Return Not IsNothing(m_refElementLayerTreeViewVM)
End Function
Friend Function SetRefLayersWallLeftPanelVM(LayersWallLeftPanelVM As LayersWallLeftPanelVM) As Boolean
m_refLayersWallLeftPanelVM = LayersWallLeftPanelVM
Return Not IsNothing(m_refLayersWallLeftPanelVM)
End Function
Friend Function SetRefLayersWallBottomPanelVM(LayersWallBottomPanelVM As LayersWallBottomPanelVM) As Boolean
m_refLayersWallBottomPanelVM = LayersWallBottomPanelVM
Return Not IsNothing(m_refLayersWallBottomPanelVM)
End Function
Friend Function SetRefLayersWallPartManagerVM(LayersWallPartManagerVM As LayersWallPartManagerVM) As Boolean
m_refLayersWallPartManagerVM = LayersWallPartManagerVM
Return Not IsNothing(m_refLayersWallPartManagerVM)
End Function
Friend Function SetRefLayersWallProjManagerVM(LayersWallProjManagerVM As LayersWallProjManagerVM) As Boolean
m_refLayersWallProjManagerVM = LayersWallProjManagerVM
Return Not IsNothing(m_refLayersWallProjManagerVM)
End Function
'Friend Function SetRefOpenProjectFileDialogVM(OpenProjectFileDialogVM As OpenProjectFileDialogVM) As Boolean
' m_refOpenProjectFileDialogVM = OpenProjectFileDialogVM
' Return Not IsNothing(m_refOpenProjectFileDialogVM)
@@ -513,7 +573,9 @@ Module Map
Not IsNothing(m_refPartListVM) AndAlso Not IsNothing(m_refFeatureInPartInRawPartListVM) AndAlso
Not IsNothing(m_refStatisticsVM) AndAlso Not IsNothing(m_refPParameterListVM) AndAlso
Not IsNothing(m_refQParameterListVM) AndAlso Not IsNothing(m_refFeatureManagerVM) AndAlso
Not IsNothing(m_refAddSectionXMaterialWndVM) AndAlso LibMap.EndInit()
Not IsNothing(m_refAddSectionXMaterialWndVM) AndAlso Not IsNothing(m_refElementLayerTreeViewVM) AndAlso
Not IsNothing(m_refLayersWallLeftPanelVM) AndAlso Not IsNothing(m_refLayersWallBottomPanelVM) AndAlso
Not IsNothing(m_refLayersWallPartManagerVM) AndAlso Not IsNothing(m_refLayersWallProjManagerVM) AndAlso LibMap.EndInit()
End Function
#End Region ' Init
+2 -1
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
<package id="Ionic.Zip" version="1.9.1.8" targetFramework="net472" />
<package id="MySql.Data" version="6.10.9" targetFramework="net40" requireReinstallation="true" />
<package id="MySql.Data.Entity" version="6.10.9" targetFramework="net40" requireReinstallation="true" />
<package id="PDFsharp-MigraDoc-wpf" version="1.50.5147" targetFramework="net472" />
</packages>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-389
View File
@@ -1,389 +0,0 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>MySql.Data.Entity.EF6</name>
</assembly>
<members>
<member name="T:MySql.Data.Entity.SqlFragmentVisitor">
<summary>
Visitor for SqlFragment and derived classes, useful for postprocessing and optimizations.
</summary>
</member>
<member name="T:MySql.Data.Entity.ReplaceTableNameVisitor">
<summary>
Visitor to replace old table names with new table names. Used as part postprocessing of the code for fusing nested selects.
</summary>
</member>
<member name="T:MySql.Data.Entity.OpType">
<summary>
Specifies the operation types supported.
</summary>
</member>
<member name="M:MySql.Data.Entity.SelectGenerator.TryFlatteningGroupBy(MySql.Data.Entity.SqlFragment)">
<summary>
If input sqlFragment is a group by structure, is flattened to remove some nested correlation queries.
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:MySql.Data.Entity.SqlGenerator.TryFusingSelect(MySql.Data.Entity.InputFragment)">
<summary>
If current fragment is select and its from clause is another select, try fuse the inner select with the outer select.
(Thus removing a nested query, which may have bad performance in Mysql).
</summary>
<param name="f">The fragment to probe and posibly optimize</param>
<returns>The fragment fused, or the original one.</returns>
</member>
<member name="M:MySql.Data.Entity.SqlGenerator.TryPromoteToLike(System.Data.Entity.Core.Common.CommandTrees.DbExpression,System.Data.Entity.Core.Common.CommandTrees.DbExpression,System.String)">
<summary>
Examines a binary expression to see if it is an special case suitable to conversion
to a more efficient and equivalent LIKE sql expression.
</summary>
<param name="left"></param>
<param name="right"></param>
<param name="op"></param>
<returns></returns>
</member>
<member name="T:MySql.Data.Entity.MySqlConnectionFactory">
<summary>
Used for creating connections in Code First 4.3.
</summary>
</member>
<member name="T:MySql.Data.Entity.MySqlDependencyResolver">
<summary>
Provides the capability to resolve a dependency.
</summary>
</member>
<member name="M:MySql.Data.Entity.MySqlDependencyResolver.GetService(System.Type,System.Object)">
<summary>
Attempts to resolve a dependency for a given contract type and optionally a given key.
</summary>
<param name="type">The base class that defines the dependency to be resolved.</param>
<param name="key">Optionally, the key of the dependency to be resolved.</param>
<returns>The resolved dependency.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlDependencyResolver.GetServices(System.Type,System.Object)">
<summary>
Attempts to resolve a dependency for all of the registered services with the given type and key combination.
</summary>
<param name="type">The base class that defines the dependency to be resolved.</param>
<param name="key">Optionally, the key of the dependency to be resolved.</param>
<returns>All services that resolve the dependency.</returns>
</member>
<member name="T:MySql.Data.Entity.MySqlProviderInvariantName">
<summary>
Used to resolve a provider invariant name from a provider factory.
</summary>
</member>
<member name="P:MySql.Data.Entity.MySqlProviderInvariantName.Name">
<summary>
Gets the name of the provider.
</summary>
</member>
<member name="P:MySql.Data.Entity.MySqlProviderInvariantName.ProviderName">
<summary>
Gets the name of the provider.
</summary>
</member>
<member name="T:MySql.Data.Entity.MySqlProviderFactoryResolver">
<summary>
Service that obtains the provider factory from a given connection.
</summary>
</member>
<member name="M:MySql.Data.Entity.MySqlProviderFactoryResolver.ResolveProviderFactory(System.Data.Common.DbConnection)">
<summary>
Returns the <see cref="T:System.Data.Common.DbProviderFactory"/> for the given connection.
</summary>
<param name="connection">The database connection.</param>
<returns>The provider factory for the connection.</returns>
</member>
<member name="T:MySql.Data.Entity.MySqlManifestTokenResolver">
<summary>
Gets a provider manifest token for the given connection.
</summary>
</member>
<member name="M:MySql.Data.Entity.MySqlManifestTokenResolver.ResolveManifestToken(System.Data.Common.DbConnection)">
<summary>
Returns the manifest token to use for the given connection.
</summary>
<param name="connection">The connection for which a manifest token is required.</param>
<returns>The manifest token to use.</returns>
</member>
<member name="T:MySql.Data.Entity.MySqlModelCacheKey">
<summary>
Represents a key value that uniquely identifies an Entity Framework model that has been loaded into memory.
</summary>
</member>
<member name="M:MySql.Data.Entity.MySqlModelCacheKey.Equals(System.Object)">
<summary>
Determines whether the current cached model key is equal to the specified cached
model key.
</summary>
<param name="other">The cached model key to compare to the current cached model key.</param>
<returns><c>true</c> if the current cached model key is equal to the specified cached model key;
otherwise, <c>false</c>.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlModelCacheKey.GetHashCode">
<summary>
Returns the hash function for this cached model key.
</summary>
<returns>The hash function for this cached model key.</returns>
</member>
<member name="T:MySql.Data.Entity.MySqlEFConfiguration">
<summary>
Defines the configuration of an application to be used with Entity Framework.
</summary>
</member>
<member name="M:MySql.Data.Entity.MySqlEFConfiguration.#ctor">
<summary>
Initializes a new instance of <see cref="T:MySql.Data.Entity.MySqlEFConfiguration"/> class.
</summary>
</member>
<member name="T:MySql.Data.Entity.MySqlExecutionStrategy">
<summary>
An execution strategy tailored for handling MySql Server transient errors.
</summary>
</member>
<member name="F:MySql.Data.Entity.MySqlExecutionStrategy.errorsToRetryOn">
<summary>
Different back off algorithms used for different errors.
</summary>
</member>
<member name="T:MySql.Data.Entity.BackoffAlgorithm">
<summary>
The base class for backoff algorithms.
</summary>
<remarks>Different transient error conditions require different approaches.</remarks>
</member>
<member name="M:MySql.Data.Entity.BackoffAlgorithm.GetNextDelay">
<summary>
The default implementation is an exponential delay backoff.
</summary>
<returns></returns>
</member>
<member name="M:MySql.Data.Entity.BackoffAlgorithm.Reset">
<summary>
Resets a backoff algorithm, so they can be reused.
</summary>
</member>
<member name="T:MySql.Data.Entity.BackoffAlgorithmErr1040">
<summary>
Back-off algorithm customized for the MySql error code 1040 - Too many connections.
</summary>
</member>
<member name="T:MySql.Data.Entity.BackoffAlgorithmErr1614">
<summary>
Back-off algorithm for the Mysql error code 1614 - Transaction branch was rolled back: deadlock was detected.
</summary>
</member>
<member name="T:MySql.Data.Entity.BackoffAlgorithmErr1205">
<summary>
Back-off algorithm customized for the MySql error code 1205 - Lock wait timeout exceeded; try restarting transaction.
</summary>
</member>
<member name="T:MySql.Data.Entity.BackoffAlgorithmErr1213">
<summary>
Back-off algorithm customized for MySql error code 1213 - Deadlock found when trying to get lock; try restarting transaction.
</summary>
</member>
<member name="T:MySql.Data.Entity.BackoffAlgorithmErr2006">
<summary>
Back-off algorithm customized for MySql error code 2006 - MySQL server has gone away.
</summary>
</member>
<member name="T:MySql.Data.Entity.BackoffAlgorithmErr2013">
<summary>
Back-off algorithm customized for MySql error code 2013 - Lost connection to MySQL server during query.
</summary>
</member>
<member name="T:MySql.Data.Entity.BackoffAlgorithmNdb">
<summary>
Back-off algorithm customized for MySql Cluster (NDB) errors.
</summary>
</member>
<member name="T:MySql.Data.Entity.MySqlHistoryContext">
<summary>
Reads and writes migration history from the database during code first migrations.
</summary>
</member>
<member name="T:MySql.Data.Entity.MySqlLogger">
<summary>
Enables the creation of MySQL logs for applications.
</summary>
</member>
<member name="T:MySql.Data.Entity.MySqlMigrationCodeGenerator">
<summary>
Class used to customized code generation
to avoid dbo. prefix added on table names.
</summary>
</member>
<member name="T:MySql.Data.Entity.MySqlMigrationSqlGenerator">
<summary>
Implementation of a MySql's Sql generator for EF 4.3 data migrations.
</summary>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddColumnOperation)">
<summary>
Generates a migration operation to add a column.
</summary>
<param name="op">The operation that represents a column being added to a table.</param>
<returns>A migration operation to add a column.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropColumnOperation)">
<summary>
Generates a migration operation to drop a column.
</summary>
<param name="op">The operation that represents a column being dropped from a table.</param>
<returns>The migration operation to drop a column.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterColumnOperation)">
<summary>
Generates a migration operation to alter a column.
</summary>
<param name="op">The operation that represents altering an existing column.</param>
<returns>A migration operation to alter a column.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameColumnOperation)">
<summary>
Generates a migration operation to rename a column.
</summary>
<param name="op">The operation that represents a column being renamed.</param>
<returns>A migration operation to rename a column.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddForeignKeyOperation)">
<summary>
Generates a migration operation to add a foreign key.
</summary>
<param name="op">the operation that represents a foreing key constraint being added to a table.</param>
<returns>A migration operation to add a foreign key constraint.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.ColumnModel)">
<summary>
Generates an SQL statement of a column model.
</summary>
<param name="op">The model that represents a column.</param>
<returns>A string containing an SQL statement of a column model.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropForeignKeyOperation)">
<summary>
Generates a migration operation to drop a foreign key constraint from a table.
</summary>
<param name="op">The operation that represents a foreign key being added from a table.</param>
<returns>A migration operation to drop a foreign key.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateIndexOperation)">
<summary>
Generates a migration operation to create a database index.
</summary>
<param name="op">The operation that represents creating a database index.</param>
<returns>A migration operation to create a database index.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropIndexOperation)">
<summary>
Generates a migration operation to drop an existing database index.
</summary>
<param name="op">The operation that represents dropping am existing database index.</param>
<returns>A migration operation to drop an existing database index.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateTableOperation)">
<summary>
Generates a migration operation to create a table.
</summary>
<param name="op">The operation that represents creating a table.</param>
<returns>A migration operation to create a table.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropTableOperation)">
<summary>
Generates a migration operation to drop an existing table.
</summary>
<param name="op">The operation that represents dropping an existing table.</param>
<returns>A migration operation to drop an existing table.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation)">
<summary>
Generates a migration operation to add a primary key to a table.
</summary>
<param name="op">The operation that represents adding a primary key to a table.</param>
<returns>A migration operation to add a primary key to a table.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation)">
<summary>
Generates a migration operation to drpo an existing primary key.
</summary>
<param name="op">The operation that represents dropping an existing primary key.</param>
<returns>A migration operation to drop an existing primary key.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameTableOperation)">
<summary>
Generates a migration operation to rename an existing table.
</summary>
<param name="op">The operation that represents renaming an existing table.</param>
<returns>A migration operation to rename an existing table.</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MoveTableOperation)">
<summary>
Not implemented yet.
</summary>
<param name="op">NA</param>
<returns>NA</returns>
</member>
<member name="M:MySql.Data.Entity.MySqlMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.SqlOperation)">
<summary>
Generates a migration operation with a MySQL statement to be executed.
</summary>
<param name="op">The operation representing a MySQL statement to be executed directly against the database.</param>
<returns>A migration operation with a MySQL statement to be executed.</returns>
</member>
<member name="T:MySql.Data.Entity.Properties.Resources">
<summary>
A strongly-typed resource class, for looking up localized strings, etc.
</summary>
</member>
<member name="P:MySql.Data.Entity.Properties.Resources.ResourceManager">
<summary>
Returns the cached ResourceManager instance used by this class.
</summary>
</member>
<member name="P:MySql.Data.Entity.Properties.Resources.Culture">
<summary>
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
</summary>
</member>
<member name="P:MySql.Data.Entity.Properties.Resources.ConnectionMustBeOfTypeMySqlConnection">
<summary>
Looks up a localized string similar to The connection parameter must reference an object of type MySql.Data.MySqlConnection.
</summary>
</member>
<member name="P:MySql.Data.Entity.Properties.Resources.NoStoreTypeForEdmType">
<summary>
Looks up a localized string similar to There is no store type corresponding to the EDM type &apos;{0}&apos; of primitive type &apos;{1}&apos;..
</summary>
</member>
<member name="P:MySql.Data.Entity.Properties.Resources.TypeNotSupported">
<summary>
Looks up a localized string similar to The underlying provider does not support the type &apos;{0}&apos;..
</summary>
</member>
<member name="P:MySql.Data.Entity.Properties.Resources.WrongFunctionResultType">
<summary>
Looks up a localized string similar to Result type of a function is expected to be a collection of RowType or PrimitiveType.
</summary>
</member>
<member name="M:MySql.Data.MySqlClient.MySqlProviderServices.SetExpectedTypes(System.Data.Entity.Core.Common.CommandTrees.DbCommandTree,MySql.Data.Entity.EFMySqlCommand)">
<summary>
Sets the expected column types
</summary>
</member>
<member name="M:MySql.Data.MySqlClient.MySqlProviderServices.SetQueryExpectedTypes(System.Data.Entity.Core.Common.CommandTrees.DbQueryCommandTree,MySql.Data.Entity.EFMySqlCommand)">
<summary>
Sets the expected column types for a given query command tree
</summary>
</member>
<member name="M:MySql.Data.MySqlClient.MySqlProviderServices.SetFunctionExpectedTypes(System.Data.Entity.Core.Common.CommandTrees.DbFunctionCommandTree,MySql.Data.Entity.EFMySqlCommand)">
<summary>
Sets the expected column types for a given function command tree
</summary>
</member>
</members>
</doc>
Binary file not shown.
-11867
View File
File diff suppressed because it is too large Load Diff