diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index c040307..72899a6 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -133,7 +133,6 @@ Module ConstIni Public Const K_WALLBUTTON As String = "Button" 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" @@ -160,8 +159,10 @@ Module ConstIni Public Const K_WRITEPEZFUNCTION As String = "WritePezFun" Public Const K_READPEZFUNCTION As String = "ReadPezFun" Public Const K_CREATEFUNCTION As String = "CreateFun" + Public Const K_COPYFUNCTION As String = "CopyFun" Public Const K_MODDIR As String = "ModDir" Public Const K_PEZDIR As String = "PezDir" + Public Const K_COPYDIR As String = "CopyDir" Public Const S_MACH As String = "Mach" Public Const K_MACHINESDIR As String = "MachinesDir" diff --git a/Internals/MruList.vb b/Internals/MruList.vb index e351f4c..5b5afb1 100644 --- a/Internals/MruList.vb +++ b/Internals/MruList.vb @@ -59,7 +59,7 @@ Public Class MruList End Sub '--------------------------------------------------------------------------- - Public Sub Add(ByVal sFileName As String) + Public Sub Add(sFileName As String) ' Gestione '_' Dim sMyFileName As String = sFileName.Replace("_", "__") ' Se stringa vuota, esco subito @@ -84,7 +84,7 @@ Public Class MruList End Sub '--------------------------------------------------------------------------- - Private Function FileNameIndex(ByVal sFileName As String) As Integer + Private Function FileNameIndex(sFileName As String) As Integer For i As Integer = 0 To m_FileNames.Count - 1 If String.Compare(m_FileNames(i).ToString, sFileName, True) = 0 Then Return i @@ -94,7 +94,7 @@ Public Class MruList End Function '--------------------------------------------------------------------------- - Public Sub Remove(ByVal sFileName As String) + Public Sub Remove(sFileName As String) ' Gestione '_' Dim sMyFileName As String = sFileName.Replace("_", "__") ' Rimozione @@ -108,8 +108,8 @@ Public Class MruList End Sub '--------------------------------------------------------------------------- - Public Function GetFileName(ByVal nInd As Integer, ByRef sFileName As String) As Boolean - If nInd > 0 And nInd <= m_FileNames.Count() Then + Public Function GetFileName(nInd As Integer, ByRef sFileName As String) As Boolean + If nInd >= 0 And nInd < m_FileNames.Count() Then ' Gestione '_' sFileName = m_FileNames(nInd).ToString().Replace("__", "_") Return True diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 5d704d5..b3d6f5f 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -70,6 +70,6 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/Project/ProjectVM.vb b/Project/ProjectVM.vb index effd81c..39b4437 100644 --- a/Project/ProjectVM.vb +++ b/Project/ProjectVM.vb @@ -770,6 +770,20 @@ Public Class ProjectVM End If End Sub + Friend Sub GunStockCopy(sFilePath As String, sDirDest As String) + Dim bOk As Boolean + bOk = ExecGunStockCopy(m_ProjectScene, sFilePath, sDirDest) + If bOk Then + ' Copia dei file terminata con successo ... + Dim sMsg As String = EgtMsg(8216) & vbCrLf & sFilePath & vbCrLf & "->" & sDirDest + MessageBox.Show(sMsg, EgtMsg(8214), MessageBoxButton.OK, MessageBoxImage.Information) + else + ' Errore nella copia dei file ... + Dim sMsg As String = EgtMsg(8255) & vbCrLf & sFilePath & vbCrLf & "->" & sDirDest + MessageBox.Show(sMsg, EgtMsg(8251), MessageBoxButton.OK, MessageBoxImage.Error) + End If + End Sub + #End Region #Region "DrawOptionPanel Commands" diff --git a/Special-GunStock/GunStock.vb b/Special-GunStock/GunStock.vb index f5dadd3..308c780 100644 --- a/Special-GunStock/GunStock.vb +++ b/Special-GunStock/GunStock.vb @@ -167,6 +167,32 @@ Module GunStock Return bOk End Function + Function ExecGunStockCopy(ByRef scene As Scene, sFilePath As String, sDirDest As String) As Boolean + + ' Carico ambiente lua per Gunstock + If Not LoadGunStock() Then + MessageBox.Show(EgtMsg(8252), EgtMsg(8251), MessageBoxButton.OK, MessageBoxImage.Error) + EgtOutLog("Error in LoadGunStock") + Return False + End If + + ' Eseguo la copia + scene.Cursor = System.Windows.Forms.Cursors.WaitCursor + EgtLuaSetGlobStringVar("GGD.PEZFILE", sFilePath) + EgtLuaSetGlobStringVar("GGD.COPYDIR", sDirDest) + Dim sFunction As String = String.Empty + GetPrivateProfileString(S_GUNSTOCK, K_COPYFUNCTION, "", sFunction) + Dim bOk As Boolean = EgtLuaExecLine(sFunction) + Dim nErr As Integer = 999 + If Not EgtLuaGetGlobIntVar("GGD.ERR", nErr) Or nErr <> 0 Then bOk = False + EgtOutLog("Gunstock Err=" & nErr.ToString()) + ' Cancello variabile globale + EgtLuaResetGlobVar("GGD") + scene.Cursor = System.Windows.Forms.Cursors.Default + + Return bOk + End Function + Private Function LoadGunStock() As Boolean ' Cancello ambiente Gunstock globale EgtLuaResetGlobVar("GGD") diff --git a/Special-GunStock/GunStockPanelV.xaml b/Special-GunStock/GunStockPanelV.xaml index 9d8ddf2..ec8e36e 100644 --- a/Special-GunStock/GunStockPanelV.xaml +++ b/Special-GunStock/GunStockPanelV.xaml @@ -3,13 +3,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> - + diff --git a/Special-GunStock/GunStockPanelVM.vb b/Special-GunStock/GunStockPanelVM.vb index e254b6a..020e348 100644 --- a/Special-GunStock/GunStockPanelVM.vb +++ b/Special-GunStock/GunStockPanelVM.vb @@ -20,12 +20,17 @@ Public Class GunStockPanelVM Public ReadOnly Property NewGunStockMsg As String Get - Return EgtMsg(MSG_GUNSTOCK + 1) + Return EgtMsg(8201) End Get End Property Public ReadOnly Property ModifyGunStockMsg As String Get - Return EgtMsg(MSG_GUNSTOCK + 3) + Return EgtMsg(8203) + End Get + End Property + Public ReadOnly Property CopyGunStockMsg As String + Get + Return EgtMsg(8214) End Get End Property @@ -35,20 +40,35 @@ Public Class GunStockPanelVM Public ReadOnly Property NewGunStockToolTip As String Get - Return EgtMsg(MSG_GUNSTOCK + 2) + Return EgtMsg(8202) End Get End Property Public ReadOnly Property ModifyGunStockToolTip As String Get - Return EgtMsg(MSG_GUNSTOCK + 4) + Return EgtMsg(8204) + End Get + End Property + Public ReadOnly Property CopyGunStockToolTip As String + Get + Return EgtMsg(8215) End Get End Property #End Region ' ToolTip + Public ReadOnly Property CopyGunStock_Visibility As Visibility + Get + Dim sFunction As String = String.Empty + GetPrivateProfileString(S_GUNSTOCK, K_COPYFUNCTION, "", sFunction) + Return If( String.IsNullOrWhiteSpace( sFunction), Visibility.Collapsed, Visibility.Visible) + End Get + End Property + + ' Definizione comandi Private m_cmdNewGunStock As ICommand Private m_cmdModifyGunStock As ICommand + Private m_cmdCopyGunStock As ICommand Private Shared m_cmdOpenMruNewGunStock As ICommand Private Shared m_cmdOpenMruModifyGunStock As ICommand @@ -100,6 +120,33 @@ Public Class GunStockPanelVM #End Region ' ModifyGunStockCommand +#Region "CopyGunStockCommand" + + ''' + ''' Returns a command that Copy Part Program files. + ''' + Public ReadOnly Property CopyGunStockCommand As ICommand + Get + If m_cmdCopyGunStock Is Nothing Then + m_cmdCopyGunStock = New RelayCommand(AddressOf CopyGunStock) + End If + Return m_cmdCopyGunStock + End Get + End Property + + ''' + ''' Copy Part Program files. This method is invoked by the CopyGunStockCommand. + ''' + Public Sub CopyGunStock(ByVal param As Object) + Dim sFilePath As String = "" + IniFile.m_MruModifyGunStock.GetFileName(0, sFilePath) + Dim sDirDest As String = "" + GetPrivateProfileString(S_GUNSTOCK, K_COPYDIR, "", sDirDest) + Map.refProjectVM.GunStockCopy(sFilePath, sDirDest) + End Sub + +#End Region ' CopyGunStockCommand + #Region "OpenMruNewGunStockCommand" '''