- aggiunti EgtInterface e Language

- modificata finestra Copia Multipla
This commit is contained in:
Emmanuele Sassi
2025-07-08 16:21:01 +02:00
parent bdcda23197
commit 6deabc6be5
7 changed files with 150 additions and 44 deletions
@@ -114,10 +114,12 @@
</Compile>
<Compile Include="Utility\Command.vb" />
<Compile Include="Utility\Converters.vb" />
<Compile Include="Utility\EgtInterface.vb" />
<Compile Include="Utility\ExecProcessManager.vb" />
<Compile Include="Utility\GenInterface.vb" />
<Compile Include="Utility\IdNameStruct.vb" />
<Compile Include="Utility\IniFile.vb" />
<Compile Include="Utility\Language.vb" />
<Compile Include="Utility\PluginIniFile.vb" />
<Compile Include="Utility\StringConversion.vb" />
<Compile Include="Utility\ThreadData.vb" />
@@ -9,14 +9,14 @@
SizeToContent="WidthAndHeight"
IsResizable="False"
IsMinimizable="False"
Title="Copia multipla"
IsClosable="False"
Title="{Binding sTitle}"
MinWidth="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!--<local:TitleBar/>-->
<Grid Grid.Row="1"
Margin="30,10">
<Grid.RowDefinitions>
@@ -28,7 +28,7 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Numero di copie"
<TextBlock Text="{Binding sCopyNumberMsg}"
Margin="0,0,5,0"
Style="{StaticResource TextBlock.MultipleCopy}"/>
<TextBox Grid.Column="1"
@@ -43,12 +43,12 @@
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Button Content="Ok"
<Button Content="{Binding sOkMsg}"
Command="{Binding Ok_Command}"
Margin="0,0,5,0"
Style="{StaticResource Button.Confirm}"/>
<Button Grid.Column="1"
Content="Annulla"
Content="{Binding sCancelMsg}"
Command="{Binding Cancel_Command}"
Margin="5,0,0,0"
Style="{StaticResource Button.Confirm}"/>
@@ -3,6 +3,12 @@
Friend Event m_CloseWindow(bDialogResult As Boolean)
Public ReadOnly Property sTitle As String
Get
Return EgtMsg(1101)
End Get
End Property
Private m_nCopyNumber As Integer
Public ReadOnly Property nCopyNumber As Integer
Get
@@ -15,12 +21,34 @@
End Get
Set(value As String)
If Not Integer.TryParse(value, m_nCopyNumber) Then
MessageBox.Show("Valore non impostabile come quantita' di porte!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
MessageBox.Show(EgtMsg(1103), EgtMsg(1051), MessageBoxButton.OK, MessageBoxImage.Error)
NotifyPropertyChanged(sCopyNumber)
End If
End Set
End Property
#Region "Messages"
Public ReadOnly Property sCopyNumberMsg As String
Get
Return EgtMsg(1102)
End Get
End Property
Public ReadOnly Property sOkMsg As String
Get
Return EgtMsg(1001)
End Get
End Property
Public ReadOnly Property sCancelMsg As String
Get
Return EgtMsg(1002)
End Get
End Property
#End Region ' Messages
' Definizione comandi
Private m_cmdOk As ICommand
Private m_cmdCancel As ICommand
@@ -0,0 +1,80 @@
Imports System.Runtime.InteropServices
Imports System.Security
Public Module EgtInterface
#If DEBUG Then
Const EgtIntDll32 As String = "EgtBasisD32.dll"
#Else
Const EgtIntDll32 As String = "EgtBasisR32.dll"
#End If
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtSetKey"), SuppressUnmanagedCodeSecurity()>
Public Function EgtSetKey(sKey As String) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtGetKeyLevel"), SuppressUnmanagedCodeSecurity()>
Public Function EgtGetKeyLevel(nProd As Integer, nVer As Integer, nLev As Integer, ByRef nKLev As Integer) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtGetKeyOptions"), SuppressUnmanagedCodeSecurity()>
Public Function EgtGetKeyOptions(nProd As Integer, nVer As Integer, nLev As Integer,
ByRef nOpt1 As UInteger, ByRef nOpt2 As UInteger) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtGetKeyLeftDays"), SuppressUnmanagedCodeSecurity()>
Public Function EgtGetKeyLeftDays(ByRef nLeftDays As Integer) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtGetKeyAssLeftDays"), SuppressUnmanagedCodeSecurity()>
Public Function EgtGetKeyAssLeftDays(ByRef nAssLeftDays As Integer) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtGetKeyOptLeftDays"), SuppressUnmanagedCodeSecurity()>
Public Function EgtGetKeyOptLeftDays(ByRef nOptLeftDays As Integer) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtFreeMemory"), SuppressUnmanagedCodeSecurity()>
Public Function EgtFreeMemory(sB As IntPtr) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtLoadMessages"), SuppressUnmanagedCodeSecurity()>
Public Function EgtLoadMessages(sMsgFilePath As String) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtGetMsg"), SuppressUnmanagedCodeSecurity()>
Private Function EgtGetMsg_32(nId As Integer) As IntPtr
End Function
Public Function EgtMsg(nId As Integer) As String
Return Marshal.PtrToStringUni(EgtGetMsg_32(nId))
' Non è necessario liberare la memoria nativa perchè usa un buffer statico
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtInitLogger"), SuppressUnmanagedCodeSecurity()>
Public Function EgtInitLogger(nDebug As Integer, sLogFilePath As String) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtOutLog"), SuppressUnmanagedCodeSecurity()>
Private Function EgtOutLog(sMsg As String, nDebugLevel As Integer) As Boolean
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtGetStringUtf8FromIni"), SuppressUnmanagedCodeSecurity()>
Private Function EgtGetStringUtf8FromIni_32(sSec As String, sKey As String, sDef As String, ByRef sVal As IntPtr, sIniFile As String) As Boolean
End Function
Public Function EgtGetStringUtf8FromIni(sSec As String, sKey As String, sDef As String, ByRef sVal As String, sIniFile As String) As Boolean
Dim psVal As IntPtr
Dim bOk As Boolean = EgtGetStringUtf8FromIni_32(sSec, sKey, sDef, psVal, sIniFile)
If bOk Then
sVal = Marshal.PtrToStringUni(psVal)
EgtFreeMemory(psVal)
Else
sVal = String.Empty
End If
Return bOk
End Function
<DllImport(EgtIntDll32, CharSet:=CharSet.Unicode, EntryPoint:="EgtWriteStringUtf8ToIni"), SuppressUnmanagedCodeSecurity()>
Public Function EgtWriteStringUtf8toIni(sSec As String, sKey As String, sVal As String, sIniFile As String) As Boolean
End Function
End Module
+12 -18
View File
@@ -38,25 +38,19 @@ Public Module IniFile
Return GetPrivateProfileString(IpAppName, IpKeyName, IpDefault, IpString, m_sPath)
End Function
'Public Function GetPrivateProfileLanguage(lpAppName As String, lpKeyName As String, lpFileName As String) As Language
' Dim sVal As String = String.Empty
' GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
' 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 GetPrivateProfileLanguage(lpAppName As String, lpKeyName As String, lpFileName As String) As Language
Dim sVal As String = String.Empty
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
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 GetMainPrivateProfileLanguage(lpAppName As String, lpKeyName As String) As Language
' Dim sVal As String = String.Empty
' GetMainPrivateProfileString(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 GetMainPrivateProfileLanguage(lpAppName As String, lpKeyName As String) As Language
Return GetPrivateProfileLanguage(lpAppName, lpKeyName, m_sPath)
End Function
Public Function WriteMainPrivateProfileString(IpAppName As String, IpKeyName As String, ByRef IpString As String) As Boolean
Return WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_sPath)
+22
View File
@@ -0,0 +1,22 @@
Public Class Language
Private m_sName As String
Public ReadOnly Property Name As String
Get
Return m_sName
End Get
End Property
Private m_sFilePath As String
Public ReadOnly Property FilePath As String
Get
Return m_sFilePath
End Get
End Property
Sub New(sName As String, sFilePath As String)
m_sName = sName
m_sFilePath = sFilePath
End Sub
End Class
@@ -38,26 +38,6 @@ Public Module PluginIniFile
Return GetPrivateProfileString(IpAppName, IpKeyName, IpDefault, IpString, m_sPath)
End Function
'Public Function GetPrivateProfileLanguage(lpAppName As String, lpKeyName As String, lpFileName As String) As Language
' Dim sVal As String = String.Empty
' GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
' 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 GetMainPrivateProfileLanguage(lpAppName As String, lpKeyName As String) As Language
' Dim sVal As String = String.Empty
' GetMainPrivateProfileString(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 WritePluginPrivateProfileString(IpAppName As String, IpKeyName As String, ByRef IpString As String) As Boolean
Return WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_sPath)
End Function