EgtCAM5 2.4f6 :

- aggiunta possibilità di comando Copia a GunStock.
This commit is contained in:
DarioS
2022-07-03 18:59:10 +02:00
parent 2e70a7c944
commit be6eea1054
7 changed files with 104 additions and 19 deletions
+2 -1
View File
@@ -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"
+5 -5
View File
@@ -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
+2 -2
View File
@@ -70,6 +70,6 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.6.5")>
<Assembly: AssemblyFileVersion("2.4.6.5")>
<Assembly: AssemblyVersion("2.4.6.6")>
<Assembly: AssemblyFileVersion("2.4.6.6")>
+14
View File
@@ -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"
+26
View File
@@ -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")
+4 -7
View File
@@ -3,13 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel Background="Transparent" Orientation="Horizontal">
<!--<Button Command="{Binding GunStockCommand}" Style="{StaticResource GridViewPanelButton}"
Width="70" Content="GUNSTOCK" ContextMenuService.Placement="Bottom">
<Button.ContextMenu>
<ContextMenu ItemsSource="{Binding MruGunStockNames}" ItemContainerStyle="{StaticResource MruGunStockItem}">
</ContextMenu>
</Button.ContextMenu>
</Button>-->
<Button Command="{Binding NewGunStockCommand}" Style="{StaticResource GridViewPanelButton}"
Width="70" Content="{Binding NewGunStockMsg}" ContextMenuService.Placement="Bottom"
ToolTip="{Binding NewGunStockToolTip}">
@@ -28,6 +21,10 @@
</ContextMenu>
</Button.ContextMenu>
</Button>
<Button Command="{Binding CopyGunStockCommand}" Style="{StaticResource GridViewPanelButton}"
Width="70" Content="{Binding CopyGunStockMsg}" ContextMenuService.Placement="Bottom"
ToolTip="{Binding CopyGunStockToolTip}" Visibility="{Binding CopyGunStock_Visibility}">
</Button>
</StackPanel>
</UserControl>
+51 -4
View File
@@ -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"
''' <summary>
''' Returns a command that Copy Part Program files.
''' </summary>
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
''' <summary>
''' Copy Part Program files. This method is invoked by the CopyGunStockCommand.
''' </summary>
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"
''' <summary>