e23497b4e5
-aggiunto controllo Isenabled per feature quando si procude una barra -aggiunto controllo isenabled per pulsanti
881 lines
31 KiB
VB.net
881 lines
31 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.IO
|
|
Imports EgtBEAMWALL.Core
|
|
Imports EgtBEAMWALL.Optimizer.MainMenuVM
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
Imports Newtonsoft.Json
|
|
|
|
Public Class BTLDataWndVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private PADLOCK_IMAGE As String = "pack://application:,,,/Resources/NewPage/padlock.png"
|
|
|
|
Friend Event m_CloseWindow(bDialogResult As Boolean)
|
|
|
|
Private m_StrategySetupList As New ObservableCollection(Of String)
|
|
Public ReadOnly Property StrategySetupList As ObservableCollection(Of String)
|
|
Get
|
|
Return m_StrategySetupList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_OldSelStrategySetup As String
|
|
Private m_SelStrategySetup As String
|
|
Public Property SelStrategySetup As String
|
|
Get
|
|
Return m_SelStrategySetup
|
|
End Get
|
|
Set(value As String)
|
|
m_OldSelStrategySetup = m_SelStrategySetup
|
|
If m_SelStrategySetup <> value Then
|
|
Map.refStrategyManagerVM.SelStrategySetup.sName = value
|
|
Map.refStrategyManagerVM.SelStrategySetup.Read()
|
|
ReadCustomGeneralParameters(value)
|
|
End If
|
|
m_SelStrategySetup = value
|
|
NotifyPropertyChanged(NameOf(SelStrategySetup))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_nBTLInfoLayerId As Integer = -1
|
|
Public ReadOnly Property nBTLInfoId As Integer
|
|
Get
|
|
Return m_nBTLInfoLayerId
|
|
End Get
|
|
End Property
|
|
|
|
Private m_GeneralParametersList As New ObservableCollection(Of ProjectParameters)
|
|
Public Property GeneralParametersList As ObservableCollection(Of ProjectParameters)
|
|
Get
|
|
Return m_GeneralParametersList
|
|
End Get
|
|
Set(value As ObservableCollection(Of ProjectParameters))
|
|
m_GeneralParametersList = value
|
|
NotifyPropertyChanged(NameOf(GeneralParametersList))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsBTLDataWnd As Boolean = False
|
|
Public ReadOnly Property IsBTLDataWnd As Boolean
|
|
Get
|
|
Return m_IsBTLDataWnd
|
|
End Get
|
|
End Property
|
|
Friend Sub SetIsBTLDataWnd(value As Boolean)
|
|
m_IsBTLDataWnd = value
|
|
NotifyPropertyChanged(NameOf(IsBTLDataWnd))
|
|
End Sub
|
|
|
|
Private m_sErrText As String = String.Empty
|
|
Public ReadOnly Property ErrText As String
|
|
Get
|
|
Return m_sErrText
|
|
End Get
|
|
End Property
|
|
Friend Sub SetErrText(value As String)
|
|
m_sErrText = value
|
|
NotifyPropertyChanged(NameOf(ErrText))
|
|
End Sub
|
|
|
|
#Region "Parametri generici"
|
|
|
|
Public m_sPROJNUM As String
|
|
Public Property sPROJNUM As String
|
|
Get
|
|
Return m_sPROJNUM
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_PROJNUM, value) Then
|
|
m_sPROJNUM = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sPROJNUM))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sPROJNAME As String
|
|
Public Property sPROJNAME As String
|
|
Get
|
|
Return m_sPROJNAME
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_PROJNAME, value) Then
|
|
m_sPROJNAME = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sPROJNAME))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sPROJPART As String
|
|
Public Property sPROJPART As String
|
|
Get
|
|
Return m_sPROJPART
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_PROJPART, value) Then
|
|
m_sPROJPART = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sPROJPART))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sPROJGUID As String
|
|
Public Property sPROJGUID As String
|
|
Get
|
|
Return m_sPROJGUID
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_PROJGUID, value) Then
|
|
m_sPROJGUID = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sPROJGUID))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_nPROJTYPE As Integer
|
|
Public ReadOnly Property nPROJTYPE As BWType
|
|
Get
|
|
Select Case Map.refMainMenuVM.SelPage
|
|
Case Pages.OPTIMIZERPAGE
|
|
Return Map.refProdManagerVM.nProdType
|
|
Case Else
|
|
Return BWType.NULL
|
|
End Select
|
|
End Get
|
|
End Property
|
|
|
|
Public m_sLISTNAME As String
|
|
Public Property sLISTNAME As String
|
|
Get
|
|
Return m_sLISTNAME
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_LISTNAME, value) Then
|
|
DbControllers.m_ProjController.UpdateListName(ProjectManagerVM.CurrProj.nProjId, value)
|
|
m_sLISTNAME = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sLISTNAME))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sCUSTOMER As String
|
|
Public Property sCUSTOMER As String
|
|
Get
|
|
Return m_sCUSTOMER
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_CUSTOMER, value) Then
|
|
m_sCUSTOMER = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sCUSTOMER))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sARCHITECT As String
|
|
Public Property sARCHITECT As String
|
|
Get
|
|
Return m_sARCHITECT
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_ARCHITECT, value) Then
|
|
m_sARCHITECT = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sARCHITECT))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sEDITOR As String
|
|
Public Property sEDITOR As String
|
|
Get
|
|
Return m_sEDITOR
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_EDITOR, value) Then
|
|
m_sEDITOR = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sEDITOR))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sDELIVDATE As String
|
|
Public Property sDELIVDATE As String
|
|
Get
|
|
Return m_sDELIVDATE
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_DELIVDATE, value) Then
|
|
m_sDELIVDATE = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sDELIVDATE))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sEXPDATE As String
|
|
Public Property sEXPDATE As String
|
|
Get
|
|
Return m_sEXPDATE
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_EXPDATE, value) Then
|
|
m_sEXPDATE = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sEXPDATE))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sEXPTIME As String
|
|
Public Property sEXPTIME As String
|
|
Get
|
|
Return m_sEXPTIME
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_EXPTIME, value) Then
|
|
m_sEXPTIME = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sEXPTIME))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sEXPRELEASE As String
|
|
Public Property sEXPRELEASE As String
|
|
Get
|
|
Return m_sEXPRELEASE
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_EXPRELEASE, value) Then
|
|
m_sEXPRELEASE = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sEXPRELEASE))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sLANGUAGE As String
|
|
Public Property sLANGUAGE As String
|
|
Get
|
|
Return m_sLANGUAGE
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_LANGUAGE, value) Then
|
|
m_sLANGUAGE = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sLANGUAGE))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_ocRANGE As New List(Of Object)({New IdNameStruct(Range.STANDARD, EgtMsg(61710)),
|
|
New IdNameStruct(Range.EXTENDED, EgtMsg(61711))})
|
|
Public ReadOnly Property ocRANGE As List(Of Object)
|
|
Get
|
|
Return m_ocRANGE
|
|
End Get
|
|
End Property
|
|
|
|
Public m_SelRANGE As Integer
|
|
Public Property SelRANGE As Integer
|
|
Get
|
|
Return m_SelRANGE
|
|
End Get
|
|
Set(value As Integer)
|
|
Dim nValue As Integer = IdNameStruct.IdFromInd(value, ocRANGE)
|
|
Dim sValue As String = [Enum].GetName(GetType(Range), nValue)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_RANGE, sValue) Then
|
|
m_SelRANGE = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(SelRANGE))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_ocPROCESSINGQUALITY As New List(Of Object)({New IdNameStruct(ProcessingQuality.AUTOMATIC, EgtMsg(61658)),
|
|
New IdNameStruct(ProcessingQuality.VISIBLE, EgtMsg(61659)),
|
|
New IdNameStruct(ProcessingQuality.FAST, EgtMsg(61660))})
|
|
Public ReadOnly Property ocPROCESSINGQUALITY As List(Of Object)
|
|
Get
|
|
Return m_ocPROCESSINGQUALITY
|
|
End Get
|
|
End Property
|
|
|
|
Public m_SelPROCESSINGQUALITY As Integer
|
|
Public Property SelPROCESSINGQUALITY As Integer
|
|
Get
|
|
Return m_SelPROCESSINGQUALITY
|
|
End Get
|
|
Set(value As Integer)
|
|
Dim nValue As Integer = IdNameStruct.IdFromInd(value, ocPROCESSINGQUALITY)
|
|
Dim sValue As String = [Enum].GetName(GetType(ProcessingQuality), nValue)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_PRT_PROCESSINGQUALITY, sValue) Then
|
|
m_SelPROCESSINGQUALITY = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(SelPROCESSINGQUALITY))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sCOMPUTERNAME As String
|
|
Public Property sCOMPUTERNAME As String
|
|
Get
|
|
Return m_sCOMPUTERNAME
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_COMPUTERNAME, value) Then
|
|
m_sCOMPUTERNAME = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sCOMPUTERNAME))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sUSER As String
|
|
Public Property sUSER As String
|
|
Get
|
|
Return m_sUSER
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_USER, value) Then
|
|
m_sUSER = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sUSER))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sSRCFILE As String
|
|
Public Property sSRCFILE As String
|
|
Get
|
|
Return m_sSRCFILE
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_SRCFILE, value) Then
|
|
m_sSRCFILE = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sSRCFILE))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sEXPFILE As String
|
|
Public Property sEXPFILE As String
|
|
Get
|
|
Return m_sEXPFILE
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_EXPFILE, value) Then
|
|
m_sEXPFILE = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sEXPFILE))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_ocRECESS As New List(Of Object)({New IdNameStruct(Recess.AUTOMATIC, EgtMsg(61658)),
|
|
New IdNameStruct(Recess.MANUAL, EgtMsg(61661))})
|
|
Public ReadOnly Property ocRECESS As List(Of Object)
|
|
Get
|
|
Return m_ocRECESS
|
|
End Get
|
|
End Property
|
|
|
|
Public m_SelRECESS As Integer
|
|
Public Property SelRECESS As Integer
|
|
Get
|
|
Return m_SelRECESS
|
|
End Get
|
|
Set(value As Integer)
|
|
Dim nValue As Integer = IdNameStruct.IdFromInd(value, ocRECESS)
|
|
Dim sValue As String = [Enum].GetName(GetType(Recess), nValue)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_PRT_RECESS, sValue) Then
|
|
m_SelRECESS = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(SelRECESS))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public m_sUSERATTRIBUTE As String
|
|
Public Property sUSERATTRIBUTE As String
|
|
Get
|
|
Return m_sUSERATTRIBUTE
|
|
End Get
|
|
Set(value As String)
|
|
If EgtSetInfo(m_nBTLInfoLayerId, BTL_GEN_USERATTRIBUTE, value) Then
|
|
m_sUSERATTRIBUTE = value
|
|
Else
|
|
NotifyPropertyChanged(NameOf(sUSERATTRIBUTE))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Parametri generici
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property PROJNUM_MSG As String
|
|
Get
|
|
Return EgtMsg(61692)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property PROJNAME_MSG As String
|
|
Get
|
|
Return EgtMsg(61693)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property PROJPART_MSG As String
|
|
Get
|
|
Return EgtMsg(61694)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property PROJGUID_MSG As String
|
|
Get
|
|
Return EgtMsg(61695)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property LISTNAME_MSG As String
|
|
Get
|
|
Return EgtMsg(61696)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CUSTOMER_MSG As String
|
|
Get
|
|
Return EgtMsg(61697)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ARCHITECT_MSG As String
|
|
Get
|
|
Return EgtMsg(61698)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property EDITOR_MSG As String
|
|
Get
|
|
Return EgtMsg(61699)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property DELIVDATE_MSG As String
|
|
Get
|
|
Return EgtMsg(61700)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property EXPDATE_MSG As String
|
|
Get
|
|
Return EgtMsg(61701)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property EXPTIME_MSG As String
|
|
Get
|
|
Return EgtMsg(61702)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property EXPRELEASE_MSG As String
|
|
Get
|
|
Return EgtMsg(61703)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property LANGUAGE_MSG As String
|
|
Get
|
|
Return EgtMsg(61704)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RANGE_MSG As String
|
|
Get
|
|
Return EgtMsg(61705)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property PROCESSINGQUALITY_MSG As String
|
|
Get
|
|
Return EgtMsg(61642)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property COMPUTERNAME_MSG As String
|
|
Get
|
|
Return EgtMsg(61706)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property USER_MSG As String
|
|
Get
|
|
Return EgtMsg(61707)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property SRCFILE_MSG As String
|
|
Get
|
|
Return EgtMsg(61708)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property EXPFILE_MSG As String
|
|
Get
|
|
Return EgtMsg(61709)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property RECESS_MSG As String
|
|
Get
|
|
Return EgtMsg(61643)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property USERATTRIBUTE_MSG As String
|
|
Get
|
|
Return EgtMsg(61648)
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
' Definizione comandi
|
|
Private m_cmdOk As ICommand
|
|
Private m_cmdCancel As ICommand
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New(nType As BWType)
|
|
' leggo file default config
|
|
Map.refMainWindowVM.MainWindowM.GetDefaultConfigDirPath(nType, True)
|
|
End Sub
|
|
|
|
Sub New()
|
|
Map.SetRefBTLDataWndVM(Me)
|
|
SetIsBTLDataWnd(True)
|
|
' leggo parametri Btl
|
|
ReadBtlParams()
|
|
' leggo file default config
|
|
Map.refMainWindowVM.MainWindowM.GetDefaultConfigDirPath(ProjectManagerVM.CurrProd.nType, True)
|
|
Read(ProjectManagerVM.CurrProd.nType)
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "METHODS"
|
|
|
|
Private Sub ReadBtlParams()
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_PROJNUM, m_sPROJNUM)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_PROJNAME, m_sPROJNAME)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_PROJPART, m_sPROJPART)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_PROJGUID, m_sPROJGUID)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_PROJTYPE, m_nPROJTYPE)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_LISTNAME, m_sLISTNAME)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_CUSTOMER, m_sCUSTOMER)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_ARCHITECT, m_sARCHITECT)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_EDITOR, m_sEDITOR)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_DELIVDATE, m_sDELIVDATE)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_EXPDATE, m_sEXPDATE)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_EXPTIME, m_sEXPTIME)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_EXPRELEASE, m_sEXPRELEASE)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_LANGUAGE, m_sLANGUAGE)
|
|
Dim sValue As String = String.Empty
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_RANGE, sValue)
|
|
m_SelRANGE = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, ocRANGE), ocRANGE)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_PRT_PROCESSINGQUALITY, sValue)
|
|
m_SelPROCESSINGQUALITY = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, ocPROCESSINGQUALITY), ocPROCESSINGQUALITY)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_COMPUTERNAME, m_sCOMPUTERNAME)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_USER, m_sUSER)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_SRCFILE, m_sSRCFILE)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_EXPFILE, m_sEXPFILE)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_PRT_RECESS, sValue)
|
|
m_SelRECESS = IdNameStruct.IndFromId(IdNameStruct.IdFromName(sValue, ocRECESS), ocRECESS)
|
|
EgtGetInfo(m_nBTLInfoLayerId, BTL_GEN_USERATTRIBUTE, m_sUSERATTRIBUTE)
|
|
End Sub
|
|
|
|
Friend Sub Read(nType As BWType)
|
|
m_GeneralParametersList.Clear()
|
|
m_StrategySetupList.Clear()
|
|
' leggo cartella dei setup delle strategie
|
|
Dim AISetupDirPath As String = Map.refMainWindowVM.MainWindowM.GetAISetupDirPath(nType, True)
|
|
Dim AISetupPaths As String() = Directory.GetFiles(AISetupDirPath).Where(Function(f) Path.GetExtension(f).ToLower() <> ".ini").ToArray()
|
|
For Each AiSetup In AISetupPaths
|
|
m_StrategySetupList.Add(Path.GetFileNameWithoutExtension(AiSetup))
|
|
Next
|
|
|
|
' cerco tra i layer BTLInfo
|
|
m_nBTLInfoLayerId = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
|
|
|
|
' Leggo parametri generali
|
|
Dim sDefaultConfigFile As String = String.Empty
|
|
If EgtGetInfo(m_nBTLInfoLayerId, AI_SETUP, sDefaultConfigFile) Then
|
|
If m_StrategySetupList.Contains(sDefaultConfigFile) Then
|
|
m_SelStrategySetup = sDefaultConfigFile
|
|
SetErrText(String.Empty)
|
|
Else
|
|
SetErrText(EgtMsg(62113) & sDefaultConfigFile & EgtMsg(62114))
|
|
End If
|
|
ElseIf EgtUILib.GetPrivateProfileString(S_STRATEGY, K_DEFAULTCONFIG, "", sDefaultConfigFile, Map.refMainWindowVM.MainWindowM.sDefaultConfig) <> 0 Then
|
|
m_SelStrategySetup = sDefaultConfigFile
|
|
End If
|
|
If Not EgtExistsInfo(m_nBTLInfoLayerId, AI_SETUP) AndAlso Not IsNothing(m_SelStrategySetup) Then EgtSetInfo(m_nBTLInfoLayerId, AI_SETUP, m_SelStrategySetup)
|
|
|
|
GetGeneralParamtersList(nType)
|
|
|
|
Dim sAISetupDirPath As String = Map.refMainWindowVM.MainWindowM.GetAISetupDirPath(nType, True)
|
|
|
|
Dim sStrategyConfigurationFilePath As String = sAISetupDirPath & "\" & SelStrategySetup & ".json"
|
|
ReadGeneralConfiguration(sStrategyConfigurationFilePath)
|
|
|
|
' Leggo info se presenti
|
|
Dim sInfo As String = String.Empty
|
|
For Each GeneralParameter In m_GeneralParametersList
|
|
Select Case GeneralParameter.GetType()
|
|
Case GetType(BooleanGenericParameter)
|
|
Dim sTmpBoolValue As Boolean = DirectCast(GeneralParameter, BooleanGenericParameter).bValue
|
|
If EgtExistsInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge) Then
|
|
EgtGetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, BooleanGenericParameter).bValue)
|
|
Else
|
|
DirectCast(GeneralParameter, BooleanGenericParameter).bValue = sTmpBoolValue
|
|
End If
|
|
Case GetType(DoubleGenericParameter)
|
|
Dim sTmpDoubleValue As String = DirectCast(GeneralParameter, DoubleGenericParameter).sValue
|
|
If EgtExistsInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge) Then
|
|
EgtGetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, DoubleGenericParameter).sValue)
|
|
Else
|
|
DirectCast(GeneralParameter, DoubleGenericParameter).sValue = sTmpDoubleValue
|
|
End If
|
|
Case GetType(ComboGenericParameter)
|
|
Dim sTmpComboValue As String = String.Empty
|
|
If Not IsNothing(DirectCast(GeneralParameter, ComboGenericParameter).SelValue) Then
|
|
sTmpComboValue = DirectCast(GeneralParameter, ComboGenericParameter).SelValue.sValue
|
|
Else
|
|
sTmpComboValue = DirectCast(GeneralParameter, ComboGenericParameter).ComboList(0).sValue
|
|
End If
|
|
Dim sTmpValueInfo As String = String.Empty
|
|
If EgtExistsInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge) Then
|
|
EgtGetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge, sTmpValueInfo)
|
|
DirectCast(GeneralParameter, ComboGenericParameter).SelValue = DirectCast(GeneralParameter, ComboGenericParameter).ComboList.FirstOrDefault(Function(x) x.sValue = sTmpValueInfo)
|
|
Else
|
|
If IsNothing(DirectCast(GeneralParameter, ComboGenericParameter).SelValue) Then
|
|
DirectCast(GeneralParameter, ComboGenericParameter).SelValue = New ComboParameter
|
|
End If
|
|
DirectCast(GeneralParameter, ComboGenericParameter).SelValue.sValue = sTmpComboValue
|
|
End If
|
|
Case GetType(StringGenericParameter)
|
|
Dim sTmpStringValue As String = DirectCast(GeneralParameter, StringGenericParameter).sValue
|
|
If EgtExistsInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge) Then
|
|
EgtGetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, StringGenericParameter).sValue)
|
|
Else
|
|
DirectCast(GeneralParameter, StringGenericParameter).sValue = sTmpStringValue
|
|
End If
|
|
Case GetType(ListGenericParameter)
|
|
For Each Item As ToolParameter In DirectCast(GeneralParameter, ListGenericParameter).ListValue
|
|
If Item.bIsActive Then
|
|
sInfo &= Item.sUUID & "," & Item.sName & ";"
|
|
If EgtExistsInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge) Then
|
|
EgtGetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, ListGenericParameter).sValue)
|
|
Else
|
|
DirectCast(GeneralParameter, ListGenericParameter).sValue = sInfo
|
|
End If
|
|
End If
|
|
Next
|
|
End Select
|
|
Next
|
|
NotifyPropertyChanged(NameOf(GeneralParametersList))
|
|
End Sub
|
|
|
|
Friend Sub ReadCustomGeneralParameters(SelStrategySetup As String)
|
|
SetErrText(String.Empty)
|
|
GetGeneralParamtersList(Map.refStrategyManagerVM.SelStrategyType.Id)
|
|
|
|
Dim sAISetupDirPath As String = Map.refMainWindowVM.MainWindowM.GetAISetupDirPath(Map.refStrategyManagerVM.SelStrategyType.Id, False)
|
|
|
|
Dim sStrategyConfigurationFilePath As String = sAISetupDirPath & "\" & SelStrategySetup & ".json"
|
|
ReadGeneralConfiguration(sStrategyConfigurationFilePath)
|
|
|
|
NotifyPropertyChanged(NameOf(GeneralParametersList))
|
|
End Sub
|
|
|
|
Friend Sub SaveInfoBTL(nType As BWType)
|
|
Dim AISetupDirPath As String = Map.refMainWindowVM.MainWindowM.GetAISetupDirPath(nType, True)
|
|
Dim sDefaultConfigFile As String = String.Empty
|
|
Dim sTmpStrategySetup As String = String.Empty
|
|
' Controllo se presente file default config
|
|
If IsNothing(m_SelStrategySetup) Then
|
|
If EgtUILib.GetPrivateProfileString(S_STRATEGY, K_DEFAULTCONFIG, "", sDefaultConfigFile, Map.refMainWindowVM.MainWindowM.sDefaultConfig) <> 0 Then
|
|
m_SelStrategySetup = sDefaultConfigFile
|
|
EgtSetInfo(m_nBTLInfoLayerId, AI_SETUP, m_SelStrategySetup)
|
|
Else
|
|
' restituisce la lista dei file presenti nella cartella con le relative informazioni
|
|
Dim StrategySetupListFile As List(Of FileInfo) = m_StrategySetupList.Where(Function(f) File.Exists(AISetupDirPath & "\" & f & ".json")).
|
|
Select(Function(f) New FileInfo(AISetupDirPath & "\" & f & ".json")).
|
|
OrderByDescending(Function(fi) fi.LastWriteTime).ToList()
|
|
' restituisce l'ultimo file modificato
|
|
If StrategySetupListFile.Any() Then
|
|
sDefaultConfigFile = Path.GetFileNameWithoutExtension(StrategySetupListFile.First().Name)
|
|
End If
|
|
sTmpStrategySetup = m_StrategySetupList.FirstOrDefault(Function(x) x = sDefaultConfigFile)
|
|
m_SelStrategySetup = sTmpStrategySetup
|
|
If Not IsNothing(m_SelStrategySetup) Then EgtSetInfo(m_nBTLInfoLayerId, AI_SETUP, m_SelStrategySetup)
|
|
End If
|
|
End If
|
|
|
|
SetInfoGeneralParameters()
|
|
End Sub
|
|
|
|
Private Sub SaveInfo()
|
|
EgtSetInfo(m_nBTLInfoLayerId, AI_SETUP, m_SelStrategySetup)
|
|
SetInfoGeneralParameters()
|
|
End Sub
|
|
|
|
Private Sub ReadGeneralConfiguration(sStrategyConfigurationFilePath As String)
|
|
If File.Exists(sStrategyConfigurationFilePath) Then
|
|
Dim sReadedFile As String = File.ReadAllText(sStrategyConfigurationFilePath)
|
|
|
|
Dim JsonRoot As CustomJsonRoot = Nothing
|
|
Try
|
|
JsonRoot = JsonConvert.DeserializeObject(Of CustomJsonRoot)(sReadedFile)
|
|
Catch ex As Exception
|
|
JsonRoot = Nothing
|
|
Return
|
|
End Try
|
|
|
|
For Each ProjectItem In JsonRoot.GENERAL
|
|
Dim DefaultProject As ProjectParameters = m_GeneralParametersList.FirstOrDefault(Function(x) x.sName = ProjectItem.sName)
|
|
If Not IsNothing(DefaultProject) Then
|
|
DefaultProject.ReadConfiguration(ProjectItem, m_GeneralParametersList)
|
|
Else
|
|
EgtOutLog("Parametro Generale: " & ProjectItem.sName & " non presente")
|
|
End If
|
|
Next
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub GetGeneralParamtersList(nTypeId As BWType)
|
|
Dim sStrategiesDirPath As String = Map.refMainWindowVM.MainWindowM.GetStrategiesDirPath(nTypeId)
|
|
Dim sGeneralParametersFilePath As String = sStrategiesDirPath & "\" & GENERALPARAMETERS_FILE & ".json"
|
|
If File.Exists(sGeneralParametersFilePath) Then
|
|
Dim sReadedFiles As String = File.ReadAllText(sGeneralParametersFilePath)
|
|
Dim JsonGeneralParametersList As List(Of JsonGeneralParameters) = JsonConvert.DeserializeObject(Of List(Of JsonGeneralParameters))(sReadedFiles)
|
|
m_GeneralParametersList = New ObservableCollection(Of ProjectParameters)((From JsonGeneralParameter In JsonGeneralParametersList
|
|
Select JsonGeneralParameter.Deserialize(Map.refStrategyManagerVM.SelStrategyType.Id)).ToList())
|
|
|
|
UserLevelControl(m_GeneralParametersList)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub UserLevelControl(GeneralParametersList As ObservableCollection(Of ProjectParameters))
|
|
For Each GenericItem As ProjectParameters In GeneralParametersList
|
|
Select Case GenericItem.sMinUserLevel
|
|
Case UserLevel.ADVANCED
|
|
Map.refMainMenuVM.UserLevelGenericVisibility(GenericItem, If(Map.refMainMenuVM.UserAdmin_IsChecked, True, False))
|
|
Case UserLevel.ADMINISTRATOR
|
|
Map.refMainMenuVM.UserLevelGenericVisibility(GenericItem, If(Map.refMainMenuVM.UnlockAllIsChecked, True, False))
|
|
Case Else
|
|
If Not Map.refMainMenuVM.UserAdmin_IsChecked Then
|
|
Map.refMainMenuVM.UserLevelGenericVisibility(GenericItem, If(GenericItem.sMinUserLevel = UserLevel.USER, True, False))
|
|
Map.refMainMenuVM.SetUnloackImage(PADLOCK_IMAGE)
|
|
End If
|
|
End Select
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub SetInfoGeneralParameters()
|
|
Dim sInfo As String = String.Empty
|
|
For Each GeneralParameter In m_GeneralParametersList
|
|
Select Case GeneralParameter.GetType()
|
|
Case GetType(BooleanGenericParameter)
|
|
EgtSetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, BooleanGenericParameter).bValue)
|
|
EgtSetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge & "_FORCED", DirectCast(GeneralParameter, BooleanGenericParameter).bIsBooleanModify)
|
|
Case GetType(DoubleGenericParameter)
|
|
EgtSetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, DoubleGenericParameter).sValue)
|
|
EgtSetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge & "_FORCED", DirectCast(GeneralParameter, DoubleGenericParameter).bIsDoubleModify)
|
|
Case GetType(ComboGenericParameter)
|
|
EgtSetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, ComboGenericParameter).SelValue.sValue)
|
|
EgtSetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge & "_FORCED", DirectCast(GeneralParameter, ComboGenericParameter).bIsComboBoxModify)
|
|
Case GetType(StringGenericParameter)
|
|
EgtSetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge, DirectCast(GeneralParameter, StringGenericParameter).sValue)
|
|
EgtSetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge & "_FORCED", DirectCast(GeneralParameter, StringGenericParameter).bIsStringModify)
|
|
Case GetType(ListGenericParameter)
|
|
For Each Item As ToolParameter In DirectCast(GeneralParameter, ListGenericParameter).ListValue
|
|
If Item.bIsActive Then
|
|
sInfo &= Item.sUUID & "," & Item.sName & ";"
|
|
EgtSetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge, sInfo)
|
|
End If
|
|
Next
|
|
EgtSetInfo(m_nBTLInfoLayerId, GeneralParameter.sNameNge & "_FORCED", DirectCast(GeneralParameter, ListGenericParameter).bIsListModify)
|
|
End Select
|
|
Next
|
|
NotifyPropertyChanged(NameOf(GeneralParametersList))
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "Ok"
|
|
|
|
Public ReadOnly Property Ok_Command As ICommand
|
|
Get
|
|
If m_cmdOk Is Nothing Then
|
|
m_cmdOk = New Command(AddressOf Ok)
|
|
End If
|
|
Return m_cmdOk
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Ok()
|
|
' Messaggio ripristino verifica se presente
|
|
If Not IsNothing(m_OldSelStrategySetup) AndAlso m_SelStrategySetup <> m_OldSelStrategySetup Then
|
|
If EgtBEAMWALL.Core.EgtMessageBoxV.Show(Application.Current.MainWindow, EgtMsg(62579), EgtMsg(15002), MessageBoxButton.OKCancel, MessageBoxImage.Exclamation) = MessageBoxResult.OK Then
|
|
Map.refProjectVM.ResetGeneralParameters()
|
|
Else
|
|
Return
|
|
End If
|
|
End If
|
|
SetIsBTLDataWnd(True)
|
|
SaveInfo()
|
|
Map.refLeftPanelVM.ResetCalc()
|
|
Map.refSceneHostVM.SaveProject()
|
|
RaiseEvent m_CloseWindow(True)
|
|
End Sub
|
|
|
|
#End Region ' Ok
|
|
|
|
#Region "Cancel"
|
|
|
|
Public ReadOnly Property Cancel_Command As ICommand
|
|
Get
|
|
If m_cmdCancel Is Nothing Then
|
|
m_cmdCancel = New Command(AddressOf Cancel)
|
|
End If
|
|
Return m_cmdCancel
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Cancel()
|
|
RaiseEvent m_CloseWindow(False)
|
|
End Sub
|
|
|
|
#End Region ' Cancel
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|