Modifiche supervisore

This commit is contained in:
Emmanuele Sassi
2021-04-15 20:06:18 +02:00
parent b7b50ed222
commit cde144de29
71 changed files with 5765 additions and 187 deletions
@@ -0,0 +1,535 @@
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.ComponentModel
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class BTLFeatureVM
Inherits VMBase
Private WithEvents m_BTLFeatureM As BTLFeatureM
Public ReadOnly Property BTLFeatureM As BTLFeatureM
Get
Return m_BTLFeatureM
End Get
End Property
Private m_BTLPartM As BTLPartM
Public ReadOnly Property nFeatureId As Integer
Get
Return m_BTLFeatureM.nFeatureId
End Get
End Property
Public Property GRPList As ObservableCollection(Of Integer)
Get
Return m_BTLFeatureM.GRPList
End Get
Set(value As ObservableCollection(Of Integer))
m_BTLFeatureM.GRPList = value
End Set
End Property
Public Property nSelGRP As Integer
Get
Return m_BTLFeatureM.nSelGRP
End Get
Set(value As Integer)
If value <> -1 Then
' aggiorno la feature con nuovo valore
Dim vPar() As Double = Nothing
Dim sPar As String = String.Empty
m_BTLFeatureM.CalcParamArray(vPar, sPar)
Dim bOK As Boolean = m_BTLFeatureM.UpdateParams(value, m_BTLFeatureM.nPRC, nSelSIDE, m_BTLFeatureM.sDES, m_BTLFeatureM.nPRID, m_BTLFeatureM.frFRAME, vPar, sPar)
If bOK Then
m_BTLFeatureM.nSelGRP = value
' seleziono feature in disegno
SelGeomFeature()
' rendo non calcolata questa feature
CalcFeatureUpdate(False, 0, 0, 0, "")
Else
NotifyPropertyChanged("nSelGRP")
End If
NotifyPropertyChanged(NameOf(nSelGRP))
EgtDraw()
End If
End Set
End Property
Friend ReadOnly Property sDescGRP As String
Get
Dim sDescConstruction As String = String.Empty
If CalcBeamPrivateProfileGRP(m_BTLFeatureM.nSelGRP) = 0 Then
sDescConstruction = "L"
Else
sDescConstruction = "T"
End If
sDescConstruction &= m_BTLFeatureM.nPRC.ToString("000")
Return sDescConstruction
End Get
End Property
Public Property nPRC As Integer
Get
Return m_BTLFeatureM.nPRC
End Get
Set(value As Integer)
m_BTLFeatureM.nPRC = value
End Set
End Property
Public Property SIDEList As ObservableCollection(Of Integer)
Get
Return m_BTLFeatureM.SIDEList
End Get
Set(value As ObservableCollection(Of Integer))
m_BTLFeatureM.SIDEList = value
End Set
End Property
' Lato
Public Property nSelSIDE As Integer
Get
Return m_BTLFeatureM.nSelSIDE
End Get
Set(value As Integer)
If value <> -1 Then
' aggiorno la feature con nuovo valore
Dim vPar() As Double = Nothing
Dim sPar As String = String.Empty
m_BTLFeatureM.CalcParamArray(vPar, sPar)
Dim bOK As Boolean = m_BTLFeatureM.UpdateParams(nSelGRP, m_BTLFeatureM.nPRC, value, m_BTLFeatureM.sDES, m_BTLFeatureM.nPRID, m_BTLFeatureM.frFRAME, vPar, sPar)
If bOK Then
m_BTLFeatureM.nSelSIDE = value
SelGeomFeature()
' rendo non calcolata questa feature
CalcFeatureUpdate(False, 0, 0, 0, "")
Else
NotifyPropertyChanged("nSelGRP")
End If
EgtDraw()
End If
End Set
End Property
Public ReadOnly Property sName As String
Get
Return m_BTLFeatureM.sName
End Get
End Property
Public Property bDO As Boolean
Get
Return m_BTLFeatureM.bDO
End Get
Set(value As Boolean)
If EgtBeamEnableProcess(nFeatureId, value) Then
m_BTLFeatureM.bDO = value
EgtDraw()
NotifyPropertyChanged("Calc_Background")
NotifyPropertyChanged("bDO")
End If
End Set
End Property
Public Property nPRID As Integer
Get
Return m_BTLFeatureM.nPRID
End Get
Set(value As Integer)
m_BTLFeatureM.nPRID = value
End Set
End Property
Public Property sDES As String
Get
Return m_BTLFeatureM.sDES
End Get
Set(value As String)
m_BTLFeatureM.sDES = value
End Set
End Property
Public Property frFRAME As Frame3d
Get
Return m_BTLFeatureM.frFRAME
End Get
Set(value As Frame3d)
m_BTLFeatureM.frFRAME = value
End Set
End Property
' proprieta' che mostra la descrizione in interfaccia
Public ReadOnly Property sDesc As String
Get
Return sDescGRP & " " & sName
End Get
End Property
Public ReadOnly Property sDrawPath As String
Get
Return Map.refMainWindowVM.MainWindowM.sResourcesRoot & "\Features\" & sDescGRP & ".png"
End Get
End Property
Public ReadOnly Property nState As CalcStates
Get
Return m_BTLFeatureM.nState
End Get
End Property
Public ReadOnly Property nCALC_ERR As Integer
Get
Return m_BTLFeatureM.nCALC_ERR
End Get
End Property
Public ReadOnly Property nCALC_ROT As Integer
Get
Return m_BTLFeatureM.nCALC_ROT
End Get
End Property
Public ReadOnly Property nCALC_FALL As Integer
Get
Return m_BTLFeatureM.nCALC_FALL
End Get
End Property
Public ReadOnly Property nCALC_MSG As String
Get
Return m_BTLFeatureM.sCALC_MSG
End Get
End Property
Public ReadOnly Property Calc_Background As SolidColorBrush
Get
If Not m_BTLFeatureM.bDO Then
Return Brushes.Aqua
ElseIf m_BTLFeatureM.nState = 0 Then
Return Brushes.Green
ElseIf m_BTLFeatureM.nState < 0 Then
Return Brushes.LightGray
ElseIf m_BTLFeatureM.nState > 0 Then
Return Brushes.Red
Else
Return Brushes.Red
End If
End Get
End Property
Public ReadOnly Property CALC_ROT_Visibility As Visibility
Get
Return If(m_BTLFeatureM.nCALC_ROT <> 0, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Public ReadOnly Property CALC_FALL_Visibility As Visibility
Get
Return If(m_BTLFeatureM.nCALC_FALL <> 0, Visibility.Visible, Visibility.Collapsed)
End Get
End Property
Public ReadOnly Property CALC_ERR_Letter As String
Get
Select Case m_BTLFeatureM.nCALC_ERR
Case 22
Return "c"
Case 19, 23, 24, 25
Return "e"
Case 17
Return "w"
Case < 0
Return "i"
Case Else
Return ""
End Select
End Get
End Property
Public ReadOnly Property CALC_ERR_Foreground As SolidColorBrush
Get
Select Case m_BTLFeatureM.nCALC_ERR
Case 19, 22, 23, 24, 25
Return Brushes.Red
Case 17
Return Brushes.Orange
Case < 0
Return Brushes.Green
Case Else
Return Brushes.Red
End Select
End Get
End Property
'Private m_PBTLParamVMList As ObservableCollection(Of BTLParamVM)
'Public Property PBTLParamVMList As ObservableCollection(Of BTLParamVM)
' Get
' Return m_PBTLParamVMList
' End Get
' Set(value As ObservableCollection(Of BTLParamVM))
' m_PBTLParamVMList = value
' End Set
'End Property
'Protected m_SelPBTLParam As BTLParamVM
'Public Property SelPBTLParam As BTLParamVM
' Get
' Return m_SelPBTLParam
' End Get
' Set(value As BTLParamVM)
' m_SelPBTLParam = value
' If Not IsNothing(m_SelPBTLParam) Then
' ' imposto path disegno da mostrare in BottomPanel
' Map.refBottomPanelVM.SetCurrDraw(sDrawPath)
' End If
' NotifyPropertyChanged(NameOf(SelPBTLParam))
' End Set
'End Property
'Private m_QBTLParamVMList As ObservableCollection(Of BTLParamVM)
'Public Property QBTLParamVMList As ObservableCollection(Of BTLParamVM)
' Get
' Return m_QBTLParamVMList
' End Get
' Set(value As ObservableCollection(Of BTLParamVM))
' m_QBTLParamVMList = value
' End Set
'End Property
'Protected m_SelQParam As BTLParamVM
'Public Property SelQBTLParam As BTLParamVM
' Get
' Return m_SelQParam
' End Get
' Set(value As BTLParamVM)
' m_SelQParam = value
' If Not IsNothing(m_SelQParam) Then
' ' imposto path disegno da mostrare in BottomPanel
' Map.refBottomPanelVM.SetCurrDraw(sDrawPath)
' End If
' NotifyPropertyChanged(NameOf(SelQBTLParam))
' End Set
'End Property
' Definizione comandi
Private m_cmdDeleteFeature As ICommand
#Region "CONSTRUCTOR"
'Sub New(ParentPart As BTLPartVM, nFeatureId As Integer)
' MyBase.New(ParentPart, nFeatureId)
' ' leggo gruppo, numero feature e lato
' EgtGetInfo(nFeatureId, BTL_FTR_GRP, m_nSelGRP)
' EgtGetInfo(nFeatureId, BTL_FTR_PRC, m_nPRC)
' EgtGetInfo(nFeatureId, BTL_FTR_SIDE, m_nSelSIDE)
' Dim nDO As Integer = 1
' If EgtGetInfo(nFeatureId, BTL_FTR_DO, nDO) Then
' m_bDO = (nDO <> 0)
' Else
' m_bDO = True
' End If
' ' leggo des,prid e frame
' EgtGetInfo(nFeatureId, BTL_FTR_DES, m_sDES)
' EgtGetInfo(nFeatureId, BTL_FTR_PRID, m_nPRID)
' EgtGetInfo(nFeatureId, BTL_FTR_FRAME, m_frFRAME)
' ' 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(m_nFeatureId, ITG_PROJ_ERR, nErr)
' EgtGetInfo(m_nFeatureId, ITG_PROJ_ROT, nRot)
' EgtGetInfo(m_nFeatureId, ITG_PROJ_FALL, nFall)
' EgtGetInfo(m_nFeatureId, ITG_PROJ_MSG, sMsg)
' CalcFeatureUpdate(bCalc, nErr, nRot, nFall, sMsg)
' ' leggo parametri della feature
' GetBeamPrivateProfileGRPList(CalcBeamPrivateProfileGRP(nSelGRP), m_nPRC, m_GRPList)
' GetBeamPrivateProfileName(m_nSelGRP, m_nPRC, Me)
' ' crea parametri per questa feature da file ini
' CreateFeatureParams()
' ReadFeatureParams()
'End Sub
Sub New(BTLFeatureM As BTLFeatureM, BTLPartM As BTLPartM)
m_BTLFeatureM = BTLFeatureM
'AddHandler m_BTLFeatureM.PBTLParamAdded, AddressOf OnPBTLParamAdded
'AddHandler m_BTLFeatureM.QBTLParamAdded, AddressOf OnQBTLParamAdded
m_BTLPartM = BTLPartM
'CreatePBTLParamVMList()
'CreateQBTLParamVMList()
NotifyPropertyChanged(NameOf(Calc_Background))
End Sub
Sub New(BTLFeatureM As BTLFeatureM)
m_BTLFeatureM = BTLFeatureM
'AddHandler m_BTLFeatureM.PBTLParamAdded, AddressOf OnPBTLParamAdded
'AddHandler m_BTLFeatureM.QBTLParamAdded, AddressOf OnQBTLParamAdded
m_BTLPartM = Nothing
'CreatePBTLParamVMList()
'CreateQBTLParamVMList()
NotifyPropertyChanged(NameOf(Calc_Background))
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
'Private Sub CreatePBTLParamVMList()
' Dim all As List(Of BTLParamVM) = (From BTLParamM In m_BTLFeatureM.GetPBTLParams()
' Select New BTLParamVM(BTLParamM, m_BTLFeatureM)).ToList()
' For Each BTLParamVM As BTLParamVM In all
' AddHandler BTLParamVM.PropertyChanged, AddressOf OnPBTLParamVMPropertyChanged
' Next
' m_PBTLParamVMList = New ObservableCollection(Of BTLParamVM)(all)
' AddHandler m_PBTLParamVMList.CollectionChanged, AddressOf OnPBTLParamVMListChanged
'End Sub
'Private Sub CreateQBTLParamVMList()
' Dim all As List(Of BTLParamVM) = (From BTLParamM In m_BTLFeatureM.GetQBTLParams()
' Select New BTLParamVM(BTLParamM, m_BTLFeatureM)).ToList()
' For Each BTLParamVM As BTLParamVM In all
' AddHandler BTLParamVM.PropertyChanged, AddressOf OnQBTLParamVMPropertyChanged
' Next
' m_QBTLParamVMList = New ObservableCollection(Of BTLParamVM)(all)
' AddHandler m_QBTLParamVMList.CollectionChanged, AddressOf OnQBTLParamVMListChanged
'End Sub
' funzione che aggiorna lo stato e gli errori dopo calcolo
Friend Sub CalcFeatureUpdate(bCalc As Boolean, ERR As Integer, ROT As Integer, FALL As Integer, MSG As String)
If Not bCalc Then
m_BTLFeatureM.nState = CalcStates.NOTCALCULATED
m_BTLFeatureM.nCALC_ERR = 0
m_BTLFeatureM.nCALC_ROT = 0
m_BTLFeatureM.nCALC_FALL = 0
m_BTLFeatureM.sCALC_MSG = ""
Else
m_BTLFeatureM.nCALC_ERR = ERR
m_BTLFeatureM.nCALC_ROT = ROT
m_BTLFeatureM.nCALC_FALL = FALL
m_BTLFeatureM.sCALC_MSG = MSG
If ERR = 0 Then
m_BTLFeatureM.nState = 0
ElseIf ERR > 1 Then
m_BTLFeatureM.nState = 1
ElseIf ERR < 1 Then
m_BTLFeatureM.nState = -1
End If
End If
NotifyPropertyChanged(NameOf(Calc_Background))
End Sub
' funzione che seleziona la feature nella geometria
Friend Shared Sub SelGeomFeature(Feature As BTLFeatureVM)
EgtDeselectAll()
If Not IsNothing(Feature) Then EgtSelectObj(Feature.nFeatureId)
End Sub
Friend Sub SelGeomFeature()
EgtDeselectAll()
EgtSelectObj(nFeatureId)
End Sub
Public Function Copy() As BTLFeatureM
' creo nuova feature
Dim vPar() As Double = Nothing
Dim sPar As String = String.Empty
m_BTLFeatureM.CalcParamArray(vPar, sPar)
' aggiorno la feature con nuovo valore
EgtBeamSetPart(m_BTLPartM.nPartId)
Dim nNewFeatureId As Integer = EgtBeamAddProcess(m_BTLFeatureM.nSelGRP, m_BTLFeatureM.nPRC, m_BTLFeatureM.nSelSIDE, m_BTLFeatureM.sDES,
m_BTLFeatureM.ParentPart.NewProcId(), m_BTLFeatureM.frFRAME, vPar, sPar)
' se è stata creata
If nNewFeatureId <> GDB_ID.NULL Then
Dim NewFeat As BTLFeatureM = BTLFeatureM.CreateBTLFeature(m_BTLPartM, nNewFeatureId)
' la aggiungo a struttura BTL corrente
m_BTLPartM.AddBTLFeature(NewFeat)
Return NewFeat
End If
Return Nothing
End Function
Public Function Copy(DestBTLPart As BTLPartM) As Boolean
' creo nuova feature
Dim vPar() As Double = Nothing
Dim sPar As String = String.Empty
m_BTLFeatureM.CalcParamArray(vPar, sPar)
' aggiorno la feature con nuovo valore
EgtBeamSetPart(DestBTLPart.nPartId)
Dim nNewFeatureId As Integer = EgtBeamAddProcess(m_BTLFeatureM.nSelGRP, m_BTLFeatureM.nPRC, m_BTLFeatureM.nSelSIDE, m_BTLFeatureM.sDES,
DestBTLPart.NewProcId(), m_BTLFeatureM.frFRAME, vPar, sPar)
' se è stata creata
If nNewFeatureId <> GDB_ID.NULL Then
Dim NewFeat As BTLFeatureM = BTLFeatureM.CreateBTLFeature(m_BTLPartM, nNewFeatureId)
' la aggiungo a struttura BTL pezzo di destinazione
DestBTLPart.AddBTLFeature(NewFeat)
Return True
End If
Return False
End Function
#End Region ' METHODS
#Region "COMMANDS"
#End Region ' COMMANDS
#Region "EVENTS"
'Private Sub OnPBTLParamAdded(sender As Object, e As BTLParamAddedEventArgs) Handles m_BTLFeatureM.PBTLParamAdded
' Dim BTLParamVM As BTLParamVM = New BTLParamVM(e.NewBTLParam, m_BTLFeatureM)
' PBTLParamVMList.Add(BTLParamVM)
'End Sub
'Private Sub OnQBTLParamAdded(sender As Object, e As BTLParamAddedEventArgs) Handles m_BTLFeatureM.QBTLParamAdded
' Dim BTLParamVM As BTLParamVM = New BTLParamVM(e.NewBTLParam, m_BTLFeatureM)
' QBTLParamVMList.Add(BTLParamVM)
'End Sub
'Private Sub OnPBTLParamVMListChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
' If Not IsNothing(e.NewItems) AndAlso e.NewItems.Count > 0 Then
' For Each BTLParamVM As BTLParamVM In e.NewItems
' AddHandler BTLParamVM.PropertyChanged, AddressOf OnPBTLParamVMPropertyChanged
' Next
' End If
' If Not IsNothing(e.OldItems) AndAlso e.OldItems.Count > 0 Then
' For Each BTLParamVM As BTLParamVM In e.OldItems
' RemoveHandler BTLParamVM.PropertyChanged, AddressOf OnPBTLParamVMPropertyChanged
' Next
' End If
'End Sub
'Private Sub OnQBTLParamVMListChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
' If Not IsNothing(e.NewItems) AndAlso e.NewItems.Count > 0 Then
' For Each BTLParamVM As BTLParamVM In e.NewItems
' AddHandler BTLParamVM.PropertyChanged, AddressOf OnQBTLParamVMPropertyChanged
' Next
' End If
' If Not IsNothing(e.OldItems) AndAlso e.OldItems.Count > 0 Then
' For Each BTLParamVM As BTLParamVM In e.OldItems
' RemoveHandler BTLParamVM.PropertyChanged, AddressOf OnQBTLParamVMPropertyChanged
' Next
' End If
'End Sub
'Private Sub OnPBTLParamVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
' Select Case e.PropertyName
' Case "dValue", "sValue"
' ' riseleziono questa feature
' SelGeomFeature()
' ' rendo non calcolata questa feature
' CalcFeatureUpdate(False, 0, 0, 0, "")
' End Select
'End Sub
'Private Sub OnQBTLParamVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
' Select Case e.PropertyName
' 'Case "sMATERIAL"
' End Select
'End Sub
#End Region ' EVENTS
End Class
@@ -0,0 +1,252 @@
Public Module ConstBeam
Public Enum BTLParamType As Integer
DOUBLE_ = 1
STRING_ = 2
COMBO = 3
LENGTH = 4
CHECKBOX = 5
End Enum
Public Enum BTLPartParam As Integer
NULL = 0
PDN = 1
NAM = 2
GRP = 3
End Enum
Public Enum GRPType As Integer
L = 0
T = 1
End Enum
Enum MachineType As Integer
NULL = 0
BEAM = 1
WALL = 2
End Enum
Enum CalcStates As Integer
NOTCALCULATED = -1
OK = 0
WARNING = 1
ERROR_ = 2
End Enum
Public Enum Range As Integer
STANDARD = 1
EXTENDED = 2
End Enum
Public Enum PartOffset_RefSideFixClamp As Integer
INACTIVE = 0
REFSIDE1 = 1
REFSIDE2 = 2
REFSIDE3 = 3
REFSIDE4 = 4
End Enum
Public Enum ProcessingQuality As Integer
AUTOMATIC = 1
VISIBLE = 2
FAST = 3
End Enum
Public Enum Recess As Integer
AUTOMATIC = 1
MANUAL = 2
End Enum
Public Enum StoreyType As Integer
CEILING = 1
ROOF = 2
WALL = 3
End Enum
Public Enum AlignmentLocation As Integer
INACTIV = 0
BR = 1
TR = 2
BA = 3
TA = 4
HC = 5
VC = 6
AC = 7
End Enum
Public Enum AlignmentEndtype As Integer
R = 1
A = 2
D = 3
End Enum
Public Enum MaterialType As Integer
INACTIV = 0
BA = 1
CL = 2
MT = 3
ME_ = 4
GB = 5
GF = 6
IN_ = 7
SH = 8
FB = 9
PB = 10
PL = 11
End Enum
Public Enum MoveDirections As Integer
UP = -1
DOWN = 1
End Enum
Public Const BTLFEATURES_FILE_NAME As String = "BTLFeatures.ini"
'Public Const S_GENERAL As String = "General"
'Public Const K_DEBUG As String = "Debug"
Friend Const PROJ As String = "PROJ"
Friend Const FILENAMESEPARATOR As Char = "^"c
Friend Const BTLINFO As String = "BtlInfo"
' info parametri BTL
Friend Const BTL_PRT_PROJ As String = "PROJ"
Friend Const BTL_PRT_PDN As String = "PDN"
Friend Const BTL_PRT_DO As String = "DO"
Friend Const BTL_PRT_NAM As String = "NAM"
Friend Const BTL_PRT_L As String = "L"
Friend Const BTL_PRT_W As String = "W"
Friend Const BTL_PRT_H As String = "H"
Friend Const BTL_PRT_CNT As String = "CNT"
Friend Const BTL_PRT_ROTATED As String = "ROTATED"
Friend Const BTL_PRT_INVERTED As String = "INVERTED"
Friend Const BTL_PRT_MATERIAL As String = "MATERIAL"
' parametri pezzo
Friend Const BTL_PRT_SINGLEMEMBERNUM = "SINGLEMEMBERNUMBER"
Friend Const BTL_PRT_ASSEMBLYNUM = "ASSEMBLYNUMBER"
Friend Const BTL_PRT_ORDERNUM = "ORDERNUMBER"
Friend Const BTL_PRT_DESIGNATION = "DESIGNATION"
Friend Const BTL_PRT_ANNOTATION = "ANNOTATION"
Friend Const BTL_PRT_STOREY = "STOREY"
Friend Const BTL_PRT_GROUP = "GROUP"
Friend Const BTL_PRT_PACKAGE = "PACKAGE"
Friend Const BTL_PRT_TIMBERGRADE = "TIMBERGRADE"
Friend Const BTL_PRT_QUALITYGRADE = "QUALITYGRADE"
Friend Const BTL_PRT_COLOUR = "COLOUR"
Friend Const BTL_PRT_PLANINGLENGTH = "PLANINGLENGTH"
Friend Const BTL_PRT_STARTOFFSET = "STARTOFFSET"
Friend Const BTL_PRT_ENDOFFSET = "ENDOFFSET"
Friend Const BTL_PRT_UID = "UID"
Friend Const BTL_PRT_TRANSFORMATION = "TRANSFORMATION"
Friend Const BTL_PRT_CAMBER = "CAMBER"
Friend Const BTL_PRT_PARTOFFSET = "PARTOFFSET"
Friend Const BTL_PRT_PROCESSINGQUALITY = "PROCESSINGQUALITY"
Friend Const BTL_PRT_RECESS = "RECESS"
Friend Const BTL_PRT_STOREYTYPE = "STOREYTYPE"
Friend Const BTL_PRT_ELEMENTNUM = "ELEMENTNUMBER"
Friend Const BTL_PRT_LAYER = "LAYER"
Friend Const BTL_PRT_MODULENUM = "MODULENUMBER"
'Friend Const BTL_PRT_USERATTRIBUTE = "USERATTRIBUTE"
Friend Const BTL_PRT_COMMENT = "COMMENT"
Friend Const BTL_PRT_GRAINDIR = "GRAINDIRECTION"
Friend Const BTL_PRT_REFSIDE = "REFERENCESIDE"
Friend Const BTL_PRT_ALIGNMENT = "ALIGNMENT"
Friend Const BTL_PRT_MATERIALTYPE = "MATERIALTYPE"
' parametri generici
Friend Const BTL_GEN_PROJNUM = "PROJECTNUMBER"
Friend Const BTL_GEN_PROJNAME = "PROJECTNAME"
Friend Const BTL_GEN_PROJPART = "PROJECTPART"
Friend Const BTL_GEN_PROJGUID = "PROJECTGUID"
Friend Const BTL_GEN_LISTNAME = "LISTNAME"
Friend Const BTL_GEN_CUSTOMER = "CUSTOMER"
Friend Const BTL_GEN_ARCHITECT = "ARCHITECT"
Friend Const BTL_GEN_EDITOR = "EDITOR"
Friend Const BTL_GEN_DELIVDATE = "DELIVERYDATE"
Friend Const BTL_GEN_EXPDATE = "EXPORTDATE"
Friend Const BTL_GEN_EXPTIME = "EXPORTTIME"
Friend Const BTL_GEN_EXPRELEASE = "EXPORTRELEASE"
Friend Const BTL_GEN_LANGUAGE = "LANGUAGE"
Friend Const BTL_GEN_RANGE = "RANGE"
Friend Const BTL_GEN_COMPUTERNAME = "COMPUTERNAME"
Friend Const BTL_GEN_USER = "USER"
Friend Const BTL_GEN_SRCFILE = "SOURCEFILE"
Friend Const BTL_GEN_EXPFILE = "EXPORTFILE"
Friend Const BTL_GEN_USERATTRIBUTE = "USERATTRIBUTE"
Friend Const PROCESSINGS As String = "Processings"
Friend Const OUTLINE As String = "Outline"
Friend Const BTL_FTR_GRP As String = "GRP"
Friend Const BTL_FTR_PRC As String = "PRC"
Friend Const BTL_FTR_DO As String = "DO"
Friend Const BTL_FTR_SIDE As String = "SIDE"
Friend Const BTL_FTR_NAME As String = "NAME"
Friend Const BTL_FTR_DES As String = "DES"
Friend Const BTL_FTR_PRID As String = "PRID"
Friend Const BTL_FTR_FRAME As String = "FRAME"
' parametri machgroup grezzi
Friend Const MGR_RPT_ID As String = "ID"
Friend Const MGR_RPT_L As String = "L"
Friend Const MGR_RPT_W As String = "W"
Friend Const MGR_RPT_H As String = "H"
Friend Const MGR_RPT_WASTE As String = "WASTE"
Friend Const MGR_RPT_USAGE As String = "USAGE"
Friend Const MGR_RPT_STARTCUT As String = "STARTCUT"
Friend Const MGR_RPT_MATERIAL As String = "MATERIAL"
Friend Const MGR_PRT_PDN As String = "PDN"
Friend Const MGR_PRT_L As String = "L"
Friend Const MGR_PRT_W As String = "W"
Friend Const MGR_PRT_H As String = "H"
Friend Const MGR_PRT_DES As String = "DES"
Friend Const MGR_PRT_STARTCUT As String = "STARTCUT"
Friend Const MGR_PRT_MATERIAL As String = "MATERIAL"
Friend Const MGR_FTR_GRP As String = "GRP"
Friend Const MGR_FTR_PRC As String = "PRC"
Friend Const MGR_FTR_DO As String = "DO"
Friend Const MGR_FTR_SIDE As String = "SIDE"
Friend Const MGR_FTR_NAME As String = "NAME"
Friend Const MGR_FTR_DES As String = "DES"
Friend Const MGR_FTR_PRID As String = "PRID"
Friend Const MGR_FTR_FRAME As String = "FRAME"
' parametri creazione barre
Friend Const MGR_RPT_BARLEN As String = "BARLEN"
Friend Const MGR_RPT_BARHEIGHT As String = "BARHEIGHT"
Friend Const MGR_RPT_BARWIDTH As String = "BARWIDTH"
Friend Const MGR_RPT_PANELLEN As String = "PANELLEN"
Friend Const MGR_RPT_PANELWIDTH As String = "PANELWIDTH"
Friend Const MGR_RPT_PANELHEIGHT As String = "PANELHEIGHT"
Friend Const MGR_RPT_PART As String = "PART"
' parametri errori integration
Friend Const ITG_CUTID As String = "CUTID"
Friend Const ITG_TASKID As String = "TASKID"
Friend Const ITG_PROJ_ERR As String = "PROJ_ERR"
Friend Const ITG_PROJ_MSG As String = "PROJ_MSG"
Friend Const ITG_PROJ_ROT As String = "PROJ_ROT"
Friend Const ITG_PROJ_FALL As String = "PROJ_FALL"
Friend Const ITG_PROJ_TIME As String = "PROJ_TIME"
' parametri errori integration
Friend Const ITG_PROD_ERR As String = "PROD_ERR"
Friend Const ITG_PROD_MSG As String = "PROD_MSG"
Friend Const ITG_PROD_ROT As String = "PROD_ROT"
Friend Const ITG_PROD_TIME As String = "PROD_TIME"
' parametri errori integration
Friend Const DUPLO_TODELETE As String = "DUPLO_TODELETE"
' parametri warehouse
Friend Const WRH_BEAM As String = "BEAM"
Friend Const WRH_WALL As String = "WALL"
Friend Const WRH_CURRENT As String = "Current"
Friend Const WRH_STARTOFFSET As String = "StartOffset"
Friend Const WRH_OFFSET As String = "Offset"
Friend Const WRH_L As String = "L"
Friend Const WRH_KERF As String = "Kerf"
Friend Const WRH_S As String = "S"
End Module
@@ -0,0 +1,87 @@
'----------------------------------------------------------------------------
' EgalTech 2015-2017
'----------------------------------------------------------------------------
' File : ConstGen.vb Data : 10.04.17 Versione : 1.8d1
' Contenuto : Modulo costanti generali.
'
'
'
' Modifiche : 10.04.17 DS Creazione modulo.
'
'
'----------------------------------------------------------------------------
Module ConstGen
' File con direttorio radice dei dati
Public Const DAT_FILE_NAME As String = "DataRoot.Ini"
Public Const S_DATA As String = "Data"
Public Const K_DATAROOT As String = "DataRoot"
' File con dati di licenza
Public Const LIC_FILE_NAME As String = "EgtBEAMWALL.lic"
Public Const S_LICENCE As String = "Licence"
Public Const K_KEY As String = "Key"
Public Const K_NESTKEY As String = "NestKey"
' Pagine del programma
Public Enum Pages As Integer
VIEW = 0
MACHINING = 1
SUPERVISOR = 2
CONFIG = 3
End Enum
' Abilitazioni licenza
Friend Enum KEY_OPT As UInteger
CUT_BASE = 1 ' Prodotto OmagCUT
MAN_MANIP = 2
AUTO_MANIP = 4
MAN_PHOTO = 8
AUTO_PHOTO = 16
AUTO_NESTING = 32
ENABLE_MILL = 64
PROCUCTION_LINE = 128
OFFICE_BASE = 256 ' Prodotto OmagOFFICE
VM_MULTI = 512
UNDER_CUT = 1024
CSV_SIMPLE = 2048
PHOTO_BASE = 4096 ' Prodotto OmagPHOTO
TRF_IMPORT = 8192
MOVE_PARTS = 16384
IMPORT_SLABDXF = 32768
CURVED_FRAME = 65536
ENABLE_WJ = 131072
End Enum
' File di log generale
Public Const GENLOG_FILE_NAME As String = "EgtBEAMWALLLog#.txt"
' Sottodirettorio di configurazione
Public Const CONF_DIR As String = "Config"
' Sottodirettorio delle risorse
Public Const RES_DIR As String = "Resources"
' Sottodirettorio temporaneo
Public Const TEMP_DIR As String = "Temp"
' Sottodirettorio per Cam automatico
Public Const PROJS_DIR As String = "Projs"
' Sottodirettorio per Csv automatico
Public Const PRODS_DIR As String = "Prods"
' Sottodirettorio per Macro
Public Const MACRO_DIR As String = "Macro"
' Sottodirettorio per Magazzino
Public Const WAREHOUSE_DIR As String = "Warehouse"
' Sottodirettorio per lavorazioni travi
Public Const BEAM_DIR As String = "Beam"
' Sottodirettorio per lavorazioni pareti
Public Const WALL_DIR As String = "Wall"
' Sottodirettorio di default per il salvataggio con nome
Public Const SAVE_DFL_NAMEDIR As String = "MyProjects"
' Sottodirettorio di default per le macchine
Public Const MACHINES_DFL_DIR As String = "Machines"
' Sottodirettorio di default per toolmakers
Public Const TOOLMAKERS_DFL_DIR As String = "ToolMakers"
' Nome file Lua con le funzioni di attrezzaggio
Public Const SETUP_LUA As String = "SetUp.lua"
End Module
@@ -0,0 +1,112 @@
'----------------------------------------------------------------------------
' EgalTech 2015-2015
'----------------------------------------------------------------------------
' File : ConstIni.vb Data : 12.02.15 Versione : 1.6b3
' Contenuto : Modulo costanti sezione e chiavi per file Ini.
'
'
'
' Modifiche : 12.02.15 DS Creazione modulo.
'
'
'----------------------------------------------------------------------------
Module ConstIni
Public Const INI_FILE_NAME As String = "EgtBEAMWALL.ini"
Public Const S_GENERAL As String = "General"
Public Const K_DEBUG As String = "Debug"
Public Const K_LICENCE As String = "Licence"
Public Const K_USERLEVEL As String = "UserLevel"
Public Const K_MAXINST As String = "MaxInstances"
Public Const K_INSTANCES As String = "Instances"
Public Const K_COMMANDLOG As String = "CommandLog"
Public Const K_MESSAGESDIR As String = "MessagesDir"
Public Const K_MESSAGES As String = "Messages"
Public Const K_WINPLACE As String = "WinPlace"
Public Const K_MMUNITS As String = "MmUnits"
Public Const K_LASTPROJ As String = "LastProj"
Public Const K_AUTOLOADLASTPROJ As String = "AutoLoadLastProj"
Public Const K_LASTIMPDIR As String = "LastImpDir"
Public Const K_PROJSINDEX As String = "ProjsIndex"
Public Const K_PRODSINDEX As String = "ProdsIndex"
Public Const K_SUPPORT As String = "Support"
Public Const K_WAREHOUSE As String = "Warehouse"
Public Const S_LANGUAGES As String = "Languages"
Public Const K_LANGUAGE As String = "Language"
Public Const S_LUA As String = "Lua"
Public Const K_LIBSDIR As String = "LibsDir"
Public Const K_BASELIB As String = "BaseLib"
Public Const S_GEOMDB As String = "GeomDB"
Public Const K_DEFAULTFONT As String = "DefaultFont"
Public Const K_NFEFONTDIR As String = "NfeFontDir"
Public Const K_DEFAULTCOLOR As String = "DefaultColor"
Public Const K_SAVETYPE As String = "SaveType"
Public Const S_OPENGL As String = "OpenGL"
Public Const K_DOUBLEBUFFER As String = "DoubleBuffer"
Public Const K_COLORBITS As String = "ColorBits"
Public Const K_DEPTHBITS As String = "DepthBits"
Public Const K_DRIVER As String = "Driver"
Public Const S_SCENE As String = "Scene"
Public Const K_BACKTOP As String = "BackTop"
Public Const K_BACKBOTTOM As String = "BackBottom"
Public Const K_SHOWGFRAME As String = "ShowGFrame"
Public Const K_MARK As String = "Mark"
Public Const K_SELSURF As String = "SelSurf"
Public Const K_SHOWMODE As String = "ShowMode"
Public Const K_CURVEDIR As String = "CurveDir"
Public Const K_SHOWTRIAADV As String = "ShowTriaAdv"
Public Const K_SHOWZMAP As String = "ShowZmap"
Public Const K_TEXMAXLINPIX As String = "TextureMaxLinPixels"
Public Const K_ZOOMWIN As String = "ZoomWin"
Public Const K_DISTLINE As String = "DistLine"
Public Const S_GRID As String = "Grid"
Public Const K_SHOWGRID As String = "ShowGrid"
Public Const K_SHOWFRAME As String = "ShowFrame"
Public Const K_SNAPSTEP As String = "SnapStep"
Public Const K_SNAPSTEPINCH As String = "SnapStepInch"
Public Const K_MINLINESSTEP As String = "MinLineSStep"
Public Const K_MAJLINESSTEP As String = "MajLineSStep"
Public Const K_EXTSSTEP As String = "ExtSStep"
Public Const K_MINLNCOLOR As String = "MinLnColor"
Public Const K_MAJLNCOLOR As String = "MajLnColor"
Public Const S_IMPORT As String = "Import"
Public Const K_BTLFLAG As String = "BtlFlag"
Public Const S_MACH As String = "Mach"
Public Const K_MACHINESDIR As String = "MachinesDir"
Public Const K_TOOLMAKERSDIR As String = "ToolMakersDir"
Public Const K_CURRMACH As String = "CurrMach"
Public Const K_PASSWORD As String = "Password"
Public Const S_SIMUL As String = "Simul"
Public Const K_SLIDERX As String = "SliderX"
Public Const K_SLIDERVAL As String = "SliderVal"
Public Const S_BEAM As String = "Beam"
Public Const K_CALCPATH As String = "CalcPath"
Public Const K_BEAMBASEDIR As String = "BaseDir"
Public Const K_BEAMBWEEXEC As String = "BweExec"
Public Const S_WALL As String = "Wall"
Public Const K_WALLBASEDIR As String = "BaseDir"
Public Const K_WALLBWEEXEC As String = "BweExec"
Public Const S_NEST As String = "Nest"
Public Const K_NESTDIR As String = "NestDir"
Public Const K_NESTEXEC As String = "NestExec"
Public Const S_BEAMWALL As String = "BeamWall"
Public Const K_BEAMWALLENABLE As String = "BtlEnable"
Public Const K_BEAMWALLBASEDIR As String = "BaseDir"
Public Const K_BEAMWALLBUTTON As String = "Button"
End Module
@@ -0,0 +1,8 @@
Module ConstMachIni
Public Const MACH_INI_FILE_NAME As String = "MachData.ini"
Public Const K_BEAM As String = "Beam"
Public Const K_NAME As String = "Name"
End Module
@@ -0,0 +1,54 @@
Module ConstMsg
Public Const MSG_SETUPERRORS As Integer = 5000 + 1470
Public Const MSG_MISSINGKEYWD As Integer = 10100
Public Const MSG_NUMERICKEYBOARDWD As Integer = 10200
Public Const MSG_MESSAGEBOX As Integer = 15000
Public Const MSG_EGTSAVEFILEDIALOG As Integer = 30000
Public Const MSG_OMAGCUT As Integer = 90000
Public Const MSG_GENERAL As Integer = MSG_OMAGCUT
Public Const MSG_WORKINPROGRESSPAGEUC As Integer = MSG_OMAGCUT + 100
Public Const MSG_DIRECTCUTPAGEUC As Integer = MSG_OMAGCUT + 200
Public Const MSG_MANUALAXESMOVEPAGEUC As Integer = MSG_OMAGCUT + 220
Public Const MSG_CADCUTPAGEUC As Integer = MSG_OMAGCUT + 300
Public Const MSG_NESTPAGEUC As Integer = MSG_OMAGCUT + 330
Public Const MSG_SPLITPAGEUC As Integer = MSG_OMAGCUT + 340
Public Const MSG_MOVERAWPAGEUC As Integer = MSG_OMAGCUT + 360
Public Const MSG_DRAWPAGEUC As Integer = MSG_OMAGCUT + 380
Public Const MSG_COMPONENTPAGEUC As Integer = MSG_OMAGCUT + 400
Public Const MSG_IMPORTPAGEUC As Integer = MSG_OMAGCUT + 450
Public Const MSG_OPENPAGEUC As Integer = MSG_OMAGCUT + 490
Public Const MSG_RAWPARTPAGEUC As Integer = MSG_OMAGCUT + 500
Public Const MSG_CHOOSEMACHININGPAGEUC As Integer = MSG_OMAGCUT + 535
Public Const MSG_SIMULATIONPAGEUC As Integer = MSG_OMAGCUT + 550
Public Const MSG_FRAMECUTPAGEUC As Integer = MSG_OMAGCUT + 600
Public Const MSG_MACHINEPAGEUC As Integer = MSG_OMAGCUT + 700
Public Const MSG_TOOLSDBPAGEUC As Integer = MSG_OMAGCUT + 720
Public Const MSG_MACHININGSDBPAGEUC As Integer = MSG_OMAGCUT + 760
Public Const MSG_COMBOBOXPARAM As Integer = MSG_OMAGCUT + 800
Public Const MSG_ALARMSPAGEUC As Integer = MSG_OMAGCUT + 900
Public Const MSG_MACHINECNPAGEUC As Integer = MSG_OMAGCUT + 950
Public Const MSG_OPTIONSPAGEUC As Integer = MSG_OMAGCUT + 980
Public Const MSG_EGTMSGBOX As Integer = MSG_OMAGCUT + 1100
Public Const MSG_CSVPAGEUC As Integer = MSG_OMAGCUT + 1200
Public Const MSG_OMAGOFFICE As Integer = 91400
Public Const MSG_OPTIONPANEL As Integer = MSG_OMAGOFFICE
Public Const MSG_MYMACHININGDBWINDOW As Integer = MSG_OMAGOFFICE + 50
Public Const MSG_TOPCMDBAR As Integer = MSG_OMAGOFFICE + 100
Public Const MSG_RAWPARTTAB As Integer = MSG_OMAGOFFICE + 150
Public Const MSG_VEINMATCHING As Integer = MSG_OMAGOFFICE + 200
Public Const MSG_GENERIC As Integer = MSG_OMAGOFFICE + 250
Public Const MSG_EGTWPFLIB5 As Integer = 30000
Public Const MSG_TOPCOMMANDBAR As Integer = MSG_EGTWPFLIB5 + 500
Public Const MSG_GRIDVIEWPANEL As Integer = MSG_EGTWPFLIB5 + 800
Public Const MSG_TOOLDB As Integer = MSG_EGTWPFLIB5 + 1000
Public Const MSG_TOOLDBERRORS As Integer = MSG_EGTWPFLIB5 + 1100
Public Const MSG_MACHININGDB As Integer = MSG_EGTWPFLIB5 + 1200
Public Const MSG_MACHININGDBERRORS As Integer = MSG_EGTWPFLIB5 + 1400
Public Const MSG_SIMULATION As Integer = MSG_EGTWPFLIB5 + 1600
End Module
@@ -0,0 +1,16 @@
Module ConstWarehouseIni
Public Const WH_BASIC_INI_FILE_NAME As String = "Basic.ini"
Public Const WH_MEDIUM_INI_FILE_NAME As String = "Medium.ini"
'Public Const S_BEAM As String = "Beam"
'Public Const S_WALL As String = "Wall"
Public Const K_CURRENTL As String = "CurrentL"
Public Const K_CURRENTS As String = "CurrentS"
Public Const K_STARTOFFSET As String = "StartOffset"
Public Const K_KERF As String = "Kerf"
Public Const K_OFFSET As String = "Offset"
Public Const K_L As String = "L"
Public Const K_S As String = "S"
End Module
@@ -114,6 +114,8 @@
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System" />
@@ -125,18 +127,68 @@
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="Application.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="BTLParam\BTLFeatureVM.vb" />
<Compile Include="Constants\ConstBeam.vb" />
<Compile Include="Constants\ConstGen.vb" />
<Compile Include="Constants\ConstIni.vb" />
<Compile Include="Constants\ConstMachIni.vb" />
<Compile Include="Constants\ConstMsg.vb" />
<Compile Include="Constants\ConstWarehouseIni.vb" />
<Compile Include="MachGroupPanel\BeamMachGroupVM.vb" />
<Compile Include="MachGroupPanel\BeamVM.vb" />
<Compile Include="MachGroupPanel\MyMachGroupPanelVM.vb" />
<Compile Include="MachGroupPanel\MyMachGroupVM.vb" />
<Compile Include="MachGroupPanel\PartVM.vb" />
<Compile Include="MachGroupPanel\WallMachGroupVM.vb" />
<Compile Include="MachGroupPanel\WallVM.vb" />
<Compile Include="MachinePanel\MachinePanelV.xaml.vb">
<DependentUpon>MachinePanelV.xaml</DependentUpon>
</Compile>
<Compile Include="MachinePanel\MachinePanelVM.vb" />
<Compile Include="MainWindow\MainWindowM.vb" />
<Compile Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml.vb">
<DependentUpon>OpenProjectFileDialogV.xaml</DependentUpon>
</Compile>
<Compile Include="OpenProjectFileDialog\OpenProjectFileDialogVM.vb" />
<Compile Include="ProjectManager\ProdFileVM.vb" />
<Compile Include="ProjectManager\ProjectFileVM.vb" />
<Compile Include="Project\ProjectV.xaml.vb">
<DependentUpon>ProjectV.xaml</DependentUpon>
</Compile>
<Compile Include="Project\ProjectVM.vb" />
<Compile Include="SceneHost\MySceneHostVM.vb" />
<Compile Include="SceneHost\SceneHostV.xaml.vb">
<DependentUpon>SceneHostV.xaml</DependentUpon>
</Compile>
<Compile Include="ShowPanel\ShowPanelV.xaml.vb">
<DependentUpon>ShowPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="SupervisorManager\SupervisorManagerV.xaml.vb">
<DependentUpon>SupervisorManagerV.xaml</DependentUpon>
</Compile>
<Compile Include="SupervisorManager\SupervisorManagerVM.vb" />
<Compile Include="Utility\Command.vb" />
<Compile Include="Utility\CurrentMachine.vb" />
<Compile Include="Utility\DbControllers.vb" />
<Compile Include="Utility\Dictionary.xaml.vb">
<DependentUpon>Dictionary.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\Map.vb" />
<Compile Include="Utility\VMBase.vb" />
<Compile Include="ViewPanel\ViewPanelV.xaml.vb">
<DependentUpon>ViewPanelV.xaml</DependentUpon>
</Compile>
<Page Include="MachinePanel\MachinePanelV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainWindow\MainWindowV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -149,10 +201,34 @@
<DependentUpon>MainWindowV.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="OpenProjectFileDialog\OpenProjectFileDialogV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Project\ProjectV.xaml">
<SubType>Designer</SubType>
<Generator>XamlIntelliSenseFileGenerator</Generator>
</Page>
<Page Include="SceneHost\SceneHostV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ShowPanel\ShowPanelV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SupervisorManager\SupervisorManagerV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Utility\Dictionary.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ViewPanel\ViewPanelV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Import Include="System.Linq" />
@@ -217,6 +293,37 @@
<Resource Include="Resources\EgtBEAMWALL.ico" />
<Resource Include="Resources\TreeView\Folder.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\ProjectManager\DxfOut.png" />
<Resource Include="Resources\ProjectManager\Export.png" />
<Resource Include="Resources\ProjectManager\Import.png" />
<Resource Include="Resources\ProjectManager\New.png" />
<Resource Include="Resources\ProjectManager\Open.png" />
<Resource Include="Resources\ProjectManager\Options.png" />
<Resource Include="Resources\ProjectManager\Save.png" />
<Resource Include="Resources\ProjectManager\SaveAs.png" />
<Resource Include="Resources\ProjectManager\Send.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\ShowPanel\RenderingHL.png" />
<Resource Include="Resources\ShowPanel\RenderingSH.png" />
<Resource Include="Resources\ShowPanel\RenderingWF.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\ViewPanel\LookFromBACK.png" />
<Resource Include="Resources\ViewPanel\LookFromBOTTOM.png" />
<Resource Include="Resources\ViewPanel\LookFromFRONT.png" />
<Resource Include="Resources\ViewPanel\LookFromISO_NE.png" />
<Resource Include="Resources\ViewPanel\LookFromISO_NW.png" />
<Resource Include="Resources\ViewPanel\LookFromISO_SE.png" />
<Resource Include="Resources\ViewPanel\LookFromISO_SW.png" />
<Resource Include="Resources\ViewPanel\LookFromLEFT.png" />
<Resource Include="Resources\ViewPanel\LookFromRIGHT.png" />
<Resource Include="Resources\ViewPanel\LookFromTOP.png" />
<Resource Include="Resources\ViewPanel\ZoomAll.png" />
<Resource Include="Resources\ViewPanel\ZoomIn.png" />
<Resource Include="Resources\ViewPanel\ZoomOut.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
@@ -0,0 +1,49 @@
<EgtFloating:EgtFloatingPanel x:Class="InstrumentPanelV"
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" Style="{StaticResource ToolBar_EgtFloatingPanel}">
<ToggleButton ToolTip="{Binding GetDistToolTip}"
Style="{StaticResource ToolBar_ToggleButton}"
IsChecked="{Binding GetDistIsChecked}">
<Image Source="/Resources/InstrumentPanel/GetDist.png" Stretch="Uniform"/>
</ToggleButton>
<Button Content="D"
FontSize="20"
FontWeight="Light"
ToolTip="{Binding GetDistToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding Data_Command}">
<!--<Image Source="/Resources/InstrumentPanel/Analyze.png" Stretch="Uniform"/>-->
</Button>
<Button Content="C"
FontSize="20"
FontWeight="Light"
ToolTip="{Binding GetDistToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding ChangeParameter_Command}">
<!--<Image Source="/Resources/InstrumentPanel/Analyze.png" Stretch="Uniform"/>-->
</Button>
<Button Content="V"
FontSize="20"
FontWeight="Light"
ToolTip="{Binding GetDistToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding Verify_Command}">
<!--<Image Source="/Resources/InstrumentPanel/Analyze.png" Stretch="Uniform"/>-->
</Button>
<Button Content="S"
FontSize="20"
FontWeight="Light"
ToolTip="{Binding GetDistToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding Simulate_Command}">
<!--<Image Source="/Resources/InstrumentPanel/Analyze.png" Stretch="Uniform"/>-->
</Button>
</EgtFloating:EgtFloatingPanel>
@@ -0,0 +1,3 @@
Public Class InstrumentPanelV
End Class
@@ -0,0 +1,299 @@
Imports System.Collections.ObjectModel
Imports EgtWPFLib5
Imports EgtBEAMWALL.Core
Public Class MyInstrumentPanelVM
Inherits InstrumentPanelVM
' Definizione comandi
Private m_cmdData As ICommand
Private m_cmdChangeParameter As ICommand
Private m_cmdVerify As ICommand
Private m_cmdSimulate As ICommand
Public Overrides Function OnPostGetDistIsChecked() As Boolean
Map.refSceneHostVM.MainScene.SetStatusNull()
Return True
End Function
#Region "COMMANDS"
#Region "Data"
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public ReadOnly Property Data_Command As ICommand
Get
If m_cmdData Is Nothing Then
m_cmdData = New Command(AddressOf Data)
End If
Return m_cmdData
End Get
End Property
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Friend Sub Data()
Dim BTLDataWnd As New BTLDataWndV(Application.Current.MainWindow, New BTLDataWndVM())
BTLDataWnd.ShowDialog()
End Sub
#End Region ' Data
#Region "ChangeParameter"
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public ReadOnly Property ChangeParameter_Command As ICommand
Get
If m_cmdChangeParameter Is Nothing Then
m_cmdChangeParameter = New Command(AddressOf ChangeParameter)
End If
Return m_cmdChangeParameter
End Get
End Property
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Friend Sub ChangeParameter()
Dim ChangeParameterWndVM As New ChangeParameterWndVM
Dim ChangeParameterWnd As New ChangeParameterWndV(Application.Current.MainWindow, ChangeParameterWndVM)
If ChangeParameterWnd.ShowDialog() Then
' faccio passare pezzi
If Not IsNothing(ChangeParameterWndVM.SelParam) Then
For Each Part In Map.refProjectVM.BTLStructureVM.BTLPartVMList
For Each Feature In Part.BTLFeatureVMList.Where(Function(x) x.nPRC = ChangeParameterWndVM.SelPRC.nPRC AndAlso CalcBeamPrivateProfileGRP(x.nSelGRP) = ChangeParameterWndVM.SelPRC.nGRP)
If ChangeParameterWndVM.SelParam.BTLParamM.nType = BTLParamType.CHECKBOX AndAlso Feature.bDO = ChangeParameterWndVM.SelParam.bActualValue Then
Feature.bDO = ChangeParameterWndVM.SelParam.bNewValue
Else
Dim ParamList As ObservableCollection(Of BTLParamVM)
If ChangeParameterWndVM.SelParam.BTLParamM.bIsP Then
ParamList = Feature.PBTLParamVMList
Else
ParamList = Feature.QBTLParamVMList
End If
For Each Param In ParamList.Where(Function(x) x.sName = ChangeParameterWndVM.SelParam.sName)
Select Case Param.nType
Case BTLParamType.DOUBLE_, BTLParamType.LENGTH
If Param.dValue = ChangeParameterWndVM.SelParam.dActualValue Then
Param.UpdateParamValue(ChangeParameterWndVM.SelParam.dNewValue, "")
'' rinfresco valori parametri feature correntemente selezionata
'If Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart) AndAlso
' Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM) AndAlso
' Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM Is Feature Then
' Param.NotifyPropertyChanged("sValue")
'End If
End If
Case BTLParamType.STRING_
If Param.sValue = ChangeParameterWndVM.SelParam.sActualValue Then
Param.UpdateParamValue(0, ChangeParameterWndVM.SelParam.sNewValue)
'' rinfresco valori parametri feature correntemente selezionata
'If Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart) AndAlso
' Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM) AndAlso
' Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM.nPRC = ChangeParameterWndVM.SelPRC.nPRC AndAlso
' Map.refProjectVM.BTLStructureVM.SelBTLPart.SelBTLFeatureVM.nSelGRP = ChangeParameterWndVM.SelPRC.nGRP Then
' Param.NotifyPropertyChanged("sValue")
'End If
End If
End Select
Next
End If
Next
'' faccio passare feature
'For Each Feature In Part.FeatureList
' If Feature.nPRC = ChangeParameterWndVM.SelPRC.nPRC Then
' For Each Param In Feature.PParamList
' If Param.sName = ChangeParameterWndVM.SelParam.sName Then
' Select Case Param.nType
' Case BTLParamType.DOUBLE_, BTLParamType.LENGTH
' If Param.dValue = ChangeParameterWndVM.SelParam.dActualValue Then
' Param.dValue = ChangeParameterWndVM.SelParam.dValue
' End If
' Case BTLParamType.STRING_
' If Param.sValue = ChangeParameterWndVM.SelParam.sActualValue Then
' Param.sValue = ChangeParameterWndVM.SelParam.sValue
' End If
' End Select
' End If
' Next
' End If
'Next
Next
End If
End If
End Sub
#End Region ' ChangeParameter
#Region "Verify"
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public ReadOnly Property Verify_Command As ICommand
Get
If m_cmdVerify Is Nothing Then
m_cmdVerify = New Command(AddressOf Verify)
End If
Return m_cmdVerify
End Get
End Property
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Friend Sub Verify()
Dim Calc As New CalcIntegration
Dim BarList() As CalcIntegration.Bar
If Map.refMainMenuVM.SelPage = Pages.VIEW Then
If ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift) Then
Dim TempBarList(Map.refProjectVM.BTLStructureVM.BTLPartVMList.Count - 1) As CalcIntegration.Bar
For PartIndex = 0 To Map.refProjectVM.BTLStructureVM.BTLPartVMList.Count - 1
Dim CurrPart As BTLPartVM = Map.refProjectVM.BTLStructureVM.BTLPartVMList(PartIndex)
Dim Bar As New CalcIntegration.Bar With {.nBarId = CurrPart.nPartId,
.nBarType = ProjectType.PROJ,
.bBarOk = True}
Select Case CurrPart.nState
Case Core.CalcStates.OK
Bar.nCmdType = CalcIntegration.CmdType.GENERATE
Case Else
Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN
End Select
TempBarList(PartIndex) = Bar
Next
BarList = TempBarList
ElseIf Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart) Then
Dim TempBarList(0) As CalcIntegration.Bar
Dim Bar As New CalcIntegration.Bar With {.nBarId = Map.refProjectVM.BTLStructureVM.SelBTLPart.nPartId,
.nBarType = ProjectType.PROJ,
.bBarOk = True}
Select Case Map.refProjectVM.BTLStructureVM.SelBTLPart.nState
Case Core.CalcStates.OK
Bar.nCmdType = CalcIntegration.CmdType.GENERATE
Case Else
Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN
End Select
TempBarList(0) = Bar
BarList = TempBarList
Else
Return
End If
Calc.Run(BarList, Map.refProjManagerVM.CurrProj.sProjDirPath, AddressOf ManageCalc)
ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then
If ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift) Then
Dim TempBarList(Map.refMachGroupPanelVM.MachGroupVMList.Count - 1) As CalcIntegration.Bar
For PartIndex = 0 To Map.refMachGroupPanelVM.MachGroupVMList.Count - 1
Dim CurrPart As MyMachGroupVM = Map.refMachGroupPanelVM.MachGroupVMList(PartIndex)
Dim Bar As New CalcIntegration.Bar With {.nBarId = CurrPart.Id,
.nBarType = ProjectType.PROD,
.bBarOk = True}
Select Case CurrPart.nState
Case Core.CalcStates.OK
Bar.nCmdType = CalcIntegration.CmdType.GENERATE
Case Else
Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN
End Select
TempBarList(PartIndex) = Bar
Next
BarList = TempBarList
ElseIf Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
Dim TempBarList(0) As CalcIntegration.Bar
Dim Bar As New CalcIntegration.Bar With {.nBarId = Map.refMachGroupPanelVM.SelectedMachGroup.Id,
.nBarType = ProjectType.PROD,
.bBarOk = True}
Dim SelMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup
Select Case SelMachGroup.nState
Case Core.CalcStates.OK
Bar.nCmdType = CalcIntegration.CmdType.GENERATE
Case Else
Bar.nCmdType = CalcIntegration.CmdType.CHECKGEN
End Select
TempBarList(0) = Bar
BarList = TempBarList
Else
Return
End If
Calc.Run(BarList, Map.refProdManagerVM.CurrProd.sProdDirPath, AddressOf ManageCalc)
End If
End Sub
Private Sub ManageCalc(dProgress As Double, sProgress As String, ByRef bCancel As Boolean)
If dProgress = 0 Then
Map.refMyStatusBarVM.SetLoadingProgress_Visibility(True)
Map.refMyStatusBarVM.SetStopProgress_IsActive(True)
Map.refMyStatusBarVM.SetStopProgress_IsEnabled(True)
Map.refMyStatusBarVM.SetOutputMessage(sProgress)
Map.refMyStatusBarVM.SetStopProgress_IsActive(True)
Map.refMyStatusBarVM.SetStopProgress_IsEnabled(True)
ElseIf dProgress = 1 Then
Map.refMyStatusBarVM.SetLoadingProgress_Visibility(False)
Map.refMyStatusBarVM.SetStopProgress_IsActive(False)
Map.refMyStatusBarVM.SetStopProgress_IsEnabled(False)
Map.refMyStatusBarVM.SetOutputMessage(sProgress, 3)
End If
bCancel = Map.refMyStatusBarVM.bStopProgress
Map.refMyStatusBarVM.SetLoadingProgress(dProgress * 100)
Map.refMyStatusBarVM.SetOutputMessage(sProgress)
End Sub
#End Region ' Verify
#Region "Simulate"
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public ReadOnly Property Simulate_Command As ICommand
Get
If m_cmdSimulate Is Nothing Then
m_cmdSimulate = New Command(AddressOf Simulate)
End If
Return m_cmdSimulate
End Get
End Property
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Friend Sub Simulate()
Dim Calc As New CalcIntegration
Dim BarList() As CalcIntegration.Bar
If Map.refMainMenuVM.SelPage = Pages.VIEW Then
If Not IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart) Then
Dim TempBarList(0) As CalcIntegration.Bar
Dim Bar As New CalcIntegration.Bar With {.nBarId = Map.refProjectVM.BTLStructureVM.SelBTLPart.nPartId,
.nBarType = ProjectType.PROJ,
.bBarOk = True,
.nCmdType = CalcIntegration.CmdType.SIMULATE}
TempBarList(0) = Bar
BarList = TempBarList
Else
Return
End If
Calc.Run(BarList, Map.refProjManagerVM.CurrProj.sProjDirPath, AddressOf ManageCalc)
ElseIf Map.refMainMenuVM.SelPage = Pages.MACHINING Then
If Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
Dim TempBarList(0) As CalcIntegration.Bar
Dim Bar As New CalcIntegration.Bar With {.nBarId = Map.refMachGroupPanelVM.SelectedMachGroup.Id,
.nBarType = ProjectType.PROD,
.bBarOk = True,
.nCmdType = CalcIntegration.CmdType.SIMULATE}
TempBarList(0) = Bar
BarList = TempBarList
Else
Return
End If
Calc.Run(BarList, Map.refProdManagerVM.CurrProd.sProdDirPath, AddressOf ManageCalc)
End If
End Sub
#End Region ' Simulate
#End Region ' COMMANDS
End Class
@@ -0,0 +1,284 @@
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.ComponentModel
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class BeamMachGroupVM
Inherits MyMachGroupVM
Public ReadOnly Property m_BeamMachGroupM As BeamMachGroupM
Get
Return m_MachGroupM
End Get
End Property
Public Property sStartCut As String
Get
Return LenToString(m_BeamMachGroupM.dStartCut, 3)
End Get
Set(value As String)
Dim dValue As Double
If StringToLen(value, dValue) Then
Dim dOldValue As Double = m_BeamMachGroupM.dStartCut
m_BeamMachGroupM.dStartCut = dValue
If Not ReDrawBeamMachgroup() Then
' rispristino vecchio valore
m_BeamMachGroupM.dStartCut = dOldValue
ReDrawBeamMachgroup()
End If
m_BeamMachGroupM.dStartCut = dValue
EgtDraw()
If PartVMList.Count > 0 Then
Dim Beam As BeamVM = DirectCast(PartVMList(0), BeamVM)
Beam.UpdateOffset()
Beam.NotifyPropertyChanged("sOffset")
End If
Else
NotifyPropertyChanged("sStartCut")
End If
End Set
End Property
Public Property dStartCut As Double
Get
Return m_BeamMachGroupM.dStartCut
End Get
Set(value As Double)
m_BeamMachGroupM.dStartCut = value
End Set
End Property
Public Property SelBeam As BeamVM
Get
Return m_SelPart
End Get
Set(value As BeamVM)
m_SelPart = value
End Set
End Property
' definizione comandi
Private m_cmdDeleteMachGroup As ICommand
Sub New(BeamMachGroupM As BeamMachGroupM)
MyBase.New(BeamMachGroupM)
AddHandler m_BeamMachGroupM.PartAdded, AddressOf OnBeamAdded
AddHandler m_BeamMachGroupM.PartRemoved, AddressOf OnBeamRemoved
CreateBeamVMList()
End Sub
#Region "METHODS"
Private Sub CreateBeamVMList()
Dim all As List(Of BeamVM) = (From BeamM In m_BeamMachGroupM.GetParts()
Select New BeamVM(BeamM)).ToList()
For Each BeamVM As BeamVM In all
AddHandler BeamVM.PropertyChanged, AddressOf OnBeamVMPropertyChanged
Next
m_PartVMList = New ObservableCollection(Of PartVM)(all)
AddHandler m_PartVMList.CollectionChanged, AddressOf OnBeamVMListChanged
End Sub
#End Region ' METHODS
Public Overrides Sub RefreshPartList()
' leggo StartCut da posizione primo pezzo
Dim sInfo As String = ""
Dim sSplitInfo() As String
Dim bFound As Boolean = False
EgtGetInfo(Id, MGR_RPT_PART & 1, sInfo)
If Not String.IsNullOrWhiteSpace(sInfo) Then
sSplitInfo = sInfo.Split(","c)
StringToDouble(sSplitInfo(1), m_BeamMachGroupM.dStartCut)
Else
m_BeamMachGroupM.dStartCut = 0
End If
' aggiorno lista pezzi
PartVMList.Clear()
Dim nRawPartId As Integer = EgtGetFirstRawPart()
While nRawPartId <> GDB_ID.NULL
Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
If nPartId <> GDB_ID.NULL Then
'''Dim NewBeam As BeamVM = New BeamVM(Me, nPartId, nRawPartId)
'''PartVMList.Add(NewBeam)
'''NewBeam.UpdateOffset()
End If
nRawPartId = EgtGetNextRawPart(nRawPartId)
End While
End Sub
Public Overrides Sub RefreshGroupData()
End Sub
Friend Sub UpdateUsage()
m_BeamMachGroupM.SetTotMat(dL)
m_BeamMachGroupM.SetMatForPart(0)
For Each Part In PartVMList
m_BeamMachGroupM.SetMatForPart(m_BeamMachGroupM.dMatForPart + Part.dL)
Next
NotifyPropertyChanged(NameOf(dUsage))
NotifyPropertyChanged(NameOf(dWaste))
End Sub
Friend Function ReDrawBeamMachgroup() As Boolean
'' scrivo dati di tutti i pezzi
'Dim dPosX As Double = m_BeamMachGroupM.dStartCut
'Dim nIndex As Integer
'For nIndex = 0 To PartVMList.Count - 1
' If nIndex <> 0 Then
' Dim Beam As BeamVM = DirectCast(PartVMList(nIndex), BeamVM)
' dPosX += Beam.m_BeamM.dOffset
' End If
' PartVMList(nIndex).dPOSX = dPosX
' EgtSetInfo(Id, MGR_RPT_PART & nIndex + 1, PartVMList(nIndex).nPartId & "," & dPosX)
' dPosX += PartVMList(nIndex).dL
'Next
'' elimino eventuali successive info pezzi di troppo
'nIndex = PartVMList.Count + 1
'Dim sTemp As String = ""
'While EgtGetInfo(Id, MGR_RPT_PART & nIndex, sTemp)
' EgtSetInfo(Id, MGR_RPT_PART & nIndex, "")
'End While
'' elimino vecchio grezzo ed eseguo script creazione nuovo
'Dim nRawId As Integer = EgtGetFirstRawPart()
'While nRawId <> GDB_ID.NULL
' EgtRemoveRawPart(nRawId)
' nRawId = EgtGetFirstRawPart()
'End While
'If Not ExecBeam(Map.refMainWindowVM.MainWindowM.sTempDir, Map.refMachinePanelVM.SelectedMachine.Name, CalcIntegration.CmdType.RAWPART, False) Then Return False
Return True
End Function
Friend Sub MoveBeam(Beam As BeamVM, MoveDirection As MoveDirections)
Dim nBeamIndex As Integer = PartVMList.IndexOf(Beam)
If nBeamIndex = 0 AndAlso MoveDirection = MoveDirections.UP Then Return
If nBeamIndex = PartVMList.Count - 1 AndAlso MoveDirection = MoveDirections.DOWN Then Return
' se pezzo mosso diventa primo
Dim FirstBeam As BeamVM
If (nBeamIndex = 1 AndAlso MoveDirection = MoveDirections.UP) OrElse (nBeamIndex = 0 AndAlso MoveDirection = MoveDirections.DOWN) Then
'' resetto offset per vecchio primo
FirstBeam = DirectCast(PartVMList(0), BeamVM)
FirstBeam.ResetOffset()
End If
PartVMList.Move(nBeamIndex, nBeamIndex + MoveDirection)
ReDrawBeamMachgroup()
' aggiorno offset primo pezzo
FirstBeam = DirectCast(PartVMList(0), BeamVM)
FirstBeam.UpdateOffset()
FirstBeam.NotifyPropertyChanged(NameOf(FirstBeam.sOffset))
End Sub
Friend Sub ReorderBeam()
Dim TempPartList = PartVMList.OrderBy(Function(x) x.dL).ToList()
' verifico se non sono già in oridne
Dim bSort As Boolean = False
For PartIndex = 0 To PartVMList.Count - 1
If PartVMList(PartIndex).nPartId <> TempPartList(PartIndex).nPartId Then
bSort = True
Exit For
End If
Next
If Not bSort Then Return
' resetto offset primo pezzo
Dim FirstBeam As BeamVM = DirectCast(PartVMList(0), BeamVM)
FirstBeam.ResetOffset()
PartVMList.Clear()
For Each Part In TempPartList
PartVMList.Add(Part)
Next
ReDrawBeamMachgroup()
' aggiorno offset primo pezzo
FirstBeam = DirectCast(PartVMList(0), BeamVM)
FirstBeam.UpdateOffset()
FirstBeam.NotifyPropertyChanged(NameOf(FirstBeam.sOffset))
End Sub
#Region "COMMANDS"
#Region "DeleteMachGroup"
' Returns a command that manage the MainWindow_Unloaded command
Public ReadOnly Property DeleteMachGroup_Command As ICommand
Get
If m_cmdDeleteMachGroup Is Nothing Then
m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroup)
End If
Return m_cmdDeleteMachGroup
End Get
End Property
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Overrides Sub DeleteMachGroup()
' elimino tutte le copie
Dim nRawPartId As Integer = EgtGetFirstRawPart()
Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
While nRawPartId <> GDB_ID.NULL
EgtRemovePartFromRawPart(nBeamId)
EgtErase(nBeamId)
nRawPartId = EgtGetNextRawPart(nRawPartId)
nBeamId = EgtGetFirstPartInRawPart(nRawPartId)
End While
' elimino MachGroup
EgtRemoveMachGroup(Me.Id)
' rimuovo dalla lista grezzi
Dim Index As Integer = Map.refMachGroupPanelVM.MachGroupVMList.IndexOf(Me)
If Index = 0 Then
If Map.refMachGroupPanelVM.MachGroupVMList.Count > 0 Then
Map.refMachGroupPanelVM.SelectedMachGroup = Map.refMachGroupPanelVM.MachGroupVMList(0)
Else
Map.refMachGroupPanelVM.SelectedMachGroup = Nothing
End If
ElseIf Index = Map.refMachGroupPanelVM.MachGroupvmList.Count - 1 Then
If Map.refMachGroupPanelVM.MachGroupVMList.Count > 1 Then
Map.refMachGroupPanelVM.SelectedMachGroup = Map.refMachGroupPanelVM.MachGroupVMList(Map.refMachGroupPanelVM.MachGroupVMList.Count - 2)
Else
Map.refMachGroupPanelVM.SelectedMachGroup = Nothing
End If
Else
Map.refMachGroupPanelVM.SelectedMachGroup = Map.refMachGroupPanelVM.MachGroupVMList(Index - 1)
End If
Map.refMachGroupPanelVM.MachGroupVMList.Remove(Me)
End Sub
#End Region ' DeleteMachGroup
#End Region ' COMMANDS
#Region "EVENTS"
Private Sub OnBeamAdded(sender As Object, e As PartAddedEventArgs)
Dim BeamVM As BeamVM = New BeamVM(e.NewPart)
PartVMList.Add(BeamVM)
End Sub
Private Sub OnBeamRemoved(sender As Object, e As PartAddedEventArgs)
Dim BeamVM As BeamVM = PartVMList.FirstOrDefault(Function(x) x.PartM Is e.m_NewPart)
If Not IsNothing(BeamVM) Then PartVMList.Remove(BeamVM)
End Sub
Private Sub OnBeamVMListChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
If Not IsNothing(e.NewItems) AndAlso e.NewItems.Count > 0 Then
For Each BeamVM As BeamVM In e.NewItems
AddHandler BeamVM.PropertyChanged, AddressOf OnBeamVMPropertyChanged
Next
End If
If Not IsNothing(e.OldItems) AndAlso e.OldItems.Count > 0 Then
For Each BeamVM As BeamVM In e.OldItems
RemoveHandler BeamVM.PropertyChanged, AddressOf OnBeamVMPropertyChanged
Next
End If
End Sub
Private Sub OnBeamVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
'Select Case e.PropertyName
' Case NameOf(sender.nSelGRP), NameOf(sender.nSelSIDE)
'End Select
End Sub
#End Region
End Class
@@ -0,0 +1,149 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class BeamVM
Inherits PartVM
Public ReadOnly Property m_BeamM As BeamM
Get
Return m_PartM
End Get
End Property
Public Property sOffset As String
Get
Return LenToString(m_BeamM.dOffset, 3)
End Get
Set(value As String)
Dim dValue As Double
If StringToLen(value, dValue) Then
Dim dOldValue As Double = m_BeamM.dOffset
m_BeamM.dOffset = dValue
'''Dim BeamMachGroup As BeamMachGroupVM = DirectCast(ParentMachGroup, BeamMachGroupVM)
'''If Not BeamMachGroup.ReDrawBeamMachgroup() Then
''' ' rispristino vecchio valore
''' m_BeamM.dOffset = dOldValue
''' BeamMachGroup.ReDrawBeamMachgroup()
'''End If
Else
NotifyPropertyChanged("sOffset")
End If
End Set
End Property
Public ReadOnly Property dOffset As Double
Get
Return m_BeamM.dOffset
End Get
End Property
Friend Sub ResetOffset()
'm_BeamM.dOffset = RawPartConfiguration.dBeamDist
'NotifyPropertyChanged(NameOf(sOffset))
End Sub
#Region "CONSTRUCTOR"
Sub New(BeamM As BeamM)
MyBase.New(BeamM)
End Sub
#Region "METHODS"
#End Region ' METHODS
'Sub New(nParentMachGroup As Core.MyMachGroupM, nPartId As Integer, nRawPartId As Integer)
' MyBase.New(nParentMachGroup, nPartId, nRawPartId)
' ' leggo info pezzo
' EgtGetInfo(nPartId, BTL_PRT_PROJ, nProjId)
' EgtGetInfo(nPartId, BTL_PRT_PDN, nPDN)
' EgtGetInfo(nPartId, BTL_PRT_NAM, sNAM)
' EgtGetInfo(nPartId, BTL_PRT_L, dL)
' EgtGetInfo(nPartId, BTL_PRT_W, dW)
' EgtGetInfo(nPartId, BTL_PRT_H, dH)
' EgtGetInfo(nPartId, BTL_PRT_CNT, nCNT)
' Dim nTemp As Integer = 0
' If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
' nTemp = 0
' End If
' SetRotated(nTemp)
' If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, nTemp) Then
' nTemp = 0
' End If
' SetInverted(nTemp)
' ' leggo PosX
' Dim sInfo As String = ""
' Dim Index = 1
' Dim sSplitInfo() As String
' Dim bFound As Boolean = False
' While EgtGetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
' If Not String.IsNullOrWhiteSpace(sInfo) Then
' sSplitInfo = sInfo.Split(","c)
' If sSplitInfo(0) = nPartId Then
' bFound = True
' Exit While
' End If
' End If
' Index += 1
' End While
' If bFound Then
' StringToDouble(sSplitInfo(1), dPOSX)
' End If
' ' 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
' '''FeatureList.Add(New BTLFeatureVM(Nothing, nFeatureId))
' End If
' nFeatureId = EgtGetNext(nFeatureId)
' End While
'End Sub
#End Region ' CONSTRUCTOR
Friend Sub UpdateOffset()
' calcolo offset
'''Dim nBeamIndex As Integer = ParentMachGroup.PartMList.IndexOf(Me)
'''If nBeamIndex > 0 Then
''' m_BeamM.dOffset = dPOSX - (ParentMachGroup.PartMList(nBeamIndex - 1).dPOSX + ParentMachGroup.PartMList(nBeamIndex - 1).dL)
'''Else
''' Dim BeamMachGroup As BeamMachGroupVM = DirectCast(ParentMachGroup, BeamMachGroupVM)
''' m_BeamM.dOffset = BeamMachGroup.dStartCut
'''End If
End Sub
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Overrides Sub DeletePart()
' elimino pezzo copia
EgtRemovePartFromRawPart(Me.nPartId)
EgtErase(Me.nPartId)
'''' rimuovo dalla lista pezzi
'''Dim Index As Integer = ParentMachGroup.PartMList.IndexOf(Function(x) x.nPartId = Me.nPartId)
'''If Index = 0 Then
''' If ParentMachGroup.PartMList.Count > 0 Then
''' ParentMachGroup.SelPart = ParentMachGroup.PartMList(0)
''' Else
''' ParentMachGroup.SelPart = Nothing
''' End If
'''ElseIf Index = ParentMachGroup.PartMList.Count - 1 Then
''' If ParentMachGroup.PartMList.Count > 1 Then
''' ParentMachGroup.SelPart = ParentMachGroup.PartMList(ParentMachGroup.PartMList.Count - 2)
''' Else
''' ParentMachGroup.SelPart = Nothing
''' End If
'''Else
''' ParentMachGroup.SelPart = ParentMachGroup.PartMList(Index - 1)
'''End If
'''ParentMachGroup.PartMList.Remove(Me)
'''Dim BeamParentMachGroup As BeamMachGroupVM = DirectCast(ParentMachGroup, BeamMachGroupVM)
'''If Not IsNothing(BeamParentMachGroup) Then BeamParentMachGroup.ReDrawBeamMachgroup()
EgtDraw()
End Sub
End Class
@@ -0,0 +1,149 @@
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class MyMachGroupPanelVM
Inherits NewMachGroupPanelVM
#Region "FIELDS & PROPERTIES"
Public ReadOnly Property m_MyMachGroupPanelM As MyMachGroupPanelM
Get
Return m_MachGroupPanelM
End Get
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New(MachGroupPanelM As MachGroupPanelM)
MyBase.New(MachGroupPanelM)
' Recupero la macchina di default
Dim sDefaultMachine As String = String.Empty
GetMainPrivateProfileString(S_MACH, K_CURRMACH, "", sDefaultMachine)
' Creo riferimento a questa classe in Map
Map.SetRefMachGroupPanelVM(Me)
'''InitMachGroupPanel(True, Map.refMachinePanelVM.MachineList.ToList(), sDefaultMachine)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Protected Overrides Sub CreateMachGroupVMList()
Dim all As List(Of MachGroupVM) = (From MachGroupM In m_MachGroupPanelM.GetMachGroups()
Select If(DirectCast(MachGroupM, MyMachGroupM).nMachineType = MachineType.BEAM, New BeamMachGroupVM(MachGroupM), New MachGroupVM(MachGroupM))).ToList()
For Each MachGroupvM As MachGroupVM In all
AddHandler MachGroupvM.PropertyChanged, AddressOf OnMachGroupVMPropertyChanged
Next
MachGroupVMList = New ObservableCollection(Of MachGroupVM)(all)
AddHandler MachGroupVMList.CollectionChanged, AddressOf OnMachGroupVMListChanged
End Sub
Public Overrides Function InitMachGroupList(Optional bUseDefaults As Boolean = False) As Boolean
' Svuoto precedente lista di MachGroup
MachGroupVMList.Clear()
' aggiorno copie
m_MyMachGroupPanelM.UpdateDuplo()
' verifico se esistono già gruppi di lavorazione o se devo creare il primo
Dim bOk As Boolean = False
Dim nId = EgtGetFirstMachGroup()
If nId <> GDB_ID.NULL Then
bOk = EgtSetCurrMachGroup(nId)
End If
If Not bOk Then Return True
' carico lista dei gruppi di lavorazione
m_MachGroupPanelM.MachGroupMList = MyMachGroupPanelM.LoadMyMachGroups(Map.refMachinePanelVM.MachineList.ToList())
' elimino copie da cancellare
m_MyMachGroupPanelM.DeleteDuplo()
If bOk Then SelectedMachGroup = MachGroupVMList(0)
EgtZoom(ZM.ALL)
Return True
End Function
Public Function RefreshMachGroupList() As Boolean
End Function
Public Overrides Sub AddMachGroup()
Dim SelMyMachine As MyMachine = Map.refMachinePanelVM.SelectedMachine
Dim MyMachGroupM As MyMachGroupM = m_MyMachGroupPanelM.NewMyMachGroup(SelMyMachine.Name, SelMyMachine.nType)
If Not IsNothing(MyMachGroupM) Then Return
'' creo oggetto gruppo creato
'Dim sNewMachGroupName As String = String.Empty
'Dim sNewMachGroupMachineName As String = String.Empty
'EgtGetMachGroupName(nNewMachGroupID, sNewMachGroupName)
'EgtGetMachGroupMachineName(nNewMachGroupID, sNewMachGroupMachineName)
'Dim MyMachGroup As MyMachGroupM
'If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
' MyMachGroup = New BeamMachGroupVM(nNewMachGroupID, sNewMachGroupName, sNewMachGroupMachineName)
'Else
' MyMachGroup = New WallMachGroup(nNewMachGroupID, sNewMachGroupName, sNewMachGroupMachineName)
'End If
'' lo aggiungo alla lista
'MachGroupList.Add(MyMachGroup)
' e lo seleziono
SelectedMachGroup = MachGroupVMList.FirstOrDefault(Function(x) x.MachGroupM Is MyMachGroupM)
End Sub
Public Overrides Function OnPreSetCurrMachGroup() As Boolean
EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx())
Return True
End Function
Public Overrides Function OnPostSetCurrMachGroup() As Boolean
' Imposto vista solo tavola
EgtSetMachineLook(MCH_LOOK.TAB)
EgtSetView(VT.ISO_SW, False)
EgtZoom(ZM.ALL)
Return True
End Function
' funzione che seleziona ultimo gruppo
Friend Sub SelLastMachGroup()
If Not IsNothing(Me) AndAlso Not IsNothing(MachGroupVMList) AndAlso MachGroupVMList.Count > 0 Then
SelectedMachGroup = MachGroupVMList(MachGroupVMList.Count - 1)
End If
End Sub
Friend Function GetLastMachGroup() As MachGroupVM
If Not IsNothing(Me) AndAlso Not IsNothing(MachGroupVMList) AndAlso MachGroupVMList.Count > 0 Then
Return MachGroupVMList(MachGroupVMList.Count - 1)
End If
Return Nothing
End Function
#End Region ' METHODS
#Region "EVENTS"
Protected Overrides Sub OnMachGroupAdded(sender As Object, e As MachGroupAddedEventArgs)
Dim MachGroupVM As MachGroupVM = Nothing
Select Case DirectCast(e.NewMachGroupM, MyMachGroupM).nMachineType
Case Core.ConstBeam.MachineType.BEAM
MachGroupVM = New BeamMachGroupVM(e.NewMachGroupM)
Case Core.ConstBeam.MachineType.WALL
'MachGroupVM = New wallMachGroupVM(e.NewMachGroupM)
Case Core.ConstBeam.MachineType.NULL
Return
End Select
MachGroupVMList.Add(MachGroupVM)
NotifyPropertyChanged(NameOf(MachGroupVMList))
End Sub
Protected Overrides Sub OnMachGroupVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
Select Case e.PropertyName
'Case nameof(sender.sMATERIAL)
End Select
End Sub
#End Region ' EVENTS
End Class
@@ -0,0 +1,186 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports System.Windows.Input
Imports System.Windows.Media
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public MustInherit Class MyMachGroupVM
Inherits MachGroupVM
Public ReadOnly Property MyMachGroupM As MyMachGroupM
Get
Return m_MachGroupM
End Get
End Property
Public ReadOnly Property nMachineType As MachineType
Get
Return MyMachGroupM.nMachineType
End Get
End Property
Public Property dL As Double
Get
Return MyMachGroupM.dL
End Get
Set(value As Double)
MyMachGroupM.dL = value
End Set
End Property
Public Property dW As Double
Get
Return MyMachGroupM.dW
End Get
Set(value As Double)
MyMachGroupM.dW = value
End Set
End Property
Public Property dH As Double
Get
Return MyMachGroupM.dH
End Get
Set(value As Double)
MyMachGroupM.dH = value
End Set
End Property
Public Property dtStartTime As DateTime
Get
Return MyMachGroupM.dtStartTime
End Get
Set(value As DateTime)
MyMachGroupM.dtStartTime = value
End Set
End Property
Public Property dtEndTime As DateTime
Get
Return MyMachGroupM.dtEndTime
End Get
Set(value As DateTime)
MyMachGroupM.dtEndTime = value
End Set
End Property
Public ReadOnly Property dUsage As Double
Get
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, MyMachGroupM.dMatForPart / MyMachGroupM.dTotMat * 100, 0)
End Get
End Property
Public ReadOnly Property dWaste As Double
Get
Return If(MyMachGroupM.dMatForPart > 0 AndAlso MyMachGroupM.dTotMat > 0, (MyMachGroupM.dTotMat - MyMachGroupM.dMatForPart) / MyMachGroupM.dTotMat * 100, 0)
End Get
End Property
Public ReadOnly Property sUsage As String
Get
Return dUsage & "%"
End Get
End Property
Public ReadOnly Property sWaste As String
Get
Return dWaste & "%"
End Get
End Property
Public Property sMATERIAL As String
Get
Return MyMachGroupM.sMATERIAL
End Get
Set(value As String)
MyMachGroupM.sMATERIAL = value
End Set
End Property
' lista dei pezzi che sono nel grezzo
Protected m_PartVMList As New ObservableCollection(Of PartVM)
Public Property PartVMList As ObservableCollection(Of PartVM)
Get
Return m_PartVMList
End Get
Set(value As ObservableCollection(Of PartVM))
m_PartVMList = value
End Set
End Property
Protected m_SelPart As PartVM
Public Overridable Property SelPart As PartVM
Get
Return m_SelPart
End Get
Set(value As PartVM)
m_SelPart = value
' seleziono pezzo
EgtDeselectAll()
If Not IsNothing(value) Then EgtSelectObj(SelPart.nPartId)
EgtDraw()
NotifyPropertyChanged(NameOf(SelPart))
End Set
End Property
Public ReadOnly Property nState As CalcStates
Get
Return MyMachGroupM.nState
End Get
End Property
Public ReadOnly Property Calc_Background As SolidColorBrush
Get
If nState = 0 Then
Return Brushes.Green
ElseIf nState < 0 Then
Return Brushes.LightGray
ElseIf nState > 0 Then
Return Brushes.Red
Else
Return Brushes.Red
End If
End Get
End Property
Sub New(MyMachGroupM As MyMachGroupM)
MyBase.New(MyMachGroupM)
'aggiorno lista pezzi
RefreshPartList()
End Sub
#Region "METHODS"
#End Region ' METHODS
Public MustOverride Sub RefreshPartList()
Public MustOverride Sub RefreshGroupData()
Public Overridable Sub DeleteMachGroup()
' elimino tutte le copie
Dim nRawPartId As Integer = EgtGetFirstRawPart()
Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
While nRawPartId <> GDB_ID.NULL
EgtRemovePartFromRawPart(nBeamId)
EgtErase(nBeamId)
nRawPartId = EgtGetNextRawPart(nRawPartId)
nBeamId = EgtGetFirstPartInRawPart(nRawPartId)
End While
' elimino MachGroup
EgtRemoveMachGroup(Me.Id)
End Sub
Public Sub CalcMachGroupUpdate()
MyMachGroupM.SetState(CalcStates.OK)
For Each Part In PartVMList
If Part.nGlobalState > 0 AndAlso nState = CalcStates.OK Then
MyMachGroupM.SetState(CalcStates.ERROR_)
End If
Next
NotifyPropertyChanged(NameOf(Calc_Background))
End Sub
End Class
@@ -0,0 +1,291 @@
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.ComponentModel
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class NewMachGroupPanelVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Protected m_MachGroupPanelM As MachGroupPanelM
Public ReadOnly Property DefaultMachine As String
Get
Return m_MachGroupPanelM.DefaultMachine
End Get
End Property
Private m_MachGroupVMList As ObservableCollection(Of MachGroupVM)
Public Property MachGroupVMList As ObservableCollection(Of MachGroupVM)
Get
Return m_MachGroupVMList
End Get
Set(value As ObservableCollection(Of MachGroupVM))
m_MachGroupVMList = value
End Set
End Property
Private m_SelectedMachGroup As MachGroupVM
Public Property SelectedMachGroup As MachGroupVM
Get
Return m_SelectedMachGroup
End Get
Set(value As MachGroupVM)
m_SelectedMachGroup = value
If Not IsNothing(value) Then
OnPreSetCurrMachGroup()
EgtSetCurrMachGroup(value.Id)
OnPostSetCurrMachGroup()
End If
NotifyPropertyChanged(NameOf(SelectedMachGroup))
End Set
End Property
Public ReadOnly Property MachGroupPanel_Visibility As Visibility
Get
Return m_MachGroupPanelM.MachGroupPanel_Visibility
End Get
End Property
Public Sub SetMachGroupPanelVisibility(IsVisible As Boolean)
If IsVisible Then
m_MachGroupPanelM.MachGroupPanel_Visibility = Visibility.Visible
Else
m_MachGroupPanelM.MachGroupPanel_Visibility = Visibility.Collapsed
End If
NotifyPropertyChanged(NameOf(MachGroupPanel_Visibility))
End Sub
' Variabile che permette di abilitare/disabilitare i bottoni aggiungi e togli MachGroup
Public Property IsEnabledAddRemove As Boolean
Get
Return m_MachGroupPanelM.IsEnabledAddRemove
End Get
Set(value As Boolean)
m_MachGroupPanelM.IsEnabledAddRemove = value
NotifyPropertyChanged(NameOf(IsEnabledAddRemove))
End Set
End Property
' Variabile che definisce lo stato (attivi/disattivi) di tutti i gruppi tranne quello selezionato
Public ReadOnly Property IsEnabledMachGroups As Boolean
Get
Return m_MachGroupPanelM.IsEnabledMachGroups
End Get
End Property
' Definizione comandi
Private m_cmdSetCurrMachGroup As ICommand
Private m_cmdAddMachGroup As ICommand
Private m_cmdRemoveMachGroup As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New(MachGroupPanelM As MachGroupPanelM)
m_MachGroupPanelM = MachGroupPanelM
If Not MachGroupPanelM.IsMultiMachGroup Then SetMachGroupPanelVisibility(False)
' Creo riferimento a questa classe in LibMap
'''LibMap.SetRefMachGroupPanelVM(Me)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Private Sub CreateMachGroupVMList()
Dim all As List(Of MachGroupVM) = (From MachGroupM In m_MachGroupPanelM.GetMachGroups()
Select New MachGroupVM(MachGroupM)).ToList()
For Each MachGroupvM As MachGroupVM In all
AddHandler MachGroupvM.PropertyChanged, AddressOf OnMachGroupvMPropertyChanged
Next
m_MachGroupVMList = New ObservableCollection(Of MachGroupVM)(all)
AddHandler m_MachGroupVMList.CollectionChanged, AddressOf OnMachGroupVMListChanged
End Sub
Public Overridable Function InitMachGroupList(Optional bUseDefaults As Boolean = False) As Boolean
' Svuoto precedente lista di MachGroup
m_MachGroupPanelM.MachGroupMList.Clear()
' verifico se esistono già gruppi di lavorazione o se devo creare il primo
Dim bOk As Boolean
Dim nId = EgtGetFirstMachGroup()
If nId <> GDB_ID.NULL Then
bOk = EgtSetCurrMachGroup(nId)
Else
If bUseDefaults Then
bOk = Not IsNothing(m_MachGroupPanelM.NewMachGroupWithDefaults())
Else
bOk = Not IsNothing(m_MachGroupPanelM.NewMachGroup())
End If
End If
If Not bOk Then Return False
' Sistemazioni finali
m_MachGroupPanelM.MachGroupMList = MachGroupPanelM.LoadMachGroups()
SelectedMachGroup = MachGroupVMList(0)
Return True
End Function
' Funzione che permette di abilitare o disabilitare tutti i gruppi tranne quello selezionato più i bottni Add/Remove
Public Function SetMachGroupState(bState As Boolean) As Boolean
If bState Then
For Each Group In MachGroupVMList
Group.IsEnabled = True
Next
m_MachGroupPanelM.IsEnabledAddRemove = True
NotifyPropertyChanged(NameOf(IsEnabledAddRemove))
m_MachGroupPanelM.IsEnabledMachGroups = True
Return True
Else
For Each Group In MachGroupVMList
If Group Is SelectedMachGroup Then
Group.IsEnabled = True
Else
Group.IsEnabled = False
End If
Next
m_MachGroupPanelM.IsEnabledAddRemove = False
NotifyPropertyChanged(NameOf(IsEnabledAddRemove))
m_MachGroupPanelM.IsEnabledMachGroups = False
Return True
End If
Return False
End Function
Public Overridable Function OnPreSetCurrMachGroup() As Boolean
Return True
End Function
Public Overridable Function OnPostSetCurrMachGroup() As Boolean
Return True
End Function
Public Overridable Function OnPreRemoveCurrMachGroup() As Boolean
Return True
End Function
#End Region ' METHODS
#Region "COMMANDS"
#Region "AddMachGroupCommand"
''' <summary>
''' Returns a command that set the selected MachGroup as the Current one.
''' </summary>
Public ReadOnly Property AddMachGroupCommand As ICommand
Get
If m_cmdAddMachGroup Is Nothing Then
m_cmdAddMachGroup = New Command(AddressOf AddMachGroup)
End If
Return m_cmdAddMachGroup
End Get
End Property
Public Overridable Sub AddMachGroup()
Dim MachGroupM As MachGroupM = m_MachGroupPanelM.NewMachGroup()
If IsNothing(MachGroupM) Then Return
' lo seleziono
SelectedMachGroup = MachGroupVMList.FirstOrDefault(Function(x) x.MachGroupM Is MachGroupM)
EgtZoom(ZM.ALL)
End Sub
#End Region ' AddMachGroupCommand
#Region "RemoveMachGroupCommand"
''' <summary>
''' Returns a command that set the selected MachGroup as the Current one.
''' </summary>
Public ReadOnly Property RemoveMachGroupCommand As ICommand
Get
If m_cmdRemoveMachGroup Is Nothing Then
m_cmdRemoveMachGroup = New Command(AddressOf RemoveMachGroup)
End If
Return m_cmdRemoveMachGroup
End Get
End Property
Public Overridable Sub RemoveMachGroup()
' Calcolo indice del gruppo da cancellare
Dim nSelectedMachGroupIndex As Integer = MachGroupVMList.IndexOf(SelectedMachGroup)
If MachGroupVMList.Count = 1 Then
'chiedo conferma prima di resettare il gruppo di lavorazione
Select Case MessageBox.Show("Eliminare?", "", MessageBoxButton.YesNo, MessageBoxImage.Question)
Case MessageBoxResult.Yes
' cancello il gruppo corrente e ne creo uno nuovo con lo stesso nome
OnPreRemoveCurrMachGroup()
EgtRemoveMachGroup(MachGroupVMList(0).Id)
MachGroupVMList.Clear()
AddMachGroup()
EgtZoom(ZM.ALL)
Case MessageBoxResult.No
Return
End Select
Else
'chiedo conferma prima di cancellare il gruppo di lavorazione
Select Case MessageBox.Show("Eliminare?", "", MessageBoxButton.YesNo, MessageBoxImage.Question)
Case MessageBoxResult.Yes
' cancello quello selezionato (ovvero il corrente)
OnPreRemoveCurrMachGroup()
EgtRemoveMachGroup(MachGroupVMList(nSelectedMachGroupIndex).Id)
' rendo corrente il gruppo di lavorazione successivo a quello da cancellare
If nSelectedMachGroupIndex = 0 And MachGroupVMList.Count > 1 Then
EgtSetCurrMachGroup(MachGroupVMList(nSelectedMachGroupIndex + 1).Id)
SelectedMachGroup = MachGroupVMList(nSelectedMachGroupIndex + 1)
' rendo corrente il gruppo di lavorazione precedente a quello da cancellare
ElseIf nSelectedMachGroupIndex > 0 Then
EgtSetCurrMachGroup(MachGroupVMList(nSelectedMachGroupIndex - 1).Id)
SelectedMachGroup = MachGroupVMList(nSelectedMachGroupIndex - 1)
End If
EgtZoom(ZM.ALL)
' aggiorno la lista dei gruppi
MachGroupVMList.RemoveAt(nSelectedMachGroupIndex)
Case MessageBoxResult.No
Return
End Select
End If
End Sub
#End Region ' RemoveMachGroupCommand
#End Region ' COMMANDS
#Region "EVENTS"
Private Sub OnMachGroupAdded(sender As Object, e As MachGroupAddedEventArgs)
Dim MachGroupVM As MachGroupVM = New MachGroupVM(e.NewMachGroupM)
m_MachGroupVMList.Add(MachGroupVM)
NotifyPropertyChanged(NameOf(MachGroupVMList))
End Sub
Private Sub OnMachGroupVMListChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
If Not IsNothing(e.NewItems) AndAlso e.NewItems.Count > 0 Then
For Each MachGroupVM As MachGroupVM In e.NewItems
AddHandler MachGroupVM.PropertyChanged, AddressOf OnMachGroupVMPropertyChanged
Next
End If
If Not IsNothing(e.OldItems) AndAlso e.OldItems.Count > 0 Then
For Each MachGroupVM As MachGroupVM In e.OldItems
RemoveHandler BTLPartVM.PropertyChanged, AddressOf OnMachGroupVMPropertyChanged
Next
End If
End Sub
Private Sub OnMachGroupVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
Select Case e.PropertyName
'Case nameof(sender.sMATERIAL)
End Select
End Sub
#End Region ' EVENTS
End Class
@@ -0,0 +1,409 @@
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports System.ComponentModel
Imports System.IO
Imports System.Windows.Input
Imports System.Windows.Media
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public MustInherit Class PartVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Protected m_PartM As PartM
Public ReadOnly Property PartM As PartM
Get
Return m_PartM
End Get
End Property
Public ReadOnly Property ParentMachGroup As MyMachGroupM
Get
Return m_PartM.ParentMachGroup
End Get
End Property
' Id geometrico del pezzo
Public ReadOnly Property nPartId As Integer
Get
Return m_PartM.nPartId
End Get
End Property
' Proj del pezzo
Public Property nProjId As Integer
Get
Return m_PartM.nProjId
End Get
Set(value As Integer)
m_PartM.nProjId = value
End Set
End Property
' Info del pezzo
Public ReadOnly Property nPDN As Integer
Get
Return m_PartM.nPDN
End Get
End Property
Public ReadOnly Property sNAM As String
Get
Return m_PartM.sNAM
End Get
End Property
Public Property dL As Double
Get
Return m_PartM.dL
End Get
Set(value As Double)
m_PartM.dL = value
End Set
End Property
Public Property dW As Double
Get
Return m_PartM.dW
End Get
Set(value As Double)
m_PartM.dW = value
End Set
End Property
Public Property dH As Double
Get
Return m_PartM.dH
End Get
Set(value As Double)
m_PartM.dH = value
End Set
End Property
Public Property sPOSX As String
Get
Return LenToString(m_PartM.dPOSX, 3)
End Get
Set(value As String)
StringToLen(value, m_PartM.dPOSX)
End Set
End Property
Public Property dPOSX As Double
Get
Return m_PartM.dPOSX
End Get
Set(value As Double)
m_PartM.dPOSX = value
NotifyPropertyChanged(NameOf(sPOSX))
End Set
End Property
Public Property nCNT As Integer
Get
Return m_PartM.nCNT
End Get
Set(value As Integer)
m_PartM.nCNT = value
End Set
End Property
Public ReadOnly Property sINVERTED As String
Get
Return m_PartM.nINVERTED & "°"
End Get
End Property
Public ReadOnly Property sROTATED As String
Get
Return m_PartM.nROTATED & "°"
End Get
End Property
Public Property sMATERIAL As String
Get
Return m_PartM.sMATERIAL
End Get
Set(value As String)
m_PartM.sMATERIAL = value
End Set
End Property
Public ReadOnly Property nGlobalState As CalcStates
Get
Return m_PartM.nGlobalState
End Get
End Property
Public Property nState As CalcStates
Get
Return m_PartM.nState
End Get
Set(value As CalcStates)
m_PartM.nState = value
End Set
End Property
Public ReadOnly Property Calc_Background As SolidColorBrush
Get
If m_PartM.nGlobalState = 0 Then
Return Brushes.Green
ElseIf m_PartM.nGlobalState < 0 Then
Return Brushes.LightGray
ElseIf m_PartM.nGlobalState > 0 Then
Return Brushes.Red
Else
Return Brushes.Red
End If
End Get
End Property
Public ReadOnly Property nCALC_ERR As Integer
Get
Return m_PartM.nCALC_ERR
End Get
End Property
Public ReadOnly Property sCALC_MSG As String
Get
Return m_PartM.sCALC_MSG
End Get
End Property
Public Property nCALC_ROT As Integer
Get
Return m_PartM.nCALC_ROT
End Get
Set(value As Integer)
m_PartM.nCALC_ROT = value
End Set
End Property
Public Property nCALC_FALL As Integer
Get
Return m_PartM.nCALC_FALL
End Get
Set(value As Integer)
m_PartM.nCALC_FALL = value
End Set
End Property
Public Property nCALC_TIME As Integer
Get
Return m_PartM.nCALC_TIME
End Get
Set(value As Integer)
m_PartM.nCALC_TIME = value
End Set
End Property
' lista delle feature del pezzo
Protected m_FeatureVMList As ObservableCollection(Of BTLFeatureVM)
Public Property FeatureVMList As ObservableCollection(Of BTLFeatureVM)
Get
Return m_FeatureVMList
End Get
Set(value As ObservableCollection(Of BTLFeatureVM))
m_FeatureVMList = value
End Set
End Property
Protected m_SelFeatureVM As BTLFeatureVM
Public Property SelFeatureVM As BTLFeatureVM
Get
Return m_SelFeatureVM
End Get
Set(value As BTLFeatureVM)
m_SelFeatureVM = value
EgtDeselectAll()
If Not IsNothing(value) Then EgtSelectObj(m_SelFeatureVM.nFeatureId)
EgtDraw()
NotifyPropertyChanged(NameOf(m_SelFeatureVM))
End Set
End Property
Public Property dtStartTime As DateTime
Get
Return m_PartM.dtStartTime
End Get
Set(value As DateTime)
m_PartM.dtStartTime = value
End Set
End Property
Public Property dtEndTime As DateTime
Get
Return m_PartM.dtEndTime
End Get
Set(value As DateTime)
m_PartM.dtEndTime = value
End Set
End Property
' definizione comandi
Private m_cmdDeletePart As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New(PartM As PartM)
m_PartM = PartM
AddHandler m_PartM.BTLFeatureAdded, AddressOf OnBTLFeatureAdded
CreateBTLFeatureVMList()
End Sub
'Sub New(nParentMachGroup As MyMachGroupM, nPartId As Integer)
' m_ParentMachGroup = nParentMachGroup
' SetPartId(nPartId)
' m_FeatureVMList = New ObservableCollection(Of BTLFeatureM)
'End Sub
#End Region ' CONSTRUCTOR
Private Sub CreateBTLFeatureVMList()
Dim all As List(Of BTLFeatureVM) = (From BTLFeatureM In m_PartM.GetBTLFeatures()
Select New BTLFeatureVM(BTLFeatureM)).ToList()
For Each BTLFeatureVM As BTLFeatureVM In all
AddHandler BTLFeatureVM.PropertyChanged, AddressOf OnBTLFeatureVMPropertyChanged
Next
m_FeatureVMList = New ObservableCollection(Of BTLFeatureVM)(all)
AddHandler m_FeatureVMList.CollectionChanged, AddressOf OnBTLFeatureVMListChanged
End Sub
' funzione che aggiorna lo stato e gli errori dopo calcolo
Public Sub CalcPartUpdate(bCalc As Boolean, ERR As Integer, ROT As Integer, FALL As Integer, MSG As String)
If Not bCalc Then
nState = CalcStates.NOTCALCULATED
m_PartM.nCALC_ERR = 0
m_PartM.nCALC_ROT = 0
m_PartM.nCALC_FALL = 0
m_PartM.sCALC_MSG = ""
Else
m_PartM.nCALC_ERR = ERR
m_PartM.nCALC_ROT = ROT
m_PartM.nCALC_FALL = 0
m_PartM.sCALC_MSG = MSG
If ERR = 0 Then
nState = CalcStates.OK
ElseIf ERR > 1 Then
nState = CalcStates.ERROR_
ElseIf ERR < 1 Then
nState = CalcStates.NOTCALCULATED
End If
End If
NotifyPropertyChanged(NameOf(Calc_Background))
End Sub
' funzione che aggiorna lo stato e gli errori dopo calcolo
Public Sub CalcFeatureUpdate()
m_PartM.nGlobalState = nState
For Each Feature In FeatureVMList
If Not Feature.bDO Then
ElseIf Feature.nState < 0 Then
m_PartM.nGlobalState = CalcStates.NOTCALCULATED
Exit For
ElseIf Feature.nState > 0 AndAlso m_PartM.nGlobalState = CalcStates.OK Then
m_PartM.nGlobalState = CalcStates.ERROR_
End If
Next
NotifyPropertyChanged(NameOf(Calc_Background))
End Sub
#Region "COMMANDS"
#Region "DeletePart"
' Returns a command that manage the MainWindow_Unloaded command
Public ReadOnly Property DeletePart_Command() As ICommand
Get
If m_cmdDeletePart Is Nothing Then
m_cmdDeletePart = New Command(AddressOf DeletePart)
End If
Return m_cmdDeletePart
End Get
End Property
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Overridable Sub DeletePart()
EgtRemovePartFromRawPart(m_PartM.nPartId)
' elimino pezzo copia
EgtErase(m_PartM.nPartId)
' elimino info pezzo su mach group
Dim sInfo As String = ""
Dim Index As Integer = 1
Dim sSplitInfo() As String
Dim bFound As Boolean = False
'''While EgtGetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
''' If Not String.IsNullOrWhiteSpace(sInfo) Then
''' sSplitInfo = sInfo.Split(","c)
''' If bFound Then
''' EgtSetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index - 1, sInfo)
''' End If
''' If sSplitInfo(0) = nPartId Then
''' bFound = True
''' End If
''' End If
''' Index += 1
'''End While
'''If bFound Then
''' EgtSetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index - 1, "")
'''End If
'''' rimuovo dalla lista pezzi
'''Index = ParentMachGroup.PartMList.IndexOf(Me)
'''If Index = 0 Then
''' If ParentMachGroup.PartMList.Count > 0 Then
''' ParentMachGroup.SelPart = ParentMachGroup.PartMList(0)
''' Else
''' ParentMachGroup.SelPart = Nothing
''' End If
'''ElseIf Index = ParentMachGroup.PartMList.Count - 1 Then
''' If ParentMachGroup.PartMList.Count > 1 Then
''' ParentMachGroup.SelPart = ParentMachGroup.PartMList(ParentMachGroup.PartMList.Count - 2)
''' Else
''' ParentMachGroup.SelPart = Nothing
''' End If
'''Else
''' ParentMachGroup.SelPart = ParentMachGroup.PartMList(Index - 1)
'''End If
'''ParentMachGroup.PartMList.Remove(Me)
End Sub
#End Region ' DeletePart
#End Region ' COMMANDS
#Region "EVENTS"
Private Sub OnBTLFeatureAdded(sender As Object, e As BTLFeatureAddedEventArgs)
Dim BTLFeatureVM As BTLFeatureVM = New BTLFeatureVM(e.NewBTLFeature)
FeatureVMList.Add(BTLFeatureVM)
End Sub
Private 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
Next
End If
If Not IsNothing(e.OldItems) AndAlso e.OldItems.Count > 0 Then
For Each BTLFeatureVM As BTLFeatureVM In e.OldItems
RemoveHandler BTLFeatureVM.PropertyChanged, AddressOf OnBTLFeatureVMPropertyChanged
Next
End If
End Sub
Private Sub OnBTLFeatureVMPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
'Select Case e.PropertyName
' Case NameOf(sender.nSelGRP), NameOf(sender.nSelSIDE)
'End Select
End Sub
#End Region
End Class
@@ -0,0 +1,96 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class WallMachGroup
Inherits Core.WallMachGroup
' definizione comandi
Private m_cmdDeleteMachGroup As ICommand
Sub New(nId As Integer, sName As String, sMachine As String)
MyBase.New(nId, sName, sMachine)
SetMachineType(MachineType.WALL)
m_nRawPartId = EgtGetFirstRawPart()
EgtGetInfo(nId, MGR_RPT_PANELLEN, dL)
EgtGetInfo(nId, MGR_RPT_PANELWIDTH, dW)
EgtGetInfo(nId, MGR_RPT_PANELHEIGHT, dH)
m_dTotMat = dL * dW
For Each Part In PartMList
m_dMatForPart += (Part.dL * Part.dW)
Next
End Sub
Friend Sub UpdateUsage()
m_dTotMat = dL * dW
m_dMatForPart = 0
For Each Part In PartMList
m_dMatForPart += (Part.dL * Part.dW)
Next
'''NotifyPropertyChanged("dUsage")
'''NotifyPropertyChanged("dWaste")
End Sub
Public Overrides Sub RefreshPartList()
m_nRawPartId = EgtGetFirstRawPart()
PartMList.Clear()
Dim nPartId As Integer = EgtGetFirstPartInRawPart(m_nRawPartId)
While nPartId <> GDB_ID.NULL
PartMList.Add(New Wall(Me, nPartId))
nPartId = EgtGetNextPartInRawPart(nPartId)
End While
End Sub
#Region "COMMANDS"
#Region "DeleteMachGroup"
' Returns a command that manage the MainWindow_Unloaded command
Public ReadOnly Property DeleteMachGroup_Command As ICommand
Get
If m_cmdDeleteMachGroup Is Nothing Then
m_cmdDeleteMachGroup = New Command(AddressOf DeleteMachGroup)
End If
Return m_cmdDeleteMachGroup
End Get
End Property
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Overrides Sub DeleteMachGroup()
' elimino tutte le copie
Dim nRawPartId As Integer = EgtGetFirstRawPart()
Dim nBeamId As Integer = EgtGetFirstPartInRawPart(nRawPartId)
While nRawPartId <> GDB_ID.NULL
EgtRemovePartFromRawPart(nBeamId)
EgtErase(nBeamId)
nRawPartId = EgtGetNextRawPart(nRawPartId)
nBeamId = EgtGetFirstPartInRawPart(nRawPartId)
End While
' elimino MachGroup
EgtRemoveMachGroup(Me.Id)
' rimuovo dalla lista grezzi
'''Dim Index As Integer = Map.refMachGroupPanelVM.MachGroupVMList.IndexOf(Me)
'''If Index = 0 Then
''' If Map.refMachGroupPanelVM.MachGroupVMList.Count > 0 Then
''' Map.refMachGroupPanelVM.SelectedMachGroup = Map.refMachGroupPanelVM.MachGroupVMList(0)
''' Else
''' Map.refMachGroupPanelVM.SelectedMachGroup = Nothing
''' End If
'''ElseIf Index = Map.refMachGroupPanelVM.MachGroupvmList.Count - 1 Then
''' If Map.refMachGroupPanelVM.MachGroupVMList.Count > 1 Then
''' Map.refMachGroupPanelVM.SelectedMachGroup = Map.refMachGroupPanelVM.MachGroupVMList(Map.refMachGroupPanelVM.MachGroupVMList.Count - 2)
''' Else
''' Map.refMachGroupPanelVM.SelectedMachGroup = Nothing
''' End If
'''Else
''' Map.refMachGroupPanelVM.SelectedMachGroup = Map.refMachGroupPanelVM.MachGroupVMList(Index - 1)
'''End If
'''Map.refMachGroupPanelVM.MachGroupVMList.Remove(Me)
End Sub
#End Region ' DeleteMachGroup
#End Region ' COMMANDS
End Class
@@ -0,0 +1,94 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class Wall
Inherits Core.Wall
Public Property sPOSY As String
Get
Return LenToString(m_dPOSY, 3)
End Get
Set(value As String)
StringToLen(value, m_dPOSY)
End Set
End Property
Public Property sROT As String
Get
Return LenToString(m_dROT, 3)
End Get
Set(value As String)
StringToLen(value, m_dROT)
End Set
End Property
Public Property sFLIP As String
Get
Return LenToString(m_dFLIP, 3)
End Get
Set(value As String)
StringToLen(value, m_dFLIP)
End Set
End Property
#Region "CONSTRUCTOR"
Sub New(nParentMachGroup As Core.MyMachGroupM, nPartId As Integer)
MyBase.New(nParentMachGroup, nPartId)
' leggo info pezzo
EgtGetInfo(nPartId, BTL_PRT_PROJ, m_nProjId)
EgtGetInfo(nPartId, BTL_PRT_PDN, m_nPDN)
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)
Dim nTemp As Integer = 0
If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
nTemp = 0
End If
SetRotated(nTemp)
If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, nTemp) Then
nTemp = 0
End If
SetInverted(nTemp)
' leggo PosX, PosY, Rot e Flip
Dim sInfo As String = ""
Dim Index = 1
Dim sSplitInfo() As String
Dim bFound As Boolean = False
While EgtGetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
If Not String.IsNullOrWhiteSpace(sInfo) Then
sSplitInfo = sInfo.Split(","c)
If sSplitInfo(0) = nPartId Then
bFound = True
Exit While
End If
End If
Index += 1
End While
If bFound Then
StringToDouble(sSplitInfo(1), m_dPOSX)
StringToDouble(sSplitInfo(2), m_dPOSY)
StringToDouble(sSplitInfo(3), m_dROT)
StringToDouble(sSplitInfo(4), m_dFLIP)
End If
' vado sul layer delle 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
'''FeatureList.Add(New BTLFeatureVM(Nothing, nFeatureId))
End If
nFeatureId = EgtGetNext(nFeatureId)
End While
End Sub
#End Region ' CONSTRUCTOR
End Class
@@ -0,0 +1,25 @@
<EgtFloating:EgtFloatingPanel x:Class="MachinePanelV"
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"
Background="{StaticResource Omag_Gray}" BorderBrush="{StaticResource Omag_Gray}"
IsEnabled="{Binding MachPanel_IsEnabled}">
<!--Combobox per selezionare la macchina corrente-->
<ComboBox ItemsSource="{Binding Path=MachineList}" DisplayMemberPath="Name"
SelectedItem="{Binding Path=SelectedMachine}" SelectedValuePath="Name"
Height="20" Width="150"/>
<Button Command="{Binding ToolDbCommand}" ToolTip="{Binding ToolDBToolTip}"
Style="{StaticResource ToolBar_TextButton}" Width="55" Content="{Binding ToolDBMsg}"/>
<Button Command="{Binding MachDbCommand}" ToolTip="{Binding MachiningDbToolTip}"
Style="{StaticResource ToolBar_TextButton}" Width="55" Content="{Binding MachiningDbMsg}"/>
<Button Command="{Binding SetUpCommand}" ToolTip="{Binding SetUpToolTip}"
Style="{StaticResource ToolBar_TextButton}" Width="55" Content="{Binding SetUpMsg}"
Background="{Binding SetUp_Background}"/>
<!--<Button Command="{Binding MachOptionsCommand}" ToolTip="{Binding OptionsToolTip}">
<Image Source="/Resources/ProjectManager/Options.png" Height="22" />
</Button>-->
</EgtFloating:EgtFloatingPanel>
@@ -0,0 +1,3 @@
Public Class MachinePanelV
End Class
@@ -0,0 +1,343 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class MachinePanelVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
' Radice del direttorio delle macchine
Private m_sMachinesRoot As String
' Lista delle macchine disponibili
Private m_MachineList As New ObservableCollection(Of Machine)
Public Property MachineList As ObservableCollection(Of Machine)
Get
Return m_MachineList
End Get
Set(value As ObservableCollection(Of Machine))
m_MachineList = value
End Set
End Property
' Macchina correntemente selezionata e quindi attiva
Private m_SelectedMachine As Machine = Nothing
Public Property SelectedMachine As MyMachine
Get
Return m_SelectedMachine
End Get
Set(value As MyMachine)
If value IsNot m_SelectedMachine Then
'EgtSetCurrentContext(Map.refSceneHostVM.MainScene.GetCtx())
'EgtResetCurrMachGroup()
' se sono in modalità disegno
m_SelectedMachine = value
' inizializzo la macchina selezionata come macchina corrente
SectionXMaterial.SetType(DirectCast(m_SelectedMachine, MyMachine).nType)
InitCurrentMachine(Map.refMainWindowVM.MainWindowM.sMachinesRoot, value.Name)
End If
End Set
End Property
Private m_SetUp_Background As Brush = New BrushConverter().ConvertFrom("#FFDDDDDD")
Public Property SetUp_Background As Brush
Get
Return m_SetUp_Background
End Get
Set(value As Brush)
m_SetUp_Background = value
NotifyPropertyChanged("SetUp_Background")
End Set
End Property
Private m_MachPanel_IsEnabled As Boolean = True
Public Property MachPanel_IsEnabled As Boolean
Get
Return m_MachPanel_IsEnabled
End Get
Set(value As Boolean)
m_MachPanel_IsEnabled = value
NotifyPropertyChanged("MachPanel_IsEnabled")
End Set
End Property
#Region "Messages"
Public ReadOnly Property ToolDBMsg As String
Get
Return EgtMsg(MSG_MACHINEPAGEUC + 6)
End Get
End Property
Public ReadOnly Property MachiningDbMsg As String
Get
Return EgtMsg(MSG_MACHINEPAGEUC + 7)
End Get
End Property
Public ReadOnly Property SetUpMsg As String
Get
Return EgtMsg(MSG_ALARMSPAGEUC + 33)
End Get
End Property
#End Region ' Messages
#Region "ToolTip"
Public ReadOnly Property ToolDBToolTip As String
Get
Return "Tool DB"
End Get
End Property
Public ReadOnly Property MachiningDbToolTip As String
Get
Return "Machining DB"
End Get
End Property
Public ReadOnly Property SetUpToolTip As String
Get
Return "SetUp"
End Get
End Property
#End Region ' ToolTip
' Definizione comandi
Private m_cmdToolDb As ICommand
Private m_cmdMachDb As ICommand
Private m_cmdSetUp As ICommand
Private m_cmdMachOptions As ICommand
#End Region 'FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in Map
Map.SetRefMachinePanelVM(Me)
' recupero cartella radice delle macchine
m_sMachinesRoot = Map.refMainWindowVM.MainWindowM.sMachinesRoot
' Carica macchine da cartella delle macchine
MyMachine.MachineListInit(m_sMachinesRoot, MachineList)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub LoadCurrentMachine()
If m_MachineList.Count = 0 Then Return
Dim CurrMach As String = String.Empty
GetMainPrivateProfileString(S_MACH, K_CURRMACH, String.Empty, CurrMach)
Dim bFound As Boolean = False
If Not String.IsNullOrEmpty(CurrMach) Then
For Each Mach In MachineList
If Mach.Name = CurrMach Then
bFound = True
SelectedMachine = Mach
Exit For
End If
Next
End If
If Not bFound And MachineList.Count > 0 Then
SelectedMachine = MachineList(0)
End If
If Not IsNothing(SelectedMachine) Then
If EgtSetCurrMachine(SelectedMachine.Name) Then
InitCurrentMachine(Map.refMainWindowVM.MainWindowM.sMachinesRoot, SelectedMachine.Name)
End If
End If
End Sub
Friend Sub SaveCurrentMachine()
If IsNothing(m_SelectedMachine) Then Return
WriteMainPrivateProfileString(S_MACH, K_CURRMACH, SelectedMachine.Name)
End Sub
Friend Sub UpdateCurrentMachine()
'EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
Dim sMachName As String = String.Empty
If EgtGetCurrMachineName(sMachName) Then
For Each Mach In MachineList
If Mach.Name = sMachName Then
SelectedMachine = Mach
Exit For
End If
Next
End If
End Sub
#End Region
#Region "COMMANDS"
#Region "ToolDbCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property ToolDbCommand As ICommand
Get
If m_cmdToolDb Is Nothing Then
m_cmdToolDb = New Command(AddressOf ToolDb)
End If
Return m_cmdToolDb
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub ToolDb(ByVal param As Object)
If Not VerifyMachinesDir(m_sMachinesRoot) Then Return
' ricarico il database per intercettare eventuali aggiornamenti fatti da altre istanze del programma (se la cartella Machines è condivisa)
If Not EgtTdbReload() Then
EgtOutLog("Impossible reloading tool Db")
MessageBox.Show(EgtMsg(MSG_TOOLDBERRORS + 30), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
Dim ToolDbWindowVM As New ToolDbWindowVM(CurrentMachine.sMachDir, CurrentMachine.sMachIniFile, Map.refSceneHostVM.MainScene.GetCtx(), "Beam")
Dim ToolDbWindowV As New ToolDbWindowV(Application.Current.MainWindow, ToolDbWindowVM)
If ToolDbWindowVM.MatType <> 0 Then
ToolDbWindowV.Height = 640
ToolDbWindowV.Width = 1024
ToolDbWindowV.ShowDialog()
Else
Exit Sub
End If
If Not SetUpUtility.IsValidToolHeadExitInSetUp() Then
SetUp_Background = Brushes.Red
Else
SetUp_Background = OmagOFFICEDictionary.Button_Static_Background
End If
End Sub
#End Region ' ToolDbCommand
#Region "MachDbCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property MachDbCommand As ICommand
Get
If m_cmdMachDb Is Nothing Then
m_cmdMachDb = New Command(AddressOf MachDb)
End If
Return m_cmdMachDb
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub MachDb(ByVal param As Object)
If Not VerifyMachinesDir(m_sMachinesRoot) Then Return
' ricarico il database per intercettare eventuali aggiornamenti fatti da altre istanze del programma (se la cartella Machines è condivisa)
If Not EgtMdbReload() Then
EgtOutLog("Impossible reloading machining Db")
MessageBox.Show(EgtMsg(MSG_MACHININGDBERRORS + 8), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
Dim MachDbWindowVM As New EgtWPFLib5.MachiningDbWindowVM(CurrentMachine.sMachIniFile, Map.refSceneHostVM.MainScene.GetCtx(), "Stone")
Dim MachDbWindowV As New EgtWPFLib5.MachiningDbWindowV(Application.Current.MainWindow, MachDbWindowVM)
If EgtWPFLib5.MachiningTreeViewItem.m_MatType <> 0 Then
MachDbWindowV.Height = 768
MachDbWindowV.Width = 1024
MachDbWindowV.ShowDialog()
Else
Exit Sub
End If
End Sub
#End Region ' MachDbCommand
#Region "SetUpCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property SetUpCommand As ICommand
Get
If m_cmdSetUp Is Nothing Then
m_cmdSetUp = New Command(AddressOf SetUp)
End If
Return m_cmdSetUp
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub SetUp(ByVal param As Object)
' verifico che il file di configurazione attrezzaggio (lua) della macchina esista
If Not File.Exists(CurrentMachine.sMachDir & "\Scripts\" & SETUP_LUA) Then
EgtOutLog("SetUp error: SetUp configuration file doesn't exist ")
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
' carico Lua che contiene le funzioni per ottenere le posizioni valide dell'utensile selezionato,
' e testa e uscita dell'utensile attrezzato
EgtLuaExecFile(CurrentMachine.sMachDir & "\Scripts\" & SETUP_LUA)
' verifico che le teste riportate in configurazione esistano
Dim Index As Integer = 1
Dim nErr As Integer = 0
While nErr = 0
Dim sHead As String = String.Empty
nErr = 999
EgtLuaSetGlobIntVar("STU.INDEX", Index)
EgtLuaCallFunction("STU.GetTcPosHeadGroupFromPos")
' Leggo variabili
EgtLuaGetGlobStringVar("STU.HEAD", sHead)
EgtLuaGetGlobIntVar("STU.ERR", nErr)
If nErr = 0 Then
If EgtGetHeadExitCount(sHead) = 0 Then
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 8), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
End If
Index += 1
End While
' Reset lua
EgtLuaResetGlobVar("STU")
Dim SetUpWindow As New SetUpWindowV(Application.Current.MainWindow, New SetUpWindowVM(CurrentMachine.sMachDir, CurrentMachine.sMachineName))
SetUpWindow.Height = 614
SetUpWindow.Width = 1024
SetUpWindow.ShowDialog()
End Sub
#End Region ' SetUpCommand
#Region "MachOptionsCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property MachOptionsCommand As ICommand
Get
If m_cmdMachOptions Is Nothing Then
m_cmdMachOptions = New Command(AddressOf MachOptions)
End If
Return m_cmdMachOptions
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub MachOptions(ByVal param As Object)
End Sub
#End Region ' MachOptionsCommand
#End Region ' COMMANDS
End Class
@@ -0,0 +1,346 @@
Imports System.Threading
Imports System.Math
Imports EgtUILib
Imports EgtWPFLib5
Imports EgtBEAMWALL.Core
Public Class MainWindowM
#Region "FIELDS"
' massimo numero di istanze del programma ammesse
Const MAX_INST As Integer = 1
Private m_sDataRoot As String = String.Empty
Friend ReadOnly Property sDataRoot As String
Get
Return m_sDataRoot
End Get
End Property
Private m_sConfigDir As String = String.Empty
Public ReadOnly Property sConfigDir As String
Get
Return m_sConfigDir
End Get
End Property
Private m_nDebug As Integer = 0
Private m_objMutex As Mutex
Private m_bFirstInstance As Boolean = False
Friend ReadOnly Property bFirstInstance As Boolean
Get
Return m_bFirstInstance
End Get
End Property
Private m_nInstance As Integer = 0
Friend ReadOnly Property nInstance As Integer
Get
Return m_nInstance
End Get
End Property
Private m_nUserLevel As Integer = 1
Friend ReadOnly Property nUserLevel As Integer
Get
Return m_nUserLevel
End Get
End Property
Private m_nKeyLevel As Integer = 0
Friend ReadOnly Property nKeyLevel As Integer
Get
Return m_nKeyLevel
End Get
End Property
Private m_nKeyOptions As UInteger = 0
Friend ReadOnly Property nKeyOptions As Integer
Get
Return m_nKeyOptions
End Get
End Property
Private m_bAutoNestOption As Boolean = False
Friend ReadOnly Property AutoNestOption As Boolean
Get
Return m_bAutoNestOption
End Get
End Property
Friend ReadOnly Property sVersion As String
Get
Return My.Application.Info.Version.Major.ToString() & "." &
My.Application.Info.Version.Minor.ToString() &
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString()
End Get
End Property
Private m_sTempDir As String
Friend ReadOnly Property sTempDir As String
Get
Return m_sTempDir
End Get
End Property
Private m_sMachinesRoot As String
Friend ReadOnly Property sMachinesRoot As String
Get
Return m_sMachinesRoot
End Get
End Property
Private m_sBeamRoot As String
Friend ReadOnly Property sBeamRoot As String
Get
Return m_sBeamRoot
End Get
End Property
Private m_sWallRoot As String
Friend ReadOnly Property sWallRoot As String
Get
Return m_sWallRoot
End Get
End Property
Private m_sWarehouseRoot As String
Friend ReadOnly Property sWarehouseRoot As String
Get
Return m_sWarehouseRoot
End Get
End Property
Private m_sToolMakersDir As String
Friend ReadOnly Property sToolMakersDir As String
Get
Return m_sToolMakersDir
End Get
End Property
Private m_sResourcesRoot As String
Friend ReadOnly Property sResourcesRoot As String
Get
Return m_sResourcesRoot
End Get
End Property
Private m_sLogFile As String
Friend ReadOnly Property sLogFile As String
Get
Return m_sLogFile
End Get
End Property
Friend ReadOnly Property sProjsDir As String
Get
Return m_sDataRoot & "\" & PROJS_DIR
End Get
End Property
Friend ReadOnly Property sProdsDir As String
Get
Return m_sDataRoot & "\" & PRODS_DIR
End Get
End Property
#End Region ' FIELDS
#Region "CONSTRUCTOR"
Sub New()
InitializeEgtEnvironment()
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Private Sub InitializeEgtEnvironment()
'' Abilito drag and drop
'Me.AllowDrop = True
' Impostazione path radice per i dati
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
If EgtUILib.GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
End If
' Impostazione direttorio di configurazione
m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
' Impostazione direttorio per file temporanei
m_sTempDir = m_sDataRoot & "\" & TEMP_DIR
' Impostazione path Ini file
IniFile.m_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME
' Impostazione path BTL Ini File
BTLIniFile.m_sBTLIniFile = m_sConfigDir & "\" & BTLFEATURES_FILE_NAME
' Impostazione path resources dir
m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR
' Impostazione direttorio per le macchine
If GetMainPrivateProfileString(S_MACH, K_MACHINESDIR, "", m_sMachinesRoot) = 0 Then
m_sMachinesRoot = m_sDataRoot & "\" & MACHINES_DFL_DIR
End If
' Impostazione direttorio per toolmakers
If GetMainPrivateProfileString(S_MACH, K_TOOLMAKERSDIR, "", m_sToolMakersDir) = 0 Then
m_sToolMakersDir = m_sDataRoot & "\" & TOOLMAKERS_DFL_DIR
End If
' Impostazione direttori Beam e Wall
If GetMainPrivateProfileString(S_BEAM, K_BEAMBASEDIR, "", m_sBeamRoot) = 0 Then
m_sBeamRoot = m_sDataRoot & "\" & BEAM_DIR
End If
If GetMainPrivateProfileString(S_WALL, K_WALLBASEDIR, "", m_sWallRoot) = 0 Then
m_sWallRoot = m_sDataRoot & "\" & WALL_DIR
End If
m_sWarehouseRoot = m_sDataRoot & "\" & WAREHOUSE_DIR
' Verifico indice di istanza
ManageInstance()
' Imposto tipo di chiave
EgtSetLockType(KEY_TYPE.HW)
' Leggo e imposto chiave di protezione
Dim sLicFileName As String = String.Empty
GetMainPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName)
Dim sLicFile As String = m_sConfigDir & "\" & sLicFileName
Dim sKey As String = String.Empty
EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
EgtSetKey(sKey)
Dim sNestKey As String = ""
EgtUILib.GetPrivateProfileString(S_LICENCE, K_NESTKEY, "", sNestKey, sLicFile)
EgtSetNestKey(sNestKey)
' Verifico abilitazione nesting automatico
m_bAutoNestOption = Not String.IsNullOrWhiteSpace(sNestKey)
' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(3279, 2301, 1, m_nKeyLevel) And
EgtGetKeyOptions(3279, 2301, 1, m_nKeyOptions)
' Inizializzazione generale di EgtInterface
m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
m_sLogFile = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & m_nInstance.ToString() & ")" & vbLf &
My.Application.Info.Title.ToString() & " ver. " &
My.Application.Info.Version.Major.ToString() &
"." & My.Application.Info.Version.Minor.ToString() &
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString()
EgtInit(m_nDebug, m_sLogFile, sLogMsg)
EgtSetTempDir(m_sTempDir)
EgtSetIniFile(IniFile.m_sIniFile)
' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione)
Dim sMsgDir As String = String.Empty
If GetMainPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir) = 0 Then
sMsgDir = m_sConfigDir
End If
' Leggo lingua corrente
Dim sLanguage As String = String.Empty
GetMainPrivateProfileString(S_GENERAL, K_MESSAGES, "", sLanguage)
' Recupero nome file dei messaggi della lingua corrente
Dim sMsgName As String = "EgalTechIta.txt"
Dim nIndex As Integer = 1
While True
Dim ReadLanguage As Language = GetMainPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
If IsNothing(ReadLanguage) Then Exit While
If String.Compare(ReadLanguage.Name, sLanguage, True) = 0 Then
sMsgName = ReadLanguage.FilePath
Exit While
End If
nIndex += 1
End While
' Leggo file messaggi
Dim sMsgFilePath As String = sMsgDir & "\" & sMsgName
If Not EgtLoadMessages(sMsgFilePath) Then
EgtOutLog("Error in EgtLoadMessages")
End If
' Leggo e imposto unità di misura per interfaccia utente
EgtSetUiUnits(GetMainPrivateProfileInt(S_GENERAL, K_MMUNITS, 1) <> 0)
' Leggo e imposto livello utilizzatore
m_nUserLevel = Math.Min(m_nKeyLevel, GetMainPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1))
' Imposto dir font Nfe e font default
Dim sNfeDir As String = String.Empty
GetMainPrivateProfileString(S_GEOMDB, K_NFEFONTDIR, "", sNfeDir)
Dim sDefFont As String = String.Empty
GetMainPrivateProfileString(S_GEOMDB, K_DEFAULTFONT, "", sDefFont)
EgtSetFont(sNfeDir, sDefFont)
' imposto dir di default per libreria Lua e lancio libreria di base
Dim sLuaLibsDir As String = String.Empty
GetMainPrivateProfileString(S_LUA, K_LIBSDIR, "", sLuaLibsDir)
EgtSetLuaLibs(sLuaLibsDir)
Dim sLuaBaseLib As String = String.Empty
GetMainPrivateProfileString(S_LUA, K_BASELIB, "EgtBase", sLuaBaseLib)
EgtLuaRequire(sLuaBaseLib)
' Info su opzioni chiave
EgtOutLog("KeyOptions : " & bKey.ToString() & " " & m_nKeyOptions.ToString())
End Sub
Private Sub ManageInstance()
Dim bCreated As Boolean
Try
m_objMutex = New Mutex(False, "Global\OmagOFFICE", bCreated)
Catch
bCreated = False
End Try
m_bFirstInstance = bCreated
If bCreated Then
' Prima istanza
m_nInstance = 1
' Aggiorno stato istanze attive
WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, m_nInstance.ToString())
Else
' Leggo il massimo numero di istanze ammesse
Dim nMaxInst As Integer = GetMaxInstances()
' Cerco il primo indice di istanza libero
Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
m_nInstance = 1
Dim nMask As Integer = 1
While (nTmp And nMask) <> 0 And m_nInstance < MAX_INST
m_nInstance += 1
nMask *= 2
End While
' Se l'indice supera il massimo
If m_nInstance > nMaxInst Then
' porto in primo piano la prima istanza
Dim bFound As Boolean = False
' processi del programma a 32 bit
Dim localProc As Process() = Process.GetProcessesByName("OmagOFFICER32")
For Each p As Process In localProc
If p.Id <> Process.GetCurrentProcess().Id Then
bFound = True
ShowWindow(p.MainWindowHandle, 1)
Exit For
End If
Next
' se non trovati processi a 32 bit provo a 64 bit
If Not bFound Then
localProc = Process.GetProcessesByName("OmagOFFICER64")
For Each p As Process In localProc
If p.Id <> Process.GetCurrentProcess().Id Then
bFound = True
ShowWindow(p.MainWindowHandle, SW.RESTORE)
Exit For
End If
Next
End If
' esco dal programma
End
End If
' Aggiorno stato istanze attive
nTmp += (1 << (m_nInstance - 1))
WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
End If
End Sub
Friend Function GetKeyOption(nKeyOpt As KEY_OPT) As Boolean
Return ((m_nKeyOptions And nKeyOpt) <> 0)
End Function
Friend Function GetMaxInstances() As Integer
' Leggo il massimo numero di istanze ammesse
Dim nMaxInst As Integer = GetMainPrivateProfileInt(S_GENERAL, K_MAXINST, 1)
Return Max(1, Min(nMaxInst, MAX_INST))
End Function
Friend Sub Close()
' Terminazione generale di EgtInterface
EgtExit()
' Rilascio mutex
If Not IsNothing(m_objMutex) Then m_objMutex.Close()
' Aggiorno istanze usate
Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
nTmp -= (1 << (m_nInstance - 1))
WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
End Sub
#End Region ' METHODS
End Class
@@ -1,6 +1,7 @@
<EgtWPFLib5:EgtCustomWindow x:Class="MainWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Supervisor"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
DataContext="{StaticResource MainWindowVM}"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
@@ -13,6 +14,8 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<EgtBEAMWALL:ProjectV DataContext="{StaticResource ProjectVM}"/>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Right">
<Button Content="˄"
@@ -1,9 +1,23 @@
Imports EgtBEAMWALL.Core
Public Class MainWindowVM
Inherits VMBase
Private m_SupervisorId As String = "A"
Private m_SupervisorMachineName As String = "Essetre-FAST"
' Riferimento al Model della MainWindow
Private m_MainWindowM As MainWindowM
Friend ReadOnly Property MainWindowM As MainWindowM
Get
Return m_MainWindowM
End Get
End Property
' Titolo
Private m_Title As String
Public ReadOnly Property Title As String
Get
Return m_Title
End Get
End Property
Private m_MachGroupList As New List(Of MyMachGroupM)
Public Property MachGroupList As List(Of MyMachGroupM)
@@ -34,18 +48,58 @@ Public Class MainWindowVM
#Region "CONSTRUCTOR"
Sub New()
'' Avvio l'inizializzazione della mappa passandogli il riferimento al MainWindowVM
'Map.BeginInit(Me)
' Avvio l'inizializzazione della mappa passandogli il riferimento al MainWindowVM
Map.BeginInit(Me)
'' Creo Model della MainWindow
'm_MainWindowM = New MainWindowM
Dim TempList As List(Of DataLayer.DatabaseModels.MachGroupModel) = DbControllers.m_MachGroupController.GetByProdSupervisor(1, m_SupervisorId)
For Each MachGroup In TempList
'''m_MachGroupList.Add(New BeamMachGroupM(MachGroup.MachGroupDbId, MachGroup.Name, m_SupervisorMachineName))
Next
m_MainWindowM = New MainWindowM
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub SetTitle(sTitle As String)
m_Title = sTitle
NotifyPropertyChanged(NameOf(Title))
End Sub
Public Sub UpdateTitle()
m_Title = Map.refSupervisorManagerVM.CurrProd.nProdId.ToString("0000") & " - EgtBEAMWALL"
NotifyPropertyChanged(NameOf(Title))
End Sub
'Friend Sub ContentRendered()
' Verifico che l'inizializzazione di tutte le parti del programma sia andata a buon fine
' If Map.EndInit() Then
' m_bInitStatus = True
' altrimenti chiudo il programma
' Else
' m_bInitStatus = False
' End If
' Aggiorno visualizzazione unità di misura
' Map.refStatusBarVM.SetMeasureUnit(If(EgtUiUnitsAreMM(), MeasureUnitOpt.MM, MeasureUnitOpt.INCH))
' Se istanza oltre la prima, chiedo cosa aprire
' If Not m_MainWindowM.bFirstInstance Then
' Map.refProjectManagerVM.Open()
' ' altrimenti verifico se richiesto ultimo progetto
' ElseIf GetMainPrivateProfileInt(S_GENERAL, K_AUTOLOADLASTPROJ, 0) = 1 Then
' Dim sLastProjectPath As String = String.Empty
' GetMainPrivateProfileString(S_GENERAL, K_LASTPROJ, String.Empty, sLastProjectPath)
' If Not String.IsNullOrWhiteSpace(sLastProjectPath) AndAlso File.Exists(sLastProjectPath) Then
' Map.refProjectManagerVM.OpenProject(sLastProjectPath)
' Else
' Map.refProjectManagerVM.NewCmd()
' End If
' ' altrimenti nuovo progetto
' Else
' Map.refProjectManagerVM.NewCmd()
' End If
' apro in modalita' VIEW
' Map.refMainMenuVM.SelPage = Pages.VIEW
'End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "CompletedRawPart"
@@ -0,0 +1,60 @@
<EgtWPFLib5:EgtCustomWindow x:Class="OpenProjectFileDialogV"
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"
Title="{Binding Title}"
Style="{DynamicResource {x:Type EgtWPFLib5:EgtCustomWindow}}"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False"
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
Height="390" Width="300" Topmost="True"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
<EgtWPFLib5:EgtCustomWindow.Resources>
<EgtWPFLib5:FileNameConverter x:Key="FileNameConverter"/>
</EgtWPFLib5:EgtCustomWindow.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="5*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<ListBox Grid.Row="0"
ItemsSource="{Binding ProjectList}"
SelectedItem="{Binding SelProject}"
Margin="5">
<!--<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ProjFileName}"/>
</DataTemplate>
</ListBox.ItemTemplate>-->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
<Setter Property="Padding" Value="0"></Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding OpenFileName}"
Padding="4,1,4,1">
<TextBlock.InputBindings>
<MouseBinding MouseAction="LeftDoubleClick"
Command="{Binding DataContext.ProjectDoubleClick_Command, RelativeSource={RelativeSource AncestorType={x:Type ListBox}}}"
CommandParameter="{Binding nProjId}" />
</TextBlock.InputBindings>
</TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<UniformGrid Columns="2" Grid.Row="1" Margin="0,0,0,5">
<Button IsDefault="True" Name="OpenBtn"
Content="{Binding OpenMsg}" Style="{DynamicResource EgtWPFLib5_InputButton}"/>
<Button IsCancel="True"
Content="{Binding CancelMsg}" Style="{DynamicResource EgtWPFLib5_InputButton}"/>
</UniformGrid>
</Grid>
</EgtWPFLib5:EgtCustomWindow>
@@ -0,0 +1,72 @@
Imports System.ComponentModel
Imports System.IO
Imports EgtBEAMWALL.Core.ConstBeam
Imports EgtUILib
Public Class OpenProjectFileDialogV
Private WithEvents m_OpenProjFileDialogVM As OpenProjectFileDialogVM
#Region "CONSTRUCTOR"
Sub New(Owner As Window, OpenProjFileDialogVM As OpenProjectFileDialogVM)
' Funzione che interpreta l'xaml
InitializeComponent()
Me.Owner = Owner
Me.DataContext = OpenProjFileDialogVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_OpenProjFileDialogVM = OpenProjFileDialogVM
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Public Function EgtShowDialog(ProjectType As ProjectType) As Boolean?
m_OpenProjFileDialogVM.Init(ProjectType)
' mostro la finestra di dialogo
Return Me.ShowDialog()
End Function
Public Function EgtShowDialog(ProjectType As ProjectType, ProjectList As List(Of ProjectFileVM)) As Boolean?
m_OpenProjFileDialogVM.Init(ProjectType, ProjectList)
' mostro la finestra di dialogo
Return Me.ShowDialog()
End Function
#End Region ' METHODS
#Region "EVENTS"
'Private Sub MainWindowV_ContentRendered(sender As Object, e As EventArgs) Handles Me.ContentRendered
' m_MainWindowVM.ContentRendered()
'End Sub
#End Region ' EVENTS
'Private Sub m_FileNameTxBl_MouseDown(sender As Object, e As Windows.Input.MouseButtonEventArgs) Handles FileNameList.MouseDoubleClick
' Dim src As DependencyObject = VisualTreeHelper.GetParent(DirectCast(e.OriginalSource, DependencyObject))
' ' verifico che venga clickato un item, non lo spazio vuoto o la scrollbar
' If Not TypeOf src Is ListBoxItem Then
' src = Utility.FindAncestor(Of ListBoxItem)(src)
' End If
' If IsNothing(src) OrElse src.[GetType]() <> GetType(ListBoxItem) Then
' e.Handled = True
' Else
' If Not IsNothing(m_SelectedFile) Then
' m_FileName = SelectedFile
' DialogResult = True
' End If
' End If
'End Sub
Private Sub OpenBtn_Click(sender As Object, e As RoutedEventArgs) Handles OpenBtn.Click
DialogResult = m_OpenProjFileDialogVM.VerifySelected()
End Sub
Private Sub CloseWindow(bDialogResult As Boolean) Handles m_OpenProjFileDialogVM.m_CloseWindow
Me.DialogResult = bDialogResult
End Sub
End Class
@@ -0,0 +1,191 @@
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.Core.ConstBeam
Imports EgtUILib
Public Class OpenProjectFileDialogVM
Inherits VMBase
Friend Event m_CloseWindow(bDialogResult As Boolean)
Private m_ProjectType As ProjectType
Private m_FileNameTxBl As TextBlock
Private m_sDirectory As String
Public Property Directory As String
Get
Return m_sDirectory
End Get
Set(value As String)
m_sDirectory = value
End Set
End Property
Private m_sFilter As String
Public Property Filter As String
Get
Return m_sFilter
End Get
Set(value As String)
m_sFilter = value
End Set
End Property
Private m_sFileNameFilter As Predicate(Of String)
Public Property FileNameFilter As Predicate(Of String)
Get
Return m_sFileNameFilter
End Get
Set(value As Predicate(Of String))
m_sFileNameFilter = value
End Set
End Property
Private m_sExtensions As New List(Of String)
Public ReadOnly Property Extensions As List(Of String)
Get
Return m_sExtensions
End Get
End Property
Private m_ProjectList As New List(Of ProjectFileVM)
Public ReadOnly Property ProjectList As List(Of ProjectFileVM)
Get
Return m_ProjectList
End Get
'Set(value As List(Of ProjFile))
' m_ProjList = value
' NotifyPropertyChanged("ProjList")
'End Set
End Property
Private m_SelProject As ProjectFileVM
Public Property SelProject As ProjectFileVM
Get
Return m_SelProject
End Get
Set(value As ProjectFileVM)
m_SelProject = value
End Set
End Property
Private m_FileName As String
Public Property FileName As String
Get
Return m_FileName
End Get
Set(value As String)
m_FileName = value
End Set
End Property
#Region "Messages"
Public ReadOnly Property OpenMsg As String
Get
Return EgtMsg(MSG_EGTSAVEFILEDIALOG + 6)
End Get
End Property
Public ReadOnly Property CancelMsg As String
Get
Return EgtMsg(MSG_EGTSAVEFILEDIALOG + 2)
End Get
End Property
#End Region
' Definizione comandi
Private m_cmdProjectDoubleClick As ICommand
Public Function Init(ProjectType As ProjectType, Optional ProjectList As List(Of ProjectFileVM) = Nothing) As Boolean?
m_ProjectType = ProjectType
If IsNothing(ProjectList) OrElse ProjectList.Count = 0 Then
' leggo da db
If ProjectType = ProjectType.PROJ Then
'Dim DbProjectList As New List(Of ProjFileM)
'DbProjectList = DbControllers.m_ProjController.GetLastDesc(50)
'For Each Project In DbProjectList
' m_ProjectList.Add(New ProjFileVM(Project))
'Next
ElseIf ProjectType = ProjectType.PROD Then
Dim DbProjectList As New List(Of ProdFileM)
DbProjectList = DbControllers.m_ProdController.GetLastDesc(50)
For Each Project In DbProjectList
m_ProjectList.Add(New ProdFileVM(Project))
Next
End If
Else
m_ProjectList = ProjectList
End If
End Function
Friend Function VerifySelected() As Boolean
Dim AllFilesInDir As IEnumerable(Of String)
If m_ProjectType = Core.ConstBeam.ProjectType.PROJ Then
' verifico se esiste ProdId
AllFilesInDir = IO.Directory.EnumerateFiles(SelProject.sProjDirPath)
ElseIf m_ProjectType = Core.ConstBeam.ProjectType.PROD Then
AllFilesInDir = IO.Directory.EnumerateFiles(SelProject.sProdDirPath)
End If
For Each File In AllFilesInDir
If Path.GetExtension(File).ToLower() = ".nge" Then
Return True
End If
Next
Return False
End Function
'Private Sub m_FileNameTxBl_MouseDown(sender As Object, e As Windows.Input.MouseButtonEventArgs) Handles FileNameList.MouseDoubleClick
' Dim src As DependencyObject = VisualTreeHelper.GetParent(DirectCast(e.OriginalSource, DependencyObject))
' ' verifico che venga clickato un item, non lo spazio vuoto o la scrollbar
' If Not TypeOf src Is ListBoxItem Then
' src = Utility.FindAncestor(Of ListBoxItem)(src)
' End If
' If IsNothing(src) OrElse src.[GetType]() <> GetType(ListBoxItem) Then
' e.Handled = True
' Else
' If Not IsNothing(m_SelectedFile) Then
' m_FileName = SelectedFile
' DialogResult = True
' End If
' End If
'End Sub
'Private Sub OpenBtn_Click(sender As Object, e As RoutedEventArgs) Handles OpenBtn.Click
' If Not IsNothing(m_SelectedFile) Then
' m_FileName = SelectedFile
' DialogResult = True
' End If
'End Sub
#Region "COMMANDS"
#Region "ProjectDoubleClick"
''' <summary>
''' Returns a command that do New.
''' </summary>
Public ReadOnly Property ProjectDoubleClick_Command As ICommand
Get
If m_cmdProjectDoubleClick Is Nothing Then
m_cmdProjectDoubleClick = New Command(AddressOf ProjDoubleClick)
End If
Return m_cmdProjectDoubleClick
End Get
End Property
''' <summary>
''' Execute the New. This method is invoked by the NewCommand.
''' </summary>
Friend Sub ProjDoubleClick(ByVal param As Object)
If VerifySelected() Then
RaiseEvent m_CloseWindow(True)
End If
End Sub
#End Region ' ProjectDoubleClick
#End Region ' Commands
End Class
@@ -0,0 +1,33 @@
<EgtFloating:EgtFloatingManager x:Class="ProjectV"
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"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Supervisor">
<EgtFloating:EgtFloatingTray x:Name="PROJECTTOPTRAY" DockPanel.Dock="Top">
<EgtBEAMWALL:SupervisorManagerV DataContext="{StaticResource SupervisorManagerVM}"/>
<EgtBEAMWALL:MachinePanelV DataContext="{StaticResource MachinePanelVM}"
Visibility="Collapsed"/>
</EgtFloating:EgtFloatingTray>
<!--<EgtBEAMWALL:LeftPanelV DockPanel.Dock="Left"
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:BottomPanelV DockPanel.Dock="Bottom"
DataContext="{StaticResource BottomPanelVM}"
Tag="{Binding DataContext.BTLStructureVM.SelBTLPart, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"
Visibility="{Binding DataContext.BottomPanel_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"/>-->
<EgtFloating:EgtFloatingTray x:Name="SCENETOPTRAY"
DockPanel.Dock="Top">
<EgtBEAMWALL:ShowPanelV DataContext="{StaticResource ShowPanelVM}"/>
<!--<EgtBEAMWALL:ShowBeamPanelV DataContext="{StaticResource ShowBeamPanelVM}"
Visibility="{Binding DataContext.ShowBeamPanel_Visibility, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:ProjectV}}}"/>-->
<EgtBEAMWALL:ViewPanelV DataContext="{StaticResource ViewPanelVM}"/>
<!--<EgtBEAMWALL:InstrumentPanelV DataContext="{StaticResource InstrumentPanelVM}"/>-->
</EgtFloating:EgtFloatingTray>
<EgtBEAMWALL:SceneHostV/>
</EgtFloating:EgtFloatingManager>
@@ -0,0 +1,3 @@
Public Class ProjectV
End Class
+144
View File
@@ -0,0 +1,144 @@
Public Class ProjectVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Private m_MachGroupPanelVM As MyMachGroupPanelVM
Public Property MachGroupPanelVM As MyMachGroupPanelVM
Get
Return m_MachGroupPanelVM
End Get
Set(value As MyMachGroupPanelVM)
m_MachGroupPanelVM = value
NotifyPropertyChanged(NameOf(MachGroupPanelVM))
End Set
End Property
Private m_LeftPanel_Visibility As Boolean = True
Public Property LeftPanel_Visibility As Visibility
Get
Return If(m_LeftPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_LeftPanel_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetLeftPanel_Visibility(IsVisible As Boolean)
m_LeftPanel_Visibility = IsVisible
End Sub
Private m_TopPanel_Visibility As Boolean = False
Public Property TopPanel_Visibility As Visibility
Get
Return If(m_TopPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_TopPanel_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetTopPanel_Visibility(IsVisible As Boolean)
m_TopPanel_Visibility = IsVisible
End Sub
Private m_BottomPanel_Visibility As Boolean = True
Public Property BottomPanel_Visibility As Visibility
Get
Return If(m_BottomPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_BottomPanel_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetBottomPanel_Visibility(IsVisible As Boolean)
m_BottomPanel_Visibility = IsVisible
End Sub
Private m_PartManager_Visibility As Boolean = True
Public Property PartManager_Visibility As Visibility
Get
Return If(m_PartManager_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_PartManager_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetPartManager_Visibility(IsVisible As Boolean)
m_PartManager_Visibility = IsVisible
End Sub
Private m_FeatureManager_Visibility As Boolean = True
Public Property FeatureManager_Visibility As Visibility
Get
Return If(m_FeatureManager_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_FeatureManager_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetFeatureManager_Visibility(IsVisible As Boolean)
m_FeatureManager_Visibility = IsVisible
End Sub
Private m_ShowBeamPanel_Visibility As Boolean = True
Public Property ShowBeamPanel_Visibility As Visibility
Get
Return If(m_ShowBeamPanel_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_ShowBeamPanel_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetShowBeamPanel_Visibility(IsVisible As Boolean)
m_ShowBeamPanel_Visibility = IsVisible
End Sub
Private m_ProjManager_Visibility As Boolean = True
Public Property ProjManager_Visibility As Visibility
Get
Return If(m_ProjManager_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_ProjManager_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetProjManager_Visibility(IsVisible As Boolean)
m_ProjManager_Visibility = IsVisible
End Sub
Private m_ProdManager_Visibility As Boolean = True
Public Property ProdManager_Visibility As Visibility
Get
Return If(m_ProdManager_Visibility, Visibility.Visible, Visibility.Collapsed)
End Get
Set(value As Visibility)
m_ProdManager_Visibility = (value = Visibility.Visible)
End Set
End Property
Friend Sub SetProdManager_Visibility(IsVisible As Boolean)
m_ProdManager_Visibility = IsVisible
End Sub
Friend Sub NotifyAllPanelVisibility()
NotifyPropertyChanged("LeftPanel_Visibility")
NotifyPropertyChanged("TopPanel_Visibility")
NotifyPropertyChanged("BottomPanel_Visibility")
NotifyPropertyChanged("PartManager_Visibility")
NotifyPropertyChanged("FeatureManager_Visibility")
NotifyPropertyChanged("ShowBeamPanel_Visibility")
NotifyPropertyChanged("ProjManager_Visibility")
NotifyPropertyChanged("ProdManager_Visibility")
End Sub
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in Map
Map.SetRefProjectVM(Me)
End Sub
#End Region ' CONSTRUCTOR
End Class
@@ -0,0 +1,183 @@
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Public Class ProdFileVM
Inherits ProjectFileVM
Public ReadOnly Property ProdFileM As ProdFileM
Get
Return m_ProjectFileM
End Get
End Property
Public ReadOnly Property nProjIdList As List(Of Integer)
Get
Return ProdFileM.nProjIdList
End Get
End Property
Public Overrides ReadOnly Property nProdId As Integer
Get
Return ProdFileM.nProdId
End Get
End Property
Friend Overrides ReadOnly Property sProdDirPath As String
Get
Dim sPath As String = String.Empty
If IsNothing(ProdFileM.nProdId) OrElse ProdFileM.nProdId = 0 Then Return String.Empty
Return refMainWindowVM.MainWindowM.sProdsDir & "\" & nProdId.ToString("0000")
End Get
End Property
Friend Overrides ReadOnly Property sProdPath As String
Get
Dim sPath As String = String.Empty
If IsNothing(ProdFileM.nProdId) OrElse ProdFileM.nProdId = 0 Then Return String.Empty
Return refMainWindowVM.MainWindowM.sProdsDir & "\" & nProdId.ToString("0000") & "\" & nProdId.ToString("0000") & ".nge"
End Get
End Property
Public Overrides Property bIsNew As Boolean
Get
Return ProdFileM.bIsNew
End Get
Set(value As Boolean)
ProdFileM.bIsNew = value
End Set
End Property
' nome del file mostrato nella finestra OpenProjFileDialog
Public ReadOnly Property OpenFileName As String
Get
Return ProdFileM.nProdId.ToString("0000")
End Get
End Property
#Region "CONSTRUCTORS"
Sub New(ProdFileM As ProdFileM)
m_ProjectFileM = ProdFileM
End Sub
'Sub New(nProjectType As ProjectType, ProjectFileName As String)
' m_nProjectType = nProjectType
' If m_nProjectType = ProjectType.PROJ Then
' Dim DataFromFileName As String() = ProjectFileName.Split(FILENAMESEPARATOR)
' If Not String.IsNullOrEmpty(DataFromFileName(0)) Then
' Integer.TryParse(DataFromFileName(0), m_nProjId)
' End If
' If Not String.IsNullOrEmpty(DataFromFileName(1)) Then
' Integer.TryParse(DataFromFileName(1), m_nProdId)
' Else
' m_nProdId = 0
' End If
' If Not String.IsNullOrEmpty(DataFromFileName(2)) Then
' m_BTLFileName = DataFromFileName(2)
' End If
' ElseIf m_nProjectType = ProjectType.PROD Then
' Integer.TryParse(ProjectFileName, m_nProdId)
' End If
'End Sub
'Sub New(nProjectType As ProjectType, nProjId As Integer, nProdId As Integer, sBTLFileName As String)
' MyBase.New(nProjectType, nProjId, nProdId, sBTLFileName)
'End Sub
#End Region ' CONSTRUCTORS
' funzione che restituisce le parti di nome file
Friend Shared Function VerifyProjectFile(nProjectType As ProjectType, ProjectFileName As String, ByRef nProjId As Integer, ByRef nProdId As Integer, ByRef sBTLFileName As String) As Boolean
If nProjectType = ProjectType.PROJ Then
Dim DataFromFileName As String() = ProjectFileName.Split(FILENAMESEPARATOR)
If DataFromFileName.Count = 3 Then
If Not String.IsNullOrEmpty(DataFromFileName(0)) Then
Integer.TryParse(DataFromFileName(0), nProjId)
Else Return False
End If
If Not String.IsNullOrEmpty(DataFromFileName(1)) Then
Integer.TryParse(DataFromFileName(1), nProdId)
Else
nProdId = 0
End If
If Not String.IsNullOrEmpty(DataFromFileName(2)) Then
sBTLFileName = DataFromFileName(2)
End If
Return True
Else Return False
End If
ElseIf nProjectType = ProjectType.PROD Then
Return Integer.TryParse(ProjectFileName, nProdId)
Else Return False
End If
End Function
' funzione che dato un nome file e il tipo restituisce il corretto numero di progetto
Friend Shared Function GetProjectNumber(nProjectType As ProjectType, ProjectFileName As String, ByRef nProjId As Integer, ByRef nProdId As Integer, ByRef sBTLFileName As String) As Boolean
If String.IsNullOrWhiteSpace(ProjectFileName) Then
nProjId = 0
nProdId = 0
sBTLFileName = ""
Return False
ElseIf ProjectFileName.Contains(FILENAMESEPARATOR) Then
Dim DataFromFileName As String() = ProjectFileName.Split(FILENAMESEPARATOR)
If DataFromFileName.Count = 3 Then
If Not String.IsNullOrEmpty(DataFromFileName(0)) Then
Integer.TryParse(DataFromFileName(0), nProjId)
Else Return False
End If
If Not String.IsNullOrEmpty(DataFromFileName(1)) Then
Integer.TryParse(DataFromFileName(1), nProdId)
Else
nProdId = 0
End If
If Not String.IsNullOrEmpty(DataFromFileName(2)) Then
sBTLFileName = DataFromFileName(2)
End If
Return True
Else Return False
End If
ElseIf nProjectType = ProjectType.PROJ Then
Dim ProjectFileNameProd As String = Integer.TryParse(ProjectFileName, nProdId)
Dim nTempProjId As Integer = 0
Dim nTempProdId As Integer = 0
Dim sTempBTLFileName As String = ""
' ricavo lista cartelle proj
Dim AllDirsInDir As IEnumerable(Of String) = IO.Directory.EnumerateDirectories(Map.refMainWindowVM.MainWindowM.sProjsDir)
For Each Directory In AllDirsInDir
Dim AllFilesInDir As IEnumerable(Of String) = IO.Directory.EnumerateFiles(Directory)
For Each File In AllFilesInDir
If Path.GetExtension(File).ToLower() = ".nge" Then
If File.Contains(FILENAMESEPARATOR) Then
Dim DataFromFileName As String() = ProjectFileName.Split(FILENAMESEPARATOR)
If DataFromFileName.Count = 3 Then
If Not String.IsNullOrEmpty(DataFromFileName(0)) Then
Integer.TryParse(DataFromFileName(0), nTempProjId)
Else Return False
End If
If Not String.IsNullOrEmpty(DataFromFileName(1)) Then
Integer.TryParse(DataFromFileName(1), nTempProdId)
Else
nProdId = 0
End If
If Not String.IsNullOrEmpty(DataFromFileName(2)) Then
sTempBTLFileName = DataFromFileName(2)
End If
If ProjectFileNameProd = nTempProdId Then
nProjId = nTempProjId
nProdId = nTempProdId
sTempBTLFileName = sBTLFileName
Return True
End If
Else Return False
End If
End If
End If
Next
Next
End If
Return False
End Function
End Class
@@ -0,0 +1,75 @@
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Public Class ProjectFileVM
Inherits VMBase
Protected m_ProjectFileM As ProjectFileM
Public Overridable ReadOnly Property nProjId As Integer
Get
Return m_ProjectFileM.nProjId
End Get
End Property
Public Overridable ReadOnly Property nProdId As Integer
Get
Return m_ProjectFileM.nProdId
End Get
End Property
Friend Overridable ReadOnly Property sProjDirPath As String
Get
If IsNothing(m_ProjectFileM.nProjId) OrElse m_ProjectFileM.nProjId = 0 Then Return String.Empty
Return refMainWindowVM.MainWindowM.sProjsDir & "\" & nProjId.ToString("0000")
End Get
End Property
Friend Overridable ReadOnly Property sProjPath As String
Get
Dim sPath As String = String.Empty
If IsNothing(m_ProjectFileM.nProjId) OrElse m_ProjectFileM.nProjId = 0 Then Return String.Empty
sPath = refMainWindowVM.MainWindowM.sProjsDir & "\" & nProjId.ToString("0000") & "\" & nProjId.ToString("0000") & ".nge"
Return sPath
End Get
End Property
Friend Overridable ReadOnly Property sProdDirPath As String
Get
Dim sPath As String = String.Empty
If IsNothing(m_ProjectFileM.nProdId) OrElse m_ProjectFileM.nProdId = 0 Then Return String.Empty
Return refMainWindowVM.MainWindowM.sProdsDir & "\" & nProdId.ToString("0000")
End Get
End Property
Friend Overridable ReadOnly Property sProdPath As String
Get
Dim sPath As String = String.Empty
If IsNothing(m_ProjectFileM.nProdId) OrElse m_ProjectFileM.nProdId = 0 Then Return String.Empty
Return refMainWindowVM.MainWindowM.sProdsDir & "\" & nProdId.ToString("0000") & "\" & nProdId.ToString("0000") & ".nge"
End Get
End Property
Public Overridable Property bIsNew As Boolean
Get
Return m_ProjectFileM.bIsNew
End Get
Set(value As Boolean)
m_ProjectFileM.bIsNew = value
End Set
End Property
Private Property m_bIsLocked As Boolean = False
Public Overridable Property bIsLocked As Boolean
Get
Return m_bIsLocked
End Get
Set(value As Boolean)
m_bIsLocked = value
End Set
End Property
#Region "CONSTRUCTORS"
#End Region ' CONSTRUCTORS
End Class
Binary file not shown.

After

Width:  |  Height:  |  Size: 1002 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

@@ -0,0 +1,494 @@
Imports System.Windows.Interop
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Imports EgtBEAMWALL.Core
Public Class MySceneHostVM
Inherits EgtWPFLib5.SceneHostVM
' Identificativi per pezzo da selezionare/deselezionare
Private m_nIdToSel As Integer = GDB_ID.NULL
Private m_nIdToDesel As Integer = GDB_ID.NULL
' Dati movimento
Private m_dMaxStep As Double = 0
' Dati per Drag
Private m_nRestRadius As Integer = 3
Private m_bDrag As Boolean = False
Private m_bDragToStart As Boolean = False
Private m_bVerify As Boolean = False
Private m_bFromParking As Boolean = False
Private m_bDragging As Boolean = False
Private m_locPrev As System.Drawing.Point
Private m_ptPrev As Point3d
Private m_vtTotMove As Vector3d
Private m_dSnapDist As Double = 0
Private bReducedCut As Boolean = False
Private m_bMagnetic As Boolean
#Region "CONSTRUCTOR"
Sub New()
MyBase.New()
AddHandler MainController.OnNewProject, AddressOf OnNewProject
AddHandler MainController.OnOpenProject, AddressOf OnOpenProject
AddHandler MainController.OnSavingProject, AddressOf OnSavingProject
AddHandler MainController.OnSavedProject, AddressOf OnSavedProject
AddHandler MainController.OnImportingProject, AddressOf OnImportingProject
AddHandler MainController.OnImportedProject, AddressOf OnImportedProject
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Overrides Sub InitScene()
InitSceneEvents()
' Inizializzazione Scena
PreInitializeScene()
' Se tutto bene
If MainScene.Init() Then 'And Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.OFFICE_BASE) Then
PostInitializeScene()
' Imposto stato gestione mouse diretto della scena a nessuno
MainScene.SetStatusNull()
' Recupero e imposto handle finestra principale
Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle
EgtSetMainWindowHandle(hMainWnd)
EgtSetCurrentContext(MainScene.GetCtx())
' inizializzo gestore travi e pareti
EgtInitBeamMgr(EIB_FL.TS3_POS + EIB_FL.USEUATTR)
' inizializzo gestore lavorazioni
EgtInitMachMgr(Map.refMainWindowVM.MainWindowM.sMachinesRoot, Map.refMainWindowVM.MainWindowM.sToolMakersDir)
' Seleziono la macchina impostata nel file ini
Map.refMachinePanelVM.LoadCurrentMachine()
Return
End If
' Problemi
' Se manca la chiave
If Map.refMainWindowVM.MainWindowM.nKeyLevel = -1 Or Map.refMainWindowVM.MainWindowM.nKeyLevel = -2 Then
EgtOutLog("Missing Dongle")
' Box di avviso chiave mancante : "Chiave non presente. \n Inserirla e riavviare il programma." "Errore"
Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 2) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 3)
Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1)
MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
' Altrimenti manca la licenza
Else
EgtOutLog("Problems with Licence")
' Box di avviso licenza con problemi : "Programma senza licenza. \n Caricala e riavvia il programma." "Errore"
Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 5) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 6)
Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1)
If MessageBox.Show(sText, sTitle, MessageBoxButton.OKCancel, MessageBoxImage.Error) = MessageBoxResult.OK Then
' Apro dialogo per richiesta file licenza
Dim LicDlg As New Microsoft.Win32.OpenFileDialog() With {
.DefaultExt = ".lic",
.Filter = "Licences (.lic)|*.lic",
.CheckFileExists = True,
.ValidateNames = True
}
If LicDlg.ShowDialog() = True Then
' Recupero il direttorio del file
Dim sDir As String = Path.GetDirectoryName(LicDlg.FileName)
' Se il file non è già nel direttorio di configurazione lo copio
If Not String.Equals(Path.GetFullPath(sDir), Path.GetFullPath(Map.refMainWindowVM.MainWindowM.sConfigDir), StringComparison.OrdinalIgnoreCase) Then
Try
File.Copy(LicDlg.FileName, Path.Combine(Map.refMainWindowVM.MainWindowM.sConfigDir, LicDlg.SafeFileName), True)
Catch ex As Exception
End Try
End If
' Imposto il nuovo file di licenza nell'Ini
WriteMainPrivateProfileString(S_GENERAL, K_LICENCE, LicDlg.SafeFileName)
End If
End If
End If
' Chiudo il programma
End
End Sub
Public Overrides Sub InitSceneEvents()
AddHandler MainScene.OnMouseDownScene, AddressOf OnMouseDownScene
AddHandler MainScene.OnMouseMoveScene, AddressOf OnMouseMoveScene
AddHandler MainScene.OnMouseUpScene, AddressOf OnMouseUpScene
AddHandler MainScene.KeyDown, AddressOf OnKeyDownScene
AddHandler MainScene.OnCursorPos, AddressOf OnCursorPos
AddHandler MainScene.OnShowDistance, AddressOf OnShowDistance
AddHandler MainScene.OnChangedSnapPointType, AddressOf OnChangedSnapPointType
End Sub
Private Sub PreInitializeScene()
' imposto colore di default
Dim DefColor As New Color3d(0, 0, 0)
GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor)
MainScene.SetDefaultMaterial(DefColor)
' imposto colori sfondo
Dim BackTopColor As New Color3d(192, 192, 192)
GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor)
Dim BackBotColor As New Color3d(BackTopColor)
GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor)
MainScene.SetViewBackground(BackTopColor, BackBotColor)
' imposto colore di evidenziazione
Dim MarkColor As New Color3d(255, 255, 0)
GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor)
MainScene.SetMarkMaterial(MarkColor)
' imposto colore per superfici selezionate
Dim SelSurfColor As New Color3d(255, 255, 192)
GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor)
MainScene.SetSelSurfMaterial(SelSurfColor)
' imposto tipo e colore del rettangolo di zoom
Dim bOutline As Boolean = True
Dim ZwColor As New Color3d(0, 0, 0)
GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor)
MainScene.SetZoomWinAttribs(bOutline, ZwColor)
' imposto colore della linea di distanza
Dim DstLnColor As New Color3d(255, 0, 0)
GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor)
MainScene.SetDistLineMaterial(DstLnColor)
' imposto parametri OpenGL
Dim nDriver As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DRIVER, 3)
Dim b2Buff As Boolean = (GetMainPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0)
Dim nColorBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_COLORBITS, 32)
Dim nDepthBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32)
MainScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
End Sub
Private Sub PostInitializeScene()
' Impostazioni Controller
MainController.SetScene(MainScene)
' imposto tipo coordinate
MainScene.SetGridCursorPos(True)
' modo di visualizzazione
Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING)
' Map.refShowPanelVM.SetShowMode(DirectCast(nShowMode, SM))
' visualizzazione avanzata dei triangoli costituenti le superfici
Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0)
EgtSetShowTriaAdv(bShowTriaAdv)
' tipo visualizzazione per Zmap
Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1)
EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False)
' dimensione lineare max in pixel delle textures
Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096)
EgtSetTextureMaxLinPixels(nTxrMaxLinPix)
' tipo snap point
MainScene.SetSnapPointType(SP.PT_SKETCH)
End Sub
#End Region ' METHODS
#Region "ProjectManager"
Public Overrides Sub NewProject()
EgtSetCurrentContext(MainScene.GetCtx())
Dim bOk As Boolean = MainController.NewProject()
MainScene.SetStatusNull()
End Sub
Public Overrides Sub OpenProject(sFilePath As String)
EgtSetCurrentContext(MainScene.GetCtx())
Dim bOk As Boolean = False
If String.IsNullOrEmpty(sFilePath) Then
' Recupero cartella dell'ultimo progetto aperto
Dim sDir As String = MainController.GetCurrFile()
If String.IsNullOrWhiteSpace(sDir) Then
GetMainPrivateProfileString(S_MRUFILES, K_FILE, "", sDir)
End If
If Not String.IsNullOrWhiteSpace(sDir) Then
sDir = Path.GetDirectoryName(sDir)
End If
bOk = MainController.OpenProject(sDir)
Else
bOk = MainController.OpenProject(sFilePath, False)
End If
MainScene.SetStatusNull()
End Sub
Public Overrides Sub SaveProject()
MyBase.SaveProject()
' Imposto stato gestione mouse diretto della scena a nessuno
MainScene.SetStatusNull()
End Sub
Public Overrides Sub SaveAsProject()
MyBase.SaveAsProject()
' Imposto stato gestione mouse diretto della scena a nessuno
MainScene.SetStatusNull()
End Sub
Public Overrides Sub ImportProject()
Dim sDir As String = String.Empty
GetMainPrivateProfileString(S_MRUIMPORT, K_FILE & "1", "", sDir)
If Not String.IsNullOrWhiteSpace(sDir) Then
sDir = Path.GetDirectoryName(sDir)
End If
sDir.TrimEnd("\"c)
MainController.ImportProject(sDir)
End Sub
#End Region ' ProjectManager
#Region "EVENTS"
Private Sub OnNewProject(sender As Object, bOk As Boolean)
End Sub
Private Sub OnOpenProject(sender As Object, sFile As String, bOk As Boolean)
' Procedo a seconda del risultato
If bOk Then
' leggo MachGroup
Map.refProjectVM.MachGroupPanelVM = New MyMachGroupPanelVM(MyMachGroupPanelM.CreateMyMachGroupPanel(Map.refMachinePanelVM.MachineList.ToList()))
WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile)
Else
EgtNewFile()
Map.refMainWindowVM.SetTitle(" New - EgtBEAMWALL")
Dim sMsg As String = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file
MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error
End If
MainScene.SetStatusNull()
End Sub
Private Sub OnSavingProject(ByVal sender As Object, sFile As String)
End Sub
Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
' Se salvataggio non riuscito, esco subito
If Not bOk Then
Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file
MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error
Return
End If
' Salvo nome ultimo file
WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile)
End Sub
Private Sub OnImportingProject(sender As Object, nType As Integer, ByRef nFlag As Integer)
If nType = FT.BTL Or nType = FT.BTLX Then
nFlag = GetMainPrivateProfileInt(S_IMPORT, K_BTLFLAG, EIB_FL.TS3_POS + EIB_FL.SORT + EIB_FL.USEUATTR)
Else
MessageBox.Show(Application.Current.MainWindow, EgtMsg(10005), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' File type unknown - Error
End If
End Sub
Private Sub OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean)
End Sub
Private Sub OnMouseDownScene(sender As Object, e As Forms.MouseEventArgs)
If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
Dim SelectedMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup
If SelectedMachGroup.nMachineType = MachineType.WALL Then
Wall_OnMouseDownScene(sender, e)
End If
End If
End Sub
Private Sub OnMouseMoveScene(sender As Object, e As Forms.MouseEventArgs)
If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
Dim SelectedMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup
If SelectedMachGroup.nMachineType = MachineType.WALL Then
Wall_OnMouseMoveScene(sender, e)
End If
End If
End Sub
Private Sub OnMouseUpScene(sender As Object, e As Forms.MouseEventArgs)
If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then
Dim SelectedMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup
If SelectedMachGroup.nMachineType = MachineType.WALL Then
Wall_OnMouseUpScene(sender, e)
End If
End If
End Sub
Private Sub OnKeyDownScene(sender As Object, e As System.Windows.Forms.KeyEventArgs)
End Sub
Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String)
'Map.refStatusBarVM.SetCurrPos(sCursorPos)
End Sub
Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String)
'Map.refMyStatusBarVM.SetOutputMessage(sDistance)
End Sub
Private Sub OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bUser As Boolean)
Dim BtnColor As Brush
If bUser Then
BtnColor = New SolidColorBrush(SystemColors.ControlColor)
Else
BtnColor = Brushes.Bisque
End If
'Select Case nSpType
' Case SP.PT_SKETCH
' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1102), BtnColor) 'Sketch Point
' Case SP.PT_GRID
' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1104), BtnColor) 'Grid Point
' Case SP.PT_END
' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1106), BtnColor) 'End Point
' Case SP.PT_MID
' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1108), BtnColor) 'Mid Point
' Case SP.CENTER
' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1110), BtnColor) 'Center
' Case SP.CENTROID
' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1112), BtnColor) 'Centroid
' Case SP.PT_NEAR
' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1114), BtnColor) 'Near Point
' Case SP.PT_INTERS
' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1116), BtnColor) 'Inters Point
' Case SP.PT_TANGENT
' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1118), BtnColor) 'Tang Point
' Case SP.PT_PERPENDICULAR
' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1120), BtnColor) 'Perp Point
' Case SP.PT_MINDIST
' Map.refStatusBarVM.SetSnapPointType(EgtMsg(1122), BtnColor) 'MinDist Point
' Case Else
' Map.refStatusBarVM.SetSnapPointType("---", BtnColor)
'End Select
End Sub
#End Region ' EVENTS
#Region "WALL EVENTS"
Friend Sub Wall_OnMouseDownScene(sender As Object, e As Forms.MouseEventArgs)
' Per default no drag
m_bDrag = False
' Verifico se selezionato indicativo di pezzo
EgtSetObjFilterForSelWin(True, True, True, True, True)
Dim nSel As Integer
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel)
Dim nId As Integer = EgtGetFirstObjInSelWin()
While nId <> GDB_ID.NULL
' Recupero l'identificativo del pezzo cui appartiene
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
'''Dim WallMachGroup As WallMachGroup = DirectCast(Map.refMachGroupPanelVM.SelectedMachGroup, WallMachGroup)
'''Dim bPartInTable As Boolean = (EgtGetParent(nPartId) = WallMachGroup.nRawPartId)
'''If EgtIsPart(nPartId) OrElse EgtIsDuplo(nPartId) OrElse bPartInTable Then
''' Dim nStat As Integer = GDB_ST.ON_
''' EgtGetStatus(nPartId, nStat)
''' ' Se già selezionato
''' If nStat = GDB_ST.SEL Then
''' ' Memorizzo Id da deselezionare
''' m_nIdToDesel = nPartId
''' Else
''' ' Memorizzo Id da selezionare
''' m_nIdToSel = nPartId
''' End If
''' ' Drag possibile
''' m_bDrag = True
''' Exit While
'''End If
nId = EgtGetNextObjInSelWin()
End While
' Dati per drag
m_locPrev = e.Location
m_bDrag = m_bDrag AndAlso EgtUnProjectPoint(e.Location, m_ptPrev)
m_bDragToStart = m_bDrag
m_bVerify = m_bDrag AndAlso (Keyboard.Modifiers And ModifierKeys.Shift) > 0
m_vtTotMove = Vector3d.NULL()
End Sub
Friend Sub Wall_OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Se drag non abilitato o già in esecuzione, esco
If Not m_bDrag Or m_bDragging Then Return
' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel
If m_bDragToStart Then
'If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And
' Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
' Return
'End If
m_bDragToStart = False
End If
' Determino cosa muovere
Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL)
' Inizio esecuzione di drag
m_bDragging = True
' Ricavo il punto corrente in coordinate mondo
Dim ptCurr As Point3d
EgtUnProjectPoint(e.Location, ptCurr)
' Ricavo il vettore di movimento
Dim vtMove As Vector3d = ptCurr - m_ptPrev
' Muovo i pezzi selezionati di quanto possibile
If vtMove.SqLen() > EPS_SMALL * EPS_SMALL Then
' Se movimento con sola verifica finale
If m_bVerify Then
Dim x = EgtMove(nMoveId, vtMove)
m_vtTotMove += vtMove
' altrimenti caso con verifica durante il movimento
Else
'' Aggiorno regioni per nesting
'UpdateNestRegions() !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'EnableReferenceRegion(False)
' muovo il pezzo
Dim x = EgtMovePartInRawPart(nMoveId, vtMove) 'EgtMovePart(nMoveId, bReducedCut, vtMove)
EgtSaveCollInfo()
' se movimento risultante nullo, provo con movimento tangente
Dim bTgMoved As Boolean = False
If vtMove.IsSmall() Then
' riprovo con movimento tangente
Dim vtTgMove As Vector3d = ptCurr - m_ptPrev
EgtTgMovePartOnCollision(nMoveId, bReducedCut, vtTgMove)
bTgMoved = (Not vtTgMove.IsSmall())
End If
' se abilitato magnetico (allineamento + snap), lo provo
Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False
If m_bMagnetic Then
'If Not GetLockOnRotation(nMoveId) Then
EgtAlignPartOnCollision(nMoveId, bReducedCut, bAlignMoved)
'End If
If m_dSnapDist > EPS_SMALL Then
EgtRestoreCollInfo()
EgtMovePartToSnapPointOnCollision(nMoveId, bReducedCut, m_dSnapDist, bSnapMoved)
End If
End If
End If
EgtDraw()
End If
' Aggiorno il punto precedente
m_ptPrev = ptCurr
' Terminata esecuzione di drag
m_bDragging = False
End Sub
Friend Sub Wall_OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Se eseguito drag
If Not m_bDragToStart Then
' Se movimento con sola verifica finale
If m_bVerify Then
' Determino cosa verificare
Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL)
'' Aggiorno regioni per nesting
'UpdateNestRegions() !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'EnableReferenceRegion(False)
' Eseguo verifica
If EgtVerifyPart(nMoveId, bReducedCut) Then
' Non superata riporto alla posizione iniziale
Else
EgtMove(nMoveId, -m_vtTotMove)
End If
'm_bFromParking = False
' altrimenti caso con verifica durante il movimento
Else
' Basta reset alla fine
End If
' Se selezione da eseguire
ElseIf m_nIdToSel <> GDB_ID.NULL Then
' Eseguo la selezione
EgtSelectObj(m_nIdToSel)
' Se deselezione da eseguire
ElseIf m_nIdToDesel <> GDB_ID.NULL Then
EgtDeselectObj(m_nIdToDesel)
End If
' Reset
m_bDrag = False
m_nIdToSel = GDB_ID.NULL
m_nIdToDesel = GDB_ID.NULL
'' Se nessun pezzo selezionato, reset flag posizione selezionati
'If EgtGetSelectedObjCount() = 0 Then
' m_nPartPos = PART_POS.NONE_TABLE
'End If
EgtDraw()
End Sub
#End Region ' WALL EVENTS
End Class
@@ -0,0 +1,10 @@
<UserControl x:Class="SceneHostV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtUILib="clr-namespace:EgtUILib;assembly=EgtUILib">
<WindowsFormsHost>
<EgtUILib:Scene x:Name="MainScene"/>
</WindowsFormsHost>
</UserControl>
@@ -0,0 +1,19 @@
Imports System.Windows.Interop
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class SceneHostV
Private m_MySceneHostVM As MySceneHostVM
Sub New()
' This call is required by the designer.
InitializeComponent()
' Assegno al riferimento locale al VM il VM preso dal DataContext
Me.DataContext = New MySceneHostVM
m_MySceneHostVM = DirectCast(Me.DataContext, MySceneHostVM)
m_MySceneHostVM.SetMainScene(MainScene)
End Sub
End Class
@@ -0,0 +1,24 @@
<EgtFloating:EgtFloatingPanel x:Class="ShowPanelV"
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" Style="{StaticResource ToolBar_EgtFloatingPanel}">
<RadioButton ToolTip="{Binding RenderingWFToolTip}"
Style="{StaticResource ToolBar_ToggleButton}"
IsChecked="{Binding WireframeIsChecked}">
<Image Source="/Resources/ShowPanel/RenderingWF.png" Stretch="Uniform"/>
</RadioButton>
<RadioButton ToolTip="{Binding RenderingHLToolTip}"
Style="{StaticResource ToolBar_ToggleButton}"
IsChecked="{Binding HiddenLineIsChecked}">
<Image Source="/Resources/ShowPanel/RenderingHL.png" Stretch="Uniform"/>
</RadioButton>
<RadioButton ToolTip="{Binding RenderingSHToolTip}"
Style="{StaticResource ToolBar_ToggleButton}"
IsChecked="{Binding ShadingIsChecked}">
<Image Source="/Resources/ShowPanel/RenderingSH.png" Stretch="Uniform"/>
</RadioButton>
</EgtFloating:EgtFloatingPanel>
@@ -0,0 +1,3 @@
Public Class ShowPanelV
End Class
@@ -11,44 +11,36 @@ Public Class SupervisorManagerVM
#Region "FIELDS & PROPERTIES"
Private m_CurrProd As ProjectFileM
Friend Property CurrProd As ProjectFileM
Private m_CurrProd As ProdFileVM
Friend Property CurrProd As ProdFileVM
Get
Return m_CurrProd
End Get
Set(value As ProjectFileM)
Set(value As ProdFileVM)
m_CurrProd = value
End Set
End Property
' indice ultimo progetto
Private m_nLastProdId As Integer
Friend ReadOnly Property nLastProdId As Integer
Get
Return m_nLastProdId
End Get
End Property
' Definizione comandi
Private m_cmdOpen As ICommand
Private m_cmdSave As ICommand
Private m_cmdGoToProj As ICommand
'Private m_cmdSave As ICommand
'Private m_cmdGoToProj As ICommand
#Region "ToolTip"
'#Region "ToolTip"
'Proprietà ToolTip
Public ReadOnly Property OpenToolTip As String
Get
Return EgtMsg(MSG_TOPCOMMANDBAR + 2)
End Get
End Property
Public ReadOnly Property SaveToolTip As String
Get
Return EgtMsg(MSG_TOPCOMMANDBAR + 3)
End Get
End Property
' 'Proprietà ToolTip
' Public ReadOnly Property OpenToolTip As String
' Get
' Return EgtMsg(MSG_TOPCOMMANDBAR + 2)
' End Get
' End Property
' Public ReadOnly Property SaveToolTip As String
' Get
' Return EgtMsg(MSG_TOPCOMMANDBAR + 3)
' End Get
' End Property
#End Region ' ToolTip
'#End Region ' ToolTip
#End Region ' Fields & Properties
@@ -56,39 +48,17 @@ Public Class SupervisorManagerVM
Sub New()
' Creo riferimento a questa classe in Map
Map.SetRefProdManagerVM(Me)
' Leggo ultimo indice di progetto
m_nLastProdId = GetMainPrivateProfileInt(S_GENERAL, K_PRODSINDEX, 1)
Map.SetRefSupervisorManagerVM(Me)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Function InitNewProject(ByRef nProjId As Integer, ByRef nProdId As Integer, ByRef sProjectDir As String) As Boolean
' richiedo indice nuovo progetto
nProdId = DbControllers.m_ProdController.GetNextIndex(nProjId)
If nProdId <= 0 Then Return False
sProjectDir = refMainWindowVM.MainWindowM.sProdsDir & "\" & nProdId.ToString("0000")
' creo cartella nuovo progetto
If Not Directory.Exists(sProjectDir) Then
Directory.CreateDirectory(sProjectDir)
Else
Dim di As System.IO.DirectoryInfo = New DirectoryInfo(sProjectDir)
For Each file As FileInfo In di.EnumerateFiles()
file.Delete()
Next
For Each dir As DirectoryInfo In di.EnumerateDirectories()
dir.Delete(True)
Next
End If
Return True
End Function
Public Function SetCurrProd(nProdId As Integer) As Boolean
Dim Currprod As ProdModel = DbControllers.m_ProdController.FindByProdId(nProdId)
If IsNothing(Currprod) Then Return False
Map.refProdManagerVM.CurrProd = New ProdFileVM(ProdFileM.CreateProdFileM(Currprod.ProdId, New List(Of Integer), Date.Now(), ""))
m_CurrProd = New ProdFileVM(ProdFileM.CreateProdFileM(Currprod.ProdId, New List(Of Integer), Date.Now(), ""))
Return True
End Function
@@ -118,8 +88,8 @@ Public Class SupervisorManagerVM
End Sub
Friend Sub OpenProject()
' verifico se progetto modificato, e chiedo se salvare
ProdFileVM.VerifyProjectModification(CurrProd)
'' verifico se progetto modificato, e chiedo se salvare
'ProdFileVM.VerifyProjectModification(CurrProd)
Dim sFilePath As String = ""
' se la string è vuota
Dim TempCurrProd As ProdFileVM
@@ -153,124 +123,14 @@ Public Class SupervisorManagerVM
Map.refSceneHostVM.MainController.NewProject()
Map.refMainWindowVM.SetTitle("New - EgtBEAMWALL")
End If
Dim TempList As List(Of DataLayer.DatabaseModels.MachGroupModel) = DbControllers.m_MachGroupController.GetByProdSupervisor(Map.refSupervisorManagerVM.CurrProd.nProdId, m_SupervisorId)
For Each MachGroup In TempList
'''m_MachGroupList.Add(New BeamMachGroupM(MachGroup.MachGroupDbId, MachGroup.Name, m_SupervisorMachineName))
Next
End Sub
#End Region ' OpenCommand
#Region "SaveCommand"
''' <summary>
''' Returns a command that do Save.
''' </summary>
Public ReadOnly Property SaveCommand As ICommand
Get
If m_cmdSave Is Nothing Then
m_cmdSave = New Command(AddressOf Save)
End If
Return m_cmdSave
End Get
End Property
''' <summary>
''' Execute the Save. This method is invoked by the SaveCommand.
''' </summary>
Public Sub Save()
If IsNothing(m_CurrProd) Then Return
Map.refSceneHostVM.SaveProject()
Map.refMainWindowVM.SetTitle(CurrProd.nProdId.ToString("0000") & " - EgtBEAMWALL")
Dim MyMachGroupList As New List(Of MyMachGroupM)
For Each MachGroup In Map.refProjectVM.MachGroupPanelVM.m_MyMachGroupPanelM.MachGroupMList
MyMachGroupList.Add(MachGroup)
Next
'For Each MachGroup In Map.refProjectVM.MachGroupPanelVM.MachGroupVMList
' If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
' MyMachGroupList.Add(BeamMachGroupM.CreateBeamMachGroup(MachGroup.Id, MachGroup.Name, MachGroup.Machine))
' ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.WALL Then
' MyMachGroupList.Add(New WallMachGroup(MachGroup.Id, MachGroup.Name, MachGroup.Machine))
' End If
'Next
'If Map.refMachinePanelVM.SelectedMachine.nType = MachineType.BEAM Then
' MyMachGroupList = Map.refProjectVM.MachGroupPanelVM.MachGroupList.Select(Function(x) New Core.BeamMachGroup(x.Id, x.Name, x.Machine)).ToList()
'ElseIf Map.refMachinePanelVM.SelectedMachine.nType = MachineType.wall Then
' MyMachGroupList = Map.refProjectVM.MachGroupPanelVM.MachGroupList.Select(Function(x) New Core.WallMachGroup(x.Id, x.Name, x.Machine))
'End If
DbControllers.m_ProdController.UpdateMachGroup(CurrProd.nProdId, MyMachGroupList)
End Sub
#End Region ' SaveCommand
#Region "GoToProj"
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public ReadOnly Property GoToProj_Command As ICommand
Get
If m_cmdGoToProj Is Nothing Then
m_cmdGoToProj = New Command(AddressOf GoToProj)
End If
Return m_cmdGoToProj
End Get
End Property
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Friend Sub GoToProj()
' verifico se salvare progetto corrente
ProdFileVM.VerifyProjectModification(Map.refProdManagerVM.CurrProd)
' recupero Proj associato da Db
Dim DbProjList As List(Of DataLayer.DatabaseModels.ProjModel) = DbControllers.m_ProjController.GetByProdAsc(m_CurrProd.nProdId)
Dim nProjId As Integer = 0
Dim sBTLFileName As String = ""
If Not IsNothing(DbProjList) AndAlso DbProjList.Count > 0 AndAlso DbProjList(0).ProjId > 0 Then
nProjId = DbProjList(0).ProjId
sBTLFileName = DbProjList(0).BTLFileName
End If
'' cerco proj associato
'Dim ProjList As New List(Of ProjectFile)
'Dim AllDirsInDir As IEnumerable(Of String) = IO.Directory.EnumerateDirectories(Map.refMainWindowVM.MainWindowM.sProjsDir)
'For Each Directory In AllDirsInDir
' Dim AllFilesInDir As IEnumerable(Of String) = IO.Directory.EnumerateFiles(Directory)
' For Each File In AllFilesInDir
' If Path.GetExtension(File).ToLower() = ".nge" Then
' If File.Contains(FILENAMESEPARATOR) Then
' Dim DataFromFileName As String() = File.Split(FILENAMESEPARATOR)
' If DataFromFileName.Count = 3 Then
' If Not String.IsNullOrEmpty(DataFromFileName(1)) Then
' Dim nTempProdId As Integer = 0
' Integer.TryParse(DataFromFileName(1), nTempProdId)
' If nTempProdId = CurrProd.nProdId Then
' ProjList.Add(New ProjectFile(ProjectType.PROJ, Path.GetFileNameWithoutExtension(File)))
' End If
' End If
' End If
' End If
' End If
' Next
'Next
'If ProjList.Count = 0 Then Return
'' se c'è più di un proj
'Dim Proj As ProjectFile
'If ProjList.Count > 1 Then
' ' apro dialogo di scelta file
' Dim OpenProjectFileDialogVM As New OpenProjectFileDialogVM
' Dim OpenFile As New OpenProjectFileDialogV(Application.Current.MainWindow, OpenProjectFileDialogVM)
' Dim DialogResult As Boolean? = OpenFile.EgtShowDialog(ProjectType.PROJ, ProjList)
' If IsNothing(DialogResult) OrElse Not DialogResult Then Return
' Proj = OpenProjectFileDialogVM.SelProject
'Else
' Proj = ProjList(0)
'End If
' apro progetto proj
Map.refProjManagerVM.SetCurrProj(nProjId)
' vado in pagina proj
Map.refMainMenuVM.SetSelPage(Pages.VIEW, False)
End Sub
#End Region ' GoToProj
#End Region ' Commands
End Class
@@ -0,0 +1,99 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Public Module CurrentMachine
' Nome macchina corrente
Private m_sMachineName As String = String.Empty
' Direttorio macchina corrente
Private m_sMachDir As String = String.Empty
' File ini della macchina
Private m_sMachIniFile As String = String.Empty
' File ini dei parametri macchina
Private m_sMachParamIniFile As String = String.Empty
#Region "Proprietà che leggono e scrivono i valori anche da o su file ini"
Friend ReadOnly Property sMachineName As String
Get
Return m_sMachineName
End Get
End Property
Friend ReadOnly Property sMachDir As String
Get
Return m_sMachDir
End Get
End Property
Friend ReadOnly Property sMachIniFile As String
Get
Return m_sMachIniFile
End Get
End Property
Friend ReadOnly Property sMachParamIniFile As String
Get
Return m_sMachParamIniFile
End Get
End Property
#End Region
'Private m_MachTableList As New ObservableCollection(Of MachTable)
'Public Property MachTableList As ObservableCollection(Of MachTable)
' Get
' Return m_MachTableList
' End Get
' Set(value As ObservableCollection(Of MachTable))
' m_MachTableList = value
' End Set
'End Property
#Region "Init"
Sub InitCurrentMachine(sMachinesRootDir As String, sMachineName As String)
' Nome macchina corrente
m_sMachineName = sMachineName
' Impostazione direttorio macchina
m_sMachDir = sMachinesRootDir & "\" & sMachineName
' Impostazione path MachIni file
m_sMachIniFile = sMachinesRootDir & "\" & sMachineName & "\" & sMachineName & ".ini"
' Impostazione path MachParamIni file
m_sMachParamIniFile = sMachinesRootDir & "\" & sMachineName & "\" & K_BEAM & "\" & MACH_INI_FILE_NAME
' crea l'elenco dei parametri della macchina corrente
CreateMachParams()
End Sub
#End Region 'Init
#Region "Methods"
' funzione che crea l'elenco dei parametri Macchina
Friend Sub CreateMachParams()
'MachTableList.Clear()
'Dim NewMachParam As MachParam = Nothing
'Dim MachParamList As New ObservableCollection(Of MachParam)
'Dim TableIndex = 1
'Dim ParamIndex As Integer = 1
'Dim TableName As String = String.Empty
'' verifico che ci sia una table con l'indice designato e ne leggo il nome
'While GetMachPrivateProfileString(TableIndex, K_NAME, "", TableName)
' ' leggo tutti i parametri della table
' While MachParamIniFile.GetMachPrivateProfileParam(TableIndex, ParamIndex, NewMachParam)
' MachParamList.Add(NewMachParam)
' ParamIndex += 1
' End While
' MachTableList.Add(New MachTable(TableName, MachParamList))
' ' aggiorno indici e resetto lista per lettura dell'eventuale table successiva
' TableIndex += 1
' ParamIndex = 1
' MachParamList = New ObservableCollection(Of MachParam)
'End While
End Sub
#End Region 'Methods
End Module
@@ -2,6 +2,7 @@
Friend m_SupervisorId As String = "1"
Public m_ProdController As New DataLayer.Controllers.ProdController
Public m_MachGroupController As New DataLayer.Controllers.MachGroupController
End Module
+11 -11
View File
@@ -10,21 +10,21 @@
it in xaml file(ProjectView.xaml).
-->
<EgtBEAMWALL:MainWindowVM x:Key="MainWindowVM"/>
<!--<EgtBEAMWALL:MySceneHostVM x:Key="MySceneHostVM"/>-->
<!--<EgtBEAMWALL:ProjManagerVM x:Key="ProjManagerVM"/>
<EgtBEAMWALL:ProdManagerVM x:Key="ProdManagerVM"/>
<EgtBEAMWALL:MainMenuVM x:Key="MainMenuVM"/>
<EgtBEAMWALL:MyStatusBarVM x:Key="StatusBarVM"/>
<EgtBEAMWALL:MySceneHostVM x:Key="MySceneHostVM"/>
<!--<EgtBEAMWALL:ProjManagerVM x:Key="ProjManagerVM"/>-->
<EgtBEAMWALL:SupervisorManagerVM x:Key="SupervisorManagerVM"/>
<!--<EgtBEAMWALL:MainMenuVM x:Key="MainMenuVM"/>
<EgtBEAMWALL:MyStatusBarVM x:Key="StatusBarVM"/>-->
<EgtBEAMWALL:ProjectVM x:Key="ProjectVM"/>
<EgtWPFLib5:ShowPanelVM x:Key="ShowPanelVM"/>
<EgtBEAMWALL:ShowBeamPanelVM x:Key="ShowBeamPanelVM"/>
<!--<EgtBEAMWALL:ShowBeamPanelVM x:Key="ShowBeamPanelVM"/>-->
<EgtWPFLib5:ViewPanelVM x:Key="ViewPanelVM"/>
<EgtBEAMWALL:MyInstrumentPanelVM x:Key="InstrumentPanelVM"/>
<!--<EgtBEAMWALL:MyInstrumentPanelVM x:Key="InstrumentPanelVM"/>-->
<EgtBEAMWALL:MachinePanelVM x:Key="MachinePanelVM"/>
<EgtBEAMWALL:PartParametersVM x:Key="PartParametersVM"/>
<EgtBEAMWALL:LeftPanelVM x:Key="LeftPanelVM"/>
<EgtBEAMWALL:BottomPanelVM x:Key="BottomPanelVM"/>
<EgtBEAMWALL:ConfigurationPageVM x:Key="ConfigurationPageVM"/>
<!--<EgtBEAMWALL:PartParametersVM x:Key="PartParametersVM"/>-->
<!--<EgtBEAMWALL:LeftPanelVM x:Key="LeftPanelVM"/>
<EgtBEAMWALL:BottomPanelVM x:Key="BottomPanelVM"/>-->
<!--<EgtBEAMWALL:ConfigurationPageVM x:Key="ConfigurationPageVM"/>
<EgtBEAMWALL:TopPanelVM x:Key="TopPanelVM"/>
<EgtBEAMWALL:RawPartListVM x:Key="RawPartListVM"/>
<EgtBEAMWALL:OptimizePanelVM x:Key="OptimizePanelVM"/>-->
+306
View File
@@ -0,0 +1,306 @@
Imports EgtWPFLib5
Module Map
Private m_refMainWindowVM As MainWindowVM
'Private m_refMyStatusBarVM As MyStatusBarVM
'Private m_refProjManagerVM As ProjManagerVM
Private m_refSupervisorManagerVM As SupervisorManagerVM
Private m_refProjectVM As ProjectVM
'Private m_refMainMenuVM As MainMenuVM
Private m_refMachinePanelVM As MachinePanelVM
Private m_refMyMachGroupPanelVM As MyMachGroupPanelVM
'Private m_refLeftPanelVM As LeftPanelVM
'Private m_refBottomPanelVM As BottomPanelVM
'Private m_refShowBeamPanelVM As ShowBeamPanelVM
'Private m_refConfigurationPageVM As ConfigurationPageVM
'Private m_refRawPartListVM As RawPartListVM
'Private m_refWarehouseWndVM As WarehouseWndVM
'Private m_refRawPartTabVM As RawPartTabVM
'Private m_refNestingTabVM As NestingTabVM
'Private m_refMachiningTabVM As MachiningTabVM
'Private m_refSplitModeVM As SplitModeVM
'Private m_refMoveRawModeVM As MoveRawModeVM
'Private m_refSimulTabVM As SimulTabVM
#Region "Get"
Public ReadOnly Property refMainWindowVM As MainWindowVM
Get
Return m_refMainWindowVM
End Get
End Property
'Public ReadOnly Property refMyStatusBarVM As MyStatusBarVM
' Get
' Return LibMap.refStatusBarVM
' End Get
'End Property
'Public ReadOnly Property refProjManagerVM As ProjManagerVM
' Get
' Return m_refProjManagerVM
' End Get
'End Property
Public ReadOnly Property refSupervisorManagerVM As SupervisorManagerVM
Get
Return m_refSupervisorManagerVM
End Get
End Property
Public ReadOnly Property refProjectVM As ProjectVM
Get
Return m_refProjectVM
End Get
End Property
Public ReadOnly Property refSceneHostVM As SceneHostVM
Get
Return LibMap.refSceneHostVM
End Get
End Property
Public ReadOnly Property refShowPanelVM As ShowPanelVM
Get
Return LibMap.refShowPanelVM
End Get
End Property
'Public ReadOnly Property refMainMenuVM As MainMenuVM
' Get
' Return m_refMainMenuVM
' End Get
'End Property
Public ReadOnly Property refMachinePanelVM As MachinePanelVM
Get
Return m_refMachinePanelVM
End Get
End Property
'Public ReadOnly Property refLeftPanelVM As LeftPanelVM
' Get
' Return m_refLeftPanelVM
' End Get
'End Property
Public ReadOnly Property refMachGroupPanelVM As MyMachGroupPanelVM
Get
Return m_refMyMachGroupPanelVM
End Get
End Property
'Public ReadOnly Property refBottomPanelVM As BottomPanelVM
' Get
' Return m_refBottomPanelVM
' End Get
'End Property
'Public ReadOnly Property refShowBeamPanelVM As ShowBeamPanelVM
' Get
' Return m_refShowBeamPanelVM
' End Get
'End Property
'Public ReadOnly Property refConfigurationPageVM As ConfigurationPageVM
' Get
' Return m_refConfigurationPageVM
' End Get
'End Property
'Public ReadOnly Property refRawPartListVM As RawPartListVM
' Get
' Return m_refRawPartListVM
' End Get
'End Property
'Public ReadOnly Property refWarehouseWndVM As WarehouseWndVM
' Get
' Return m_refWarehouseWndVM
' End Get
'End Property
'Public ReadOnly Property refOptionPanelVM As OptionPanelVM
' Get
' Return m_refOptionPanelVM
' End Get
'End Property
'Public ReadOnly Property refRawPartTabVM As RawPartTabVM
' Get
' Return m_refRawPartTabVM
' End Get
'End Property
'Public ReadOnly Property refNestingTabVM As NestingTabVM
' Get
' Return m_refNestingTabVM
' End Get
'End Property
'Public ReadOnly Property refMachiningTabVM As MachiningTabVM
' Get
' Return m_refMachiningTabVM
' End Get
'End Property
'Public ReadOnly Property refSplitModeVM As SplitModeVM
' Get
' Return m_refSplitModeVM
' End Get
'End Property
'Public ReadOnly Property refMoveRawModeVM As MoveRawModeVM
' Get
' Return m_refMoveRawModeVM
' End Get
'End Property
'Public ReadOnly Property refSimulTabVM As SimulTabVM
' Get
' Return m_refSimulTabVM
' End Get
'End Property
#End Region ' Get
#Region "Set"
Friend Function SetRefStatusBarVM(StatusBarVM As StatusBarVM) As Boolean
LibMap.SetRefStatusBarVM(StatusBarVM)
Return Not IsNothing(LibMap.refStatusBarVM)
End Function
'Friend Function SetRefProjManagerVM(ProjManagerVM As ProjManagerVM) As Boolean
' m_refProjManagerVM = ProjManagerVM
' Return Not IsNothing(m_refProjManagerVM)
'End Function
Friend Function SetRefSupervisorManagerVM(SupervisorManagerVM As SupervisorManagerVM) As Boolean
m_refSupervisorManagerVM = SupervisorManagerVM
Return Not IsNothing(m_refSupervisorManagerVM)
End Function
Friend Function SetRefProjectVM(ProjectVM As ProjectVM) As Boolean
m_refProjectVM = ProjectVM
Return Not IsNothing(m_refProjectVM)
End Function
'Friend Function SetRefMainMenuVM(MainMenuVM As MainMenuVM) As Boolean
' m_refMainMenuVM = MainMenuVM
' Return Not IsNothing(m_refMainMenuVM)
'End Function
Friend Function SetRefSceneHostVM(SceneHostVM As SceneHostVM) As Boolean
LibMap.SetRefSceneHostVM(SceneHostVM)
Return Not IsNothing(LibMap.refSceneHostVM)
End Function
Friend Function SetRefShowPanelVM(ShowPanelVM As ShowPanelVM) As Boolean
LibMap.SetRefShowPanelVM(ShowPanelVM)
Return Not IsNothing(LibMap.refShowPanelVM)
End Function
Friend Function SetRefMachinePanelVM(MachinePanelVM As MachinePanelVM) As Boolean
m_refMachinePanelVM = MachinePanelVM
Return Not IsNothing(m_refMachinePanelVM)
End Function
'Friend Function SetRefLeftPanelVM(LeftPanelVM As LeftPanelVM) As Boolean
' m_refLeftPanelVM = LeftPanelVM
' Return Not IsNothing(m_refLeftPanelVM)
'End Function
Friend Function SetRefMachGroupPanelVM(MachGroupPanelVM As MyMachGroupPanelVM) As Boolean
m_refMyMachGroupPanelVM = MachGroupPanelVM
Return Not IsNothing(m_refMyMachGroupPanelVM)
End Function
'Friend Function SetRefBottomPanelVM(BottomPanelVM As BottomPanelVM) As Boolean
' m_refBottomPanelVM = BottomPanelVM
' Return Not IsNothing(m_refBottomPanelVM)
'End Function
'Friend Function SetRefShowBeamPanelVM(ShowBeamPanelVM As ShowBeamPanelVM) As Boolean
' m_refShowBeamPanelVM = ShowBeamPanelVM
' Return Not IsNothing(m_refShowBeamPanelVM)
'End Function
'Friend Function SetRefConfigurationPageVM(ConfigurationPageVM As ConfigurationPageVM) As Boolean
' m_refConfigurationPageVM = ConfigurationPageVM
' Return Not IsNothing(m_refConfigurationPageVM)
'End Function
'Friend Function SetRefRawPartListVM(RawPartListVM As RawPartListVM) As Boolean
' m_refRawPartListVM = RawPartListVM
' Return Not IsNothing(m_refRawPartListVM)
'End Function
'Friend Function SetRefWarehouseWndVM(WarehouseWndVM As WarehouseWndVM) As Boolean
' m_refWarehouseWndVM = WarehouseWndVM
' Return Not IsNothing(m_refWarehouseWndVM)
'End Function
'Friend Function SetRefOptionPanelVM(OptionPanelVM As OptionPanelVM) As Boolean
' m_refOptionPanelVM = OptionPanelVM
' Return Not IsNothing(m_refOptionPanelVM)
'End Function
'Friend Function SetRefRawPartTabVM(RawPartTabVM As RawPartTabVM) As Boolean
' m_refRawPartTabVM = RawPartTabVM
' Return Not IsNothing(m_refRawPartTabVM)
'End Function
'Friend Function SetRefNestingTabVM(NestingTabVM As NestingTabVM) As Boolean
' m_refNestingTabVM = NestingTabVM
' Return Not IsNothing(m_refNestingTabVM)
'End Function
'Friend Function SetRefMachiningTabVM(MachiningTabVM As MachiningTabVM) As Boolean
' m_refMachiningTabVM = MachiningTabVM
' Return Not IsNothing(m_refMachiningTabVM)
'End Function
'Friend Function SetRefSplitModeVM(SplitModeVM As SplitModeVM) As Boolean
' m_refSplitModeVM = SplitModeVM
' Return Not IsNothing(m_refSplitModeVM)
'End Function
'Friend Function SetRefMoveRawModeVM(MoveRawModeVM As MoveRawModeVM) As Boolean
' m_refMoveRawModeVM = MoveRawModeVM
' Return Not IsNothing(m_refMoveRawModeVM)
'End Function
'Friend Function SetRefSimulTabVM(SimulTabVM As SimulTabVM) As Boolean
' m_refSimulTabVM = SimulTabVM
' Return Not IsNothing(m_refSimulTabVM)
'End Function
#End Region ' Set
#Region "Init"
Friend Function BeginInit(MainWindowVM As MainWindowVM) As Boolean
m_refMainWindowVM = MainWindowVM
Return Not IsNothing(m_refMainWindowVM)
End Function
Friend Function EndInit() As Boolean
' Verifico se tutti i pezzi necessari sono stati caricati
'Return Not IsNothing(m_refMainWindowVM) AndAlso Not IsNothing(m_refProjectVM) AndAlso
' Not IsNothing(LibMap.refStatusBarVM) AndAlso Not IsNothing(m_refProjectManagerVM) AndAlso
' Not IsNothing(LibMap.refSceneHostVM) AndAlso Not IsNothing(LibMap.refShowPanelVM) AndAlso
' Not IsNothing(m_refVeinMatchPanelVM) AndAlso
' Not IsNothing(m_refOptionPanelVM) AndAlso Not IsNothing(m_refRawPartTabVM) AndAlso
' Not IsNothing(m_refNestingTabVM) AndAlso Not IsNothing(m_refSimulTabVM) AndAlso
' Not IsNothing(m_refMachiningTabVM) AndAlso
' LibMap.EndInit()
Return Not IsNothing(m_refMainWindowVM) AndAlso 'Not IsNothing(m_refMainMenuVM) AndAlso
Not IsNothing(LibMap.refStatusBarVM) AndAlso 'Not IsNothing(m_refProjManagerVM) AndAlso Not IsNothing(m_refProdManagerVM) AndAlso Not IsNothing(m_refConfigurationPageVM) AndAlso
Not IsNothing(LibMap.refSceneHostVM) AndAlso Not IsNothing(LibMap.refShowPanelVM) AndAlso
Not IsNothing(m_refMachinePanelVM) AndAlso Not IsNothing(LibMap.refMachGroupPanelVM) AndAlso 'Not IsNothing(m_refRawPartListVM) AndAlso Not IsNothing(m_refWarehouseWndVM) AndAlso Not IsNothing(m_refShowBeamPanelVM) AndAlso
LibMap.EndInit()
End Function
#End Region ' Init
End Module
@@ -0,0 +1,44 @@
<EgtFloating:EgtFloatingPanel x:Class="ViewPanelV"
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" Style="{StaticResource ToolBar_EgtFloatingPanel}">
<Button ToolTip="{Binding ZoomAllToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding ZoomAllCommand}">
<Image Source="/Resources/ViewPanel/ZoomAll.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="{Binding LookFromTopToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding TopViewCommand}">
<Image Source="/Resources/ViewPanel/LookFromTOP.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="{Binding LookFromFrontToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding FrontViewCommand}">
<Image Source="/Resources/ViewPanel/LookFromFRONT.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="{Binding LookFromRightToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding RightViewCommand}">
<Image Source="/Resources/ViewPanel/LookFromRIGHT.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="{Binding LookFromBackToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding BackViewCommand}">
<Image Source="/Resources/ViewPanel/LookFromBACK.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="{Binding LookFromLeftToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding LeftViewCommand}">
<Image Source="/Resources/ViewPanel/LookFromLEFT.png" Stretch="Uniform"/>
</Button>
<Button ToolTip="{Binding LookFromIso_SWToolTip}"
Style="{StaticResource ToolBar_Button}"
Command="{Binding IsoViewSWCommand}">
<Image Source="/Resources/ViewPanel/LookFromISO_SW.png" Stretch="Uniform"/>
</Button>
</EgtFloating:EgtFloatingPanel>
@@ -0,0 +1,3 @@
Public Class ViewPanelV
End Class
@@ -274,7 +274,7 @@ Public Class NewMachGroupPanelVM
Next
End If
If Not IsNothing(e.OldItems) AndAlso e.OldItems.Count > 0 Then
For Each BTLPartVM As BTLPartVM In e.OldItems
For Each MachGroupVM As MachGroupVM In e.OldItems
RemoveHandler BTLPartVM.PropertyChanged, AddressOf OnMachGroupVMPropertyChanged
Next
End If