From 6c9c19d7fa38adc3224398af82bc26e336f09b15 Mon Sep 17 00:00:00 2001 From: Demetrio Cassarino Date: Fri, 20 Dec 2024 16:16:57 +0100 Subject: [PATCH] -first commit --- .gitignore | 20 ++ App.config | 6 + Application.xaml | 8 + Application.xaml.vb | 24 ++ Constants/ConstGen.vb | 35 +++ Constants/ConstIni.vb | 13 + EgtStone3D.vbproj | 200 +++++++++++++ MainWindow.xaml | 12 + MainWindow.xaml.vb | 3 + MainWindow/MainWindowM.vb | 328 ++++++++++++++++++++++ MainWindow/MainWindowV.xaml | 21 ++ MainWindow/MainWindowV.xaml.vb | 57 ++++ MainWindow/MainWindowVM.vb | 37 +++ My Project/AssemblyInfo.vb | 56 ++++ My Project/MyExtensions/MyWpfExtension.vb | 121 ++++++++ My Project/Resources.Designer.vb | 62 ++++ My Project/Resources.resx | 117 ++++++++ My Project/Settings.Designer.vb | 73 +++++ My Project/Settings.settings | 7 + OptionsWindow/OptionModule.vb | 68 +++++ SceneButton/SceneButtonV.xaml | 38 +++ SceneButton/SceneButtonV.xaml.vb | 34 +++ SceneHost/MySceneHostVM.vb | 166 +++++++++++ SceneHost/SceneHostV.xaml | 10 + SceneHost/SceneHostV.xaml.vb | 23 ++ SecondaryWindow/SecondaryWindowV.xaml | 10 + SecondaryWindow/SecondaryWindowV.xaml.vb | 3 + Utility/EgtStone3DDictionary.xaml | 282 +++++++++++++++++++ Utility/Map.vb | 70 +++++ egtstone3d | 0 30 files changed, 1904 insertions(+) create mode 100644 .gitignore create mode 100644 App.config create mode 100644 Application.xaml create mode 100644 Application.xaml.vb create mode 100644 Constants/ConstGen.vb create mode 100644 Constants/ConstIni.vb create mode 100644 EgtStone3D.vbproj create mode 100644 MainWindow.xaml create mode 100644 MainWindow.xaml.vb create mode 100644 MainWindow/MainWindowM.vb create mode 100644 MainWindow/MainWindowV.xaml create mode 100644 MainWindow/MainWindowV.xaml.vb create mode 100644 MainWindow/MainWindowVM.vb create mode 100644 My Project/AssemblyInfo.vb create mode 100644 My Project/MyExtensions/MyWpfExtension.vb create mode 100644 My Project/Resources.Designer.vb create mode 100644 My Project/Resources.resx create mode 100644 My Project/Settings.Designer.vb create mode 100644 My Project/Settings.settings create mode 100644 OptionsWindow/OptionModule.vb create mode 100644 SceneButton/SceneButtonV.xaml create mode 100644 SceneButton/SceneButtonV.xaml.vb create mode 100644 SceneHost/MySceneHostVM.vb create mode 100644 SceneHost/SceneHostV.xaml create mode 100644 SceneHost/SceneHostV.xaml.vb create mode 100644 SecondaryWindow/SecondaryWindowV.xaml create mode 100644 SecondaryWindow/SecondaryWindowV.xaml.vb create mode 100644 Utility/EgtStone3DDictionary.xaml create mode 100644 Utility/Map.vb create mode 100644 egtstone3d diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9da6d3a --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ + +# / +/revision.h +/*.aps +/*.ncb +/*.suo +/*.user +/*.sdf +/*.opensdf +/Debug32 +/Release32 +/Trial32 +/Debug64 +/Release64 +/ipch +/bin +/obj +/.vs + +/*.tmp \ No newline at end of file diff --git a/App.config b/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Application.xaml b/Application.xaml new file mode 100644 index 0000000..791a280 --- /dev/null +++ b/Application.xaml @@ -0,0 +1,8 @@ + + + + + + diff --git a/Application.xaml.vb b/Application.xaml.vb new file mode 100644 index 0000000..90921fa --- /dev/null +++ b/Application.xaml.vb @@ -0,0 +1,24 @@ +Class Application + + ' Gli eventi a livello di applicazione, ad esempio Startup, Exit e DispatcherUnhandledException, + ' possono essere gestiti in questo file. + +#Region "METHODS" + + Protected Overrides Sub OnStartup(e As StartupEventArgs) + MyBase.OnStartup(e) + ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose + ' Creo la View principale + Me.MainWindow = New MainWindowV + ' Mostro la View principale + Me.MainWindow.Show() + ' inizializzo finestra interfaccia + Dim m_SecondaryWindowWnd = New SecondaryWindowV(Application.Current.MainWindow) With { + .Owner = Me.MainWindow + } + m_SecondaryWindowWnd.Show() + End Sub + +#End Region ' Methods + +End Class diff --git a/Constants/ConstGen.vb b/Constants/ConstGen.vb new file mode 100644 index 0000000..08de7f4 --- /dev/null +++ b/Constants/ConstGen.vb @@ -0,0 +1,35 @@ +Module ConstGen + + ' Abilitazioni licenza + Friend Enum KEY_OPT As UInteger + BASE = 1 ' Prodotto EgtStone3D + End Enum + + ' File con dati di licenza + Public Const LIC_FILE_NAME As String = "EgtCAM5.lic" + Public Const S_LICENCE As String = "Licence" + Public Const K_LOCKID As String = "LockId" + Public Const K_KEY As String = "Key" + Public Const K_NESTKEY As String = "NestKey" + + ' File di log generale + Public Const GENLOG_FILE_NAME As String = "EgtStone3D#.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 lavorazioni + Public Const MACHININGS_DIR As String = "Machinings" + ' Sottodirettorio materiali + Public Const MATERIALS_DIR As String = "Materials" + ' Sottodirettorio per lavorazioni travi + Public Const _3DPRINTING_DIR As String = "EgtStone3D" + ' 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" + +End Module diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb new file mode 100644 index 0000000..6404dd6 --- /dev/null +++ b/Constants/ConstIni.vb @@ -0,0 +1,13 @@ +Module ConstIni + + Public Const INI_FILE_NAME As String = "EgtStone3D.ini" + + Public Const K_NETKEY As String = "NetKey" + + Public Const S_PRINTING3D As String = "3dPrinting" + Public Const K_3PRNBASEDIR As String = "BaseDir" + + Public Const K_LINEWIDTH As String = "LineWidth" + Public Const K_CUSTOMCOLORS As String = "CustomColors" + +End Module diff --git a/EgtStone3D.vbproj b/EgtStone3D.vbproj new file mode 100644 index 0000000..6225f75 --- /dev/null +++ b/EgtStone3D.vbproj @@ -0,0 +1,200 @@ + + + + Debug + AnyCPU + {10C7D2D3-8D43-4F83-9299-2DF704A55CD6} + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} + WinExe + EgtStone3D + EgtStone3D + v4.7.2 + Custom + true + true + + + AnyCPU + true + full + true + true + true + bin\Debug\ + EgtStone3D.xml + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314 + + + AnyCPU + pdbonly + false + false + true + false + true + bin\Release\ + EgtStone3D.xml + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314 + + + On + + + Binary + + + Off + + + On + + + true + true + true + bin\x86\Debug\ + EgtStone3D.xml + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314 + full + x86 + true + + + true + bin\x86\Release\ + EgtStone3D.xml + true + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314 + pdbonly + x86 + true + + + + ..\..\..\EgtProg\Dll32\EgtUILib.dll + + + ..\..\..\EgtProg\Dll32\EgtWPFLib5.dll + + + + + + + + + + 4.0 + + + + + + + + + + MSBuild:Compile + Designer + + + MainWindowV.xaml + + + + SceneButtonV.xaml + + + + SceneHostV.xaml + + + SecondaryWindowV.xaml + + + + Application.xaml + Code + + + + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + + + + + + + + + + + + + + + + + + + + + Code + + + Microsoft.VisualBasic.WPF.MyExtension + 1.0.0.0 + + + True + True + Resources.resx + + + True + Settings.settings + True + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + + + SettingsSingleFileGenerator + Settings.Designer.vb + + + + + + + + + IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\gtStone3D\EgtStone3DR32.exe +IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\EgtStone3D\EgtStone3DD32.exe + + \ No newline at end of file diff --git a/MainWindow.xaml b/MainWindow.xaml new file mode 100644 index 0000000..719e12b --- /dev/null +++ b/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/MainWindow.xaml.vb b/MainWindow.xaml.vb new file mode 100644 index 0000000..b6e0269 --- /dev/null +++ b/MainWindow.xaml.vb @@ -0,0 +1,3 @@ +Class MainWindow + +End Class \ No newline at end of file diff --git a/MainWindow/MainWindowM.vb b/MainWindow/MainWindowM.vb new file mode 100644 index 0000000..79ce2df --- /dev/null +++ b/MainWindow/MainWindowM.vb @@ -0,0 +1,328 @@ +Imports System.Threading +Imports EgtUILib.EgtInterface +Imports EgtUILib.GenInterface +Imports EgtWPFLib5 +Imports System.Math + +Public Class MainWindowM + +#Region "FIELDS & PROPERTIES" + + ' massimo numero di istanze del programma ammesse + Const MAX_INST As Integer = 32 + + Private m_objMutex As Mutex + + Private m_sDataRoot As String = String.Empty + Friend ReadOnly Property sDataRoot As String + Get + Return m_sDataRoot + End Get + End Property + + Private m_sDataDir As String = String.Empty + Friend ReadOnly Property sDataDir As String + Get + Return m_sDataDir + 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 + Public ReadOnly Property DebugLevel As Integer + Get + Return m_nDebug + End Get + End Property + + 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 + + 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_s3dPrintingDir As String + Friend ReadOnly Property s3dPrintingDir As String + Get + Return m_s3dPrintingDir + End Get + End Property + + Private m_sMaterialsDir As String + Friend ReadOnly Property sMaterialsDir As String + Get + Return m_sMaterialsDir + 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_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 + +#End Region ' Fields & Properties + +#Region "CONSTRUCTOR" + + Sub New() + InitializeEgtEnvironment() + End Sub + +#End Region ' Constructor + +#Region "METHODS" + + Private Sub InitializeEgtEnvironment() + ' 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 resources dir + m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR + ' Impostazione path machinings e materials dir + m_sMaterialsDir = m_sDataRoot & "\" & MATERIALS_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 direttorio 3dPrinting + If GetMainPrivateProfileString(S_PRINTING3D, K_3PRNBASEDIR, "", m_s3dPrintingDir) = 0 Then + m_s3dPrintingDir = m_sDataRoot & "\" & _3DPRINTING_DIR + End If + ' 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) + ' Impostazioni per chiave di rete + Dim bNetKey As Boolean = (GetMainPrivateProfileInt(S_GENERAL, K_NETKEY, 0) = 1) + EgtSetNetHwKey(bNetKey) + Dim sLockId As String = "" + EgtUILib.GetPrivateProfileString(S_LICENCE, K_LOCKID, "", sLockId, sLicFile) + If Not String.IsNullOrEmpty(sLockId) Then + EgtSetLockId(sLockId) + End If + ' Recupero livello e opzioni della chiave + Dim bKey As Boolean = EgtGetKeyLevel(5583, 2510, 1, m_nKeyLevel) And + EgtGetKeyOptions(5583, 2510, 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 + ' Inizializzo OptionModule + OptionModule.InitOptionModule() + ' 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_SCENE, 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\EgtStone3D", 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("EgtStone3DR32") + 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("EgtStone3DR64") + 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 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 Function GetKeyOption(nKeyOpt As KEY_OPT) As Boolean + Return ((m_nKeyOptions And nKeyOpt) <> 0) + End Function + +#End Region ' Methods + +End Class diff --git a/MainWindow/MainWindowV.xaml b/MainWindow/MainWindowV.xaml new file mode 100644 index 0000000..a21d8f2 --- /dev/null +++ b/MainWindow/MainWindowV.xaml @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/MainWindow/MainWindowV.xaml.vb b/MainWindow/MainWindowV.xaml.vb new file mode 100644 index 0000000..79d8ff9 --- /dev/null +++ b/MainWindow/MainWindowV.xaml.vb @@ -0,0 +1,57 @@ +Imports System.Windows.Interop +Imports EgtUILib +Imports EgtWPFLib5 + +Class MainWindowV + +#Region "FIELDS & PROPERTIES" + + Private m_MainWindowVM As MainWindowVM + +#End Region ' Fields & Properties + +#Region "CONSTRUCTOR" + + Sub New() + m_MainWindowVM = New MainWindowVM + ' La chiamata è richiesta dalla finestra di progettazione. + InitializeComponent() + ' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent(). + Me.DataContext = m_MainWindowVM + ' creo finestra della scena + AddHandler Me.Loaded, AddressOf MainWindowV_Loaded + Map.SetRefMainWindowV(Me) + End Sub + +#End Region ' Constructor + +#Region "EVENTS" + + Private Sub MainWindowV_Loaded(sender As Object, e As RoutedEventArgs) + ' Carico e imposto posizione finestra + WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me) + ' Recupero e imposto handle finestra principale + Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle + EgtSetMainWindowHandle(hMainWnd) + ' Attivo Popup Pulsanti su scena + Popup_SceneButton.IsOpen = True + End Sub + + Private Sub MainWindowV_ContentRendered(sender As Object, e As EventArgs) + m_MainWindowVM.ContentRendered() + End Sub + + Private Sub MainWindowV_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs) + If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then + e.Cancel = True + Return + End If + ' Salvo posizione finestra (se non minimizzata) + If WindowState <> WindowState.Minimized Then + WinPosFromWindowToIni(Me, S_GENERAL, K_WINPLACE) + End If + End Sub + +#End Region ' Events + +End Class diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb new file mode 100644 index 0000000..04cd420 --- /dev/null +++ b/MainWindow/MainWindowVM.vb @@ -0,0 +1,37 @@ +Imports EgtWPFLib5 + +Public Class MainWindowVM + Inherits VMBase + +#Region "FIELDS & PROPERTIES" + + ' Riferimento al Model della MainWindow + Private m_MainWindowM As MainWindowM + Friend ReadOnly Property MainWindowM As MainWindowM + Get + Return m_MainWindowM + End Get + End Property + +#End Region ' Fields & Properties + +#Region "CONSTRUCTOR" + + Sub New() + ' Avvio l'inizializzazione della mappa passandogli il riferimento al MainWindowVM + Map.BeginInit(Me) + ' Creo Model della MainWindow + m_MainWindowM = New MainWindowM + End Sub + +#End Region ' Constructor + +#Region "METHODS" + + Friend Sub ContentRendered() + + End Sub + +#End Region ' Methods + +End Class diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..9c9a9e7 --- /dev/null +++ b/My Project/AssemblyInfo.vb @@ -0,0 +1,56 @@ +Imports System +Imports System.Globalization +Imports System.Reflection +Imports System.Resources +Imports System.Runtime.InteropServices +Imports System.Windows + +' Le informazioni generali relative a un assembly sono controllate dal seguente +' set di attributi. Modificare i valori di questi attributi per modificare le informazioni +' associate a un assembly. + +' Controllare i valori degli attributi degli assembly + + + + + + + + + +'Per iniziare a creare applicazioni localizzabili, impostare +'CultureYouAreCodingWith nel file VBPROJ +'all'interno di un . Ad esempio, se si utilizza l'inglese (Stati Uniti) +'nei file di origine, impostare su "en-US". Rimuovere quindi il commento +'dall'attributo NeutralResourceLanguage seguente. Aggiornare "en-US" nella riga +'seguente in modo che corrisponda all'impostazione di UICulture nel file di progetto. + +' + + +'L'attributo ThemeInfo indica la possibile posizione dei dizionari risorse generici e specifici del tema. +'Primo parametro: posizione dei dizionari risorse specifici del tema +'(da usare se nella pagina non viene trovata una risorsa, +' oppure nei dizionari delle risorse dell'applicazione) + +'Parametro 2: posizione del dizionario risorse generico +'(da usare se nella pagina non viene trovata una risorsa, +'un'applicazione e alcun dizionario risorse specifico del tema) + + + + +'Se il progetto viene esposto a COM, il GUID seguente verrà usato come ID del typelib + + +' Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: +' +' Versione principale +' Versione secondaria +' Numero di build +' Revisione +' + + + diff --git a/My Project/MyExtensions/MyWpfExtension.vb b/My Project/MyExtensions/MyWpfExtension.vb new file mode 100644 index 0000000..2184d9b --- /dev/null +++ b/My Project/MyExtensions/MyWpfExtension.vb @@ -0,0 +1,121 @@ +#If _MyType <> "Empty" Then + +Namespace My + ''' + ''' Modulo utilizzato per definire le proprietà disponibili nello spazio dei nomi My per WPF + ''' + ''' + _ + Module MyWpfExtension + Private s_Computer As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Devices.Computer) + Private s_User As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.ApplicationServices.User) + Private s_Windows As New ThreadSafeObjectProvider(Of MyWindows) + Private s_Log As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Logging.Log) + ''' + ''' Restituisce l'oggetto applicazione per l'applicazione in esecuzione + ''' + _ + Friend ReadOnly Property Application() As Application + Get + Return CType(Global.System.Windows.Application.Current, Application) + End Get + End Property + ''' + ''' Restituisce le informazioni sul computer host. + ''' + _ + Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.Computer + Get + Return s_Computer.GetInstance() + End Get + End Property + ''' + ''' Restituisce le informazioni per l'utente corrente. Se si desidera eseguire l'applicazione con le + ''' credenziali utente di Windows correnti, chiamare My.User.InitializeWithWindowsUser(). + ''' + _ + Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.User + Get + Return s_User.GetInstance() + End Get + End Property + ''' + ''' Restituisce il registro applicazioni. I listener possono essere configurati dal file di configurazione dell'applicazione. + ''' + _ + Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.Log + Get + Return s_Log.GetInstance() + End Get + End Property + + ''' + ''' Restituisce la raccolta di oggetti Window definiti nel progetto. + ''' + _ + Friend ReadOnly Property Windows() As MyWindows + _ + Get + Return s_Windows.GetInstance() + End Get + End Property + _ + _ + Friend NotInheritable Class MyWindows + _ + Private Shared Function Create__Instance__(Of T As {New, Global.System.Windows.Window})(ByVal Instance As T) As T + If Instance Is Nothing Then + If s_WindowBeingCreated IsNot Nothing Then + If s_WindowBeingCreated.ContainsKey(GetType(T)) = True Then + Throw New Global.System.InvalidOperationException("The window cannot be accessed via My.Windows from the Window constructor.") + End If + Else + s_WindowBeingCreated = New Global.System.Collections.Hashtable() + End If + s_WindowBeingCreated.Add(GetType(T), Nothing) + Return New T() + s_WindowBeingCreated.Remove(GetType(T)) + Else + Return Instance + End If + End Function + _ + _ + Private Sub Dispose__Instance__(Of T As Global.System.Windows.Window)(ByRef instance As T) + instance = Nothing + End Sub + _ + _ + Public Sub New() + MyBase.New() + End Sub + Private Shared s_WindowBeingCreated As Global.System.Collections.Hashtable + Public Overrides Function Equals(ByVal o As Object) As Boolean + Return MyBase.Equals(o) + End Function + Public Overrides Function GetHashCode() As Integer + Return MyBase.GetHashCode + End Function + _ + _ + Friend Overloads Function [GetType]() As Global.System.Type + Return GetType(MyWindows) + End Function + Public Overrides Function ToString() As String + Return MyBase.ToString + End Function + End Class + End Module +End Namespace +Partial Class Application + Inherits Global.System.Windows.Application + _ + _ + Friend ReadOnly Property Info() As Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo + _ + Get + Return New Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo(Global.System.Reflection.Assembly.GetExecutingAssembly()) + End Get + End Property +End Class +#End If \ No newline at end of file diff --git a/My Project/Resources.Designer.vb b/My Project/Resources.Designer.vb new file mode 100644 index 0000000..b22e10f --- /dev/null +++ b/My Project/Resources.Designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:$clrversion$ +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("$safeprojectname$.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/My Project/Resources.resx b/My Project/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/My Project/Settings.Designer.vb b/My Project/Settings.Designer.vb new file mode 100644 index 0000000..2b85eaf --- /dev/null +++ b/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.EgtStone3D.My.MySettings + Get + Return Global.EgtStone3D.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/My Project/Settings.settings b/My Project/Settings.settings new file mode 100644 index 0000000..40ed9fd --- /dev/null +++ b/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb new file mode 100644 index 0000000..348236a --- /dev/null +++ b/OptionsWindow/OptionModule.vb @@ -0,0 +1,68 @@ +Imports EgtUILib +Imports EgtWPFLib5 + +Friend Module OptionModule + +#Region "FIELDS & PROPERTIES" + + ' Colori di sfondo della vista e della griglia + Friend m_TopSceneBackground As Color3d + Friend m_BotSceneBackground As Color3d + Friend m_GridColor As Color3d + + ' Colore di default in disegno + Friend m_DefMaterialColor As Color3d + + ' Colore di evidenziazione + Friend m_MarkColor As Color3d + + ' Colore superfici + Friend m_SelSurfColor As Color3d + + ' Colore rettangolo di zoom + Friend m_RectangleZoomColor As Color3d + + ' Colore linea di distanz + Friend m_LineDistanceColor As Color3d + +#End Region ' Fields & Properties + +#Region "METHODS" + + ' inizializzazione lettura variabili ad inizio programma + Friend Sub InitOptionModule() + ' Inizializzo variabili colori di sfondo scena, griglia + Dim BackTopColor As New Color3d(0, 123, 167) + GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor) + m_TopSceneBackground = BackTopColor + Dim BackBotColor As New Color3d(BackTopColor) + GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor) + m_BotSceneBackground = BackBotColor + Dim GridColor As New Color3d(0, 0, 0) + GetMainPrivateProfileColor(S_GRID, K_MINLNCOLOR, GridColor) + m_GridColor = GridColor + ' imposto colore di default + Dim DefColor As New Color3d(100, 10, 20) + GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor) + m_DefMaterialColor = DefColor + ' imposto colore di evidenziazione + Dim MarkColor As New Color3d(255, 255, 0) + GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor) + m_MarkColor = MarkColor + ' imposto colore per superfici selezionate + Dim SelSurfColor As New Color3d(255, 255, 192) + GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor) + m_SelSurfColor = SelSurfColor + ' imposto tipo e colore del rettangolo di zoom + Dim ZwColor As New Color3d(0, 0, 0) + GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, True, ZwColor) + m_RectangleZoomColor = ZwColor + ' imposto colore della linea di distanza + Dim DstLnColor As New Color3d(255, 0, 0) + GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor) + m_LineDistanceColor = DstLnColor + End Sub + +#End Region ' Methods + +End Module diff --git a/SceneButton/SceneButtonV.xaml b/SceneButton/SceneButtonV.xaml new file mode 100644 index 0000000..b24872d --- /dev/null +++ b/SceneButton/SceneButtonV.xaml @@ -0,0 +1,38 @@ + + + + +