Imports System.Collections.ObjectModel Imports EgtUILib Public Module IniFile ' Temporary Friend m_LastSubEntityId As Integer Friend EgaltechBlue1 As New SolidColorBrush(Color.FromArgb(255, 77, 132, 196)) Friend EgaltechGreen As New SolidColorBrush(Color.FromArgb(255, 0, 255, 0)) Friend EgaltechRed As New SolidColorBrush(Color.FromArgb(255, 255, 0, 0)) Friend EgaltechYellow As New SolidColorBrush(Color.FromArgb(255, 255, 255, 0)) Friend ReferenceContactColRed As New Color3d(255, 0, 0) Friend ReferenceContactColGreen As New Color3d(0, 255, 0) Friend Enum ProjectModeOpt As Integer DRAW = 1 MACHINING = 2 ONLYDRAW = 3 End Enum Public Enum SceneSelModeOpt As Integer NULL = 0 PARTCURVES = 1 PARTSURFACES = 2 PARTCURVESANDSURFACES = 3 ALL = 99 End Enum Friend Enum SceneSelTypeOpt As Integer NULL = 0 MACHINING = 1 FIXTURE = 2 RAWPART = 3 RAWPARTWITHFIXTURE = 4 ALL = 99 End Enum ' MainWindow Page Friend m_nInstance As Integer = 0 Friend m_nUserLevel As Integer = 1 Friend m_nKeyLevel As Integer = 0 Friend m_nKeyOptions As UInteger = 0 Friend Enum KEY_OPT As UInteger BASE = 1 DOORS = 2 GUNSTOCK = 4 End Enum Friend m_sDataRoot As String Friend m_sIniFile As String Friend m_sTempDir As String Friend m_sMachinesRoot As String Friend m_sResourcesRoot As String Friend m_sTablesRoot As String Friend m_sLogFile As String ' path della cartella DOORS Friend m_sDoorsDirPath As String Friend m_ProjectMode As ProjectModeOpt Friend m_bMmUnits As Boolean Friend m_bDrawShowGrid As Boolean Friend m_bMachiningShowGrid As Boolean = False Friend m_bShowGridFrame As Boolean ' Project Page Friend m_ProjectSceneContext As Integer = 0 Friend m_bScriptRunning As Boolean = False Friend m_bStopScript As Boolean = False Friend m_DDFFilePath As String = String.Empty Friend m_MODFilePath As String = String.Empty Friend m_PEZFilePath As String = String.Empty ' Grid data Friend dSnapStepMm As Double Friend dSnapStepInch As Double Friend nMinLineSStep As Integer Friend nMajLineSStep As Integer Friend nExtSStep As Integer Friend MinLnColor As Color3d Friend MajLnColor As Color3d ' TopCommandBar Friend m_MruFiles As New MruList Friend m_MruScripts As New MruList Friend m_MruDoors As New MruList Friend m_MruNewGunStock As New MruList Friend m_MruModifyGunStock As New MruList ' Current Machine Friend m_sMachineName As String Friend m_sCurrMachIniFilePath As String Friend m_sCurrMachToolsDirPath As String Friend m_sCurrMachSetUpDirPath As String Friend m_sCurrMachScriptsDirPath As String ' Variabile che contiene la path della cartella che contiene i ToolMaker Friend m_sToolMakersDir As String = String.Empty ' Variabile che contiene il contesto della scena presente nel database utensili Friend m_ToolsDbSceneContext As Integer = 0 ' Variabile che dice se sono abilitati i gruppi di lavorazione Friend m_bMachiningGroup As Boolean ' Variabile che indica se il programma e' riuscito ad avviarsi Friend m_bFailedRun As Boolean ' Flag visualizzazione solo tavola in definizione lavorazioni Friend m_bShowOnlyTable As Boolean ' Variabile che contiene il vettore di traslazione dei pezzi nel passaggio da modalità disegna a lavora Friend m_vtMachPartsPos As New Vector3d(Vector3d.NULL) ' Variabile che contiene stato simulazione per chiusura programma Friend m_bSimulStatForClose As Boolean = True Public Function GetPrivateProfileInt(IpAppName As String, IpKeyName As String, nDefault As Integer) As Integer Return EgtUILib.GetPrivateProfileInt(IpAppName, IpKeyName, nDefault, m_sIniFile) End Function Public Function GetPrivateProfileDouble(IpAppName As String, IpKeyName As String, nDefault As Integer) As Double Return EgtUILib.GetPrivateProfileDouble(IpAppName, IpKeyName, nDefault, m_sIniFile) End Function Public Function GetPrivateProfileString(IpAppName As String, IpKeyName As String, IpDefault As String, ByRef IpString As String) As Integer Return EgtUILib.GetPrivateProfileString(IpAppName, IpKeyName, IpDefault, IpString, m_sIniFile) End Function Public Function GetPrivateProfileColor(IpAppName As String, IpKeyName As String, ByRef Col As EgtUILib.EgtInterface.Color3d) As Boolean Return EgtUILib.GetPrivateProfileColor(IpAppName, IpKeyName, Col, m_sIniFile) End Function Public Function GetPrivateProfileWinPos(IpAppName As String, IpKeyName As String, ByRef nFlag As Integer, ByRef nLeft As Integer, ByRef nTop As Integer, ByRef nWidth As Integer, ByRef nHeight As Integer) As Boolean Return EgtUILib.GetPrivateProfileWinPos(IpAppName, IpKeyName, nFlag, nLeft, nTop, nWidth, nHeight, m_sIniFile) End Function Public Function GetPrivateProfileZoomWin(IpAppName As String, IpKeyName As String, ByRef bOutline As Boolean, ByRef Col As EgtUILib.EgtInterface.Color3d) As Boolean Return EgtUILib.GetPrivateProfileZoomWin(IpAppName, IpKeyName, bOutline, Col, m_sIniFile) End Function Public Function GetPrivateProfileFloatingWinPos(lpAppName As String, lpKeyName As String, ByRef nState As String, ByRef nIndex As Integer, ByRef nLeft As Integer, ByRef nTop As Integer) As Boolean Dim sVal As String = String.Empty GetPrivateProfileString(lpAppName, lpKeyName, "", sVal) Dim sItems() As String = sVal.Split(",".ToCharArray) If sItems.Count() >= 4 Then nState = sItems(0) nIndex = CInt(sItems(1)) nLeft = CInt(sItems(2)) nTop = CInt(sItems(3)) Return True End If Return False End Function Public Function GetPrivateProfileLanguage( ByVal lpAppName As String, ByVal lpKeyName As String) As Language Dim sVal As String = String.Empty GetPrivateProfileString(lpAppName, lpKeyName, "", sVal) Dim sItems() As String = sVal.Split(",".ToCharArray) If sItems.Count() = 2 Then Return New Language(sItems(0), sItems(1)) End If Return Nothing End Function Public Function GetPrivateProfileFixture( ByVal lpAppName As String, ByVal lpKeyName As String, ByRef sName As String, ByRef nTot As Integer) As Boolean Dim sVal As String = String.Empty EgtUILib.GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, m_sCurrMachIniFilePath) Dim sItems() As String = sVal.Split(",".ToCharArray) If sItems.Count() = 2 Then sName = sItems(0) nTot = CInt(sItems(1)) Return True End If Return False End Function Public Function GetPrivateProfileSetUpPosition( ByVal lpAppName As String, ByVal lpKeyName As String, ByRef sTcPos As String, ByRef sHead As String, ByRef nGroup As Integer) As Boolean Dim sVal As String = String.Empty EgtUILib.GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, m_sCurrMachIniFilePath) Dim sItems() As String = sVal.Split(";".ToCharArray) If sItems.Count() >= 2 Then sTcPos = sItems(0) sHead = sItems(1) If sItems.Count() >= 3 Then nGroup = If(Integer.TryParse(sItems(2).Trim("G"c), nGroup), nGroup, 0) Else nGroup = 1 End If Return True End If Return False End Function Public Function GetPrivateProfileButton( ByVal lpAppName As String, ByVal lpKeyName As String, ByRef ReadedButtonItem As ButtonItem) As Boolean ReadedButtonItem = Nothing Dim sVal As String = String.Empty GetPrivateProfileString(lpAppName, lpKeyName, "", sVal) If String.IsNullOrWhiteSpace(sVal) Then Return False Dim sItems() As String = sVal.Split(",".ToCharArray) If sItems.Count() >= 1 Then Dim sImagePath As String = String.Empty Dim sToolTip As String = String.Empty If sItems.Count() >= 2 Then sImagePath = sItems(1) If sItems.Count() >= 3 Then sToolTip = sItems(2) End If End If ReadedButtonItem = New ButtonItem(sItems(0), sImagePath, sToolTip) Return True End If Return False End Function Public Function WritePrivateProfileString(IpAppName As String, IpKeyName As String, ByRef IpString As String) As Boolean Return EgtUILib.WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_sIniFile) End Function Public Function WritePrivateProfileWinPos(IpAppName As String, IpKeyName As String, ByRef nFlag As Integer, ByRef nLeft As Integer, ByRef nTop As Integer, ByRef nWidth As Integer, ByRef nHeight As Integer) As Boolean Return EgtUILib.WritePrivateProfileWinPos(IpAppName, IpKeyName, nFlag, nLeft, nTop, nWidth, nHeight, m_sIniFile) End Function Friend Function IsActiveDoors() As Boolean Dim bIsActive As Boolean = (IniFile.m_nKeyOptions And KEY_OPT.DOORS) <> 0 And (GetPrivateProfileInt(S_DOORS, K_DDFENABLE, 0) <> 0) If bIsActive Then GetPrivateProfileString(S_DOORS, K_BASEDIR, "", m_sDoorsDirPath) End If Return bIsActive End Function Friend Function IsActiveGunStock() As Boolean Return (IniFile.m_nKeyOptions And KEY_OPT.GUNSTOCK) <> 0 And (GetPrivateProfileInt(S_GUNSTOCK, K_GUNSTOCKENABLE, 0) <> 0) End Function Friend Function IsActiveSpecialPanel() As Boolean Return If(GetPrivateProfileInt(S_SPECIAL, K_SPECIALENABLE, 0) <> 0, True, False) End Function End Module