OmagCUT:
- Cambiata gestione lingue. - Iniziato sviluppo DirectCut.
This commit is contained in:
+15
-2
@@ -1,4 +1,6 @@
|
||||
Imports System.Windows.Threading
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class AlarmsPageUC
|
||||
|
||||
@@ -11,11 +13,22 @@ Public Class AlarmsPageUC
|
||||
End Sub
|
||||
|
||||
Friend Sub NcError(ErrorMsg As String)
|
||||
NCErrorMessages.Text = m_CN.sz_NC_error_messages(0)
|
||||
m_MainWindow.m_MachineStatusUC.Background = Brushes.Red
|
||||
Dim nIndex As Integer
|
||||
While m_CN.sz_NC_error_messages(nIndex) <> "" And nIndex <= m_CN.sz_NC_error_messages.Count - 1
|
||||
NCErrorMessages.Text &= m_CN.sz_NC_error_messages(nIndex)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Friend Sub PlcError(ErrorMsg As String)
|
||||
PLCErrorMessages.Text = m_CN.sz_PLC_error_messages
|
||||
m_MainWindow.m_MachineStatusUC.Background = Brushes.Red
|
||||
Dim sFilePath As String = m_MainWindow.GetMachinesRootDir() & "/PLCMessages/" & EgtMsg(MSG_MACHINEPAGEUC + 1)
|
||||
Dim sErrorText As String = File.ReadLines(sFilePath).Skip(m_CN.sz_PLC_error_messages).Take(1).First()
|
||||
sErrorText = sErrorText.Substring(sErrorText.IndexOf("$"))
|
||||
If sErrorText(0) = " " Then
|
||||
sErrorText = sErrorText.Substring(1)
|
||||
End If
|
||||
PLCErrorMessages.Text = sErrorText
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
+8
-2
@@ -167,13 +167,19 @@ Public Class CNCommunication
|
||||
If m_CN.b_NC_error Then
|
||||
m_AlarmsPage.NcError(m_CN.sz_NC_error_messages(0))
|
||||
Else
|
||||
m_AlarmsPage.NCErrorMessages.Text = "---------"
|
||||
Dim BackColor As SolidColorBrush = m_MainWindow.m_MachineStatusUC.MachineStatusGrid.Background
|
||||
If Colors.Red.Equals(BackColor.Color) Then
|
||||
m_MainWindow.m_MachineStatusUC.MachineStatusGrid.Background = Brushes.DarkGray
|
||||
End If
|
||||
End If
|
||||
|
||||
If m_CN.b_PLC_error Then
|
||||
m_AlarmsPage.PlcError(m_CN.sz_PLC_error_messages)
|
||||
Else
|
||||
m_AlarmsPage.PLCErrorMessages.Text = "---------"
|
||||
Dim BackColor As SolidColorBrush = m_MainWindow.m_MachineStatusUC.MachineStatusGrid.Background
|
||||
If Colors.Red.Equals(BackColor.Color) Then
|
||||
m_MainWindow.m_MachineStatusUC.MachineStatusGrid.Background = Brushes.DarkGray
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -29,6 +29,9 @@ Module ConstIni
|
||||
Public Const K_CAMERALINK As String = "CameraLink"
|
||||
Public Const K_CNLINK As String = "CNLink"
|
||||
|
||||
Public Const S_LANGUAGES As String = "Languages"
|
||||
Public Const K_LANGUAGE As String = "Language"
|
||||
|
||||
Public Const S_LUA As String = "Lua"
|
||||
Public Const K_LIBSDIR As String = "LibsDir"
|
||||
Public Const K_BASELIB As String = "BaseLib"
|
||||
|
||||
+52
-19
@@ -1,38 +1,71 @@
|
||||
<UserControl x:Class="DirectCutPageUC"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="853.3" d:DesignWidth="1280" Initialized="DirectCutPage_Initialized">
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="853.3" d:DesignWidth="1280" Initialized="DirectCutPage_Initialized" Loaded="DirectCutPage_Loaded">
|
||||
|
||||
<!-- Chiamata al Dictionary -->
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary Source="OmagCutDictionary.xaml"/>
|
||||
</UserControl.Resources>
|
||||
<!-- Chiamata al Dictionary -->
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary Source="OmagCutDictionary.xaml"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<!-- Definizione della DirectCutPage -->
|
||||
<Grid Name="DirectCutPageGrid" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="8*"/>
|
||||
<!-- Definizione della DirectCutPage -->
|
||||
<Grid Name="DirectCutPageGrid" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
<ColumnDefinition Width="12*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="8*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Definizione della Grid inferiore -->
|
||||
<Grid Name="LeftButtonGrid" Grid.Row="1" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Button Name="FirstAxisBtn" Grid.Row="2" FontSize="22" Content="X" Height="60" Width="60" />
|
||||
<TextBox Name="FirstAxisTxBx" Grid.Column="1" Grid.Row="2" FontSize="20" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" Width="150" TextAlignment="Center" Style="{StaticResource NumericKeyboard}" />
|
||||
<Button Name="SecondAxisBtn" Grid.Row="3" FontSize="22" Content="Y" Height="60" Width="60"/>
|
||||
<TextBox Name="SecondAxisTxBx" Grid.Column="1" Grid.Row="3" FontSize="20" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" Width="150" TextAlignment="Center" Style="{StaticResource NumericKeyboard}" />
|
||||
<Button Name="ThirdAxisBtn" Grid.Row="4" FontSize="22" Content="Z" Height="60" Width="60"/>
|
||||
<TextBox Name="ThirdAxisTxBx" Grid.Column="1" Grid.Row="4" FontSize="20" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" Width="150" TextAlignment="Center" Style="{StaticResource NumericKeyboard}" />
|
||||
<Button Name="FourthAxisBtn" Grid.Row="5" FontSize="22" Content="C" Height="60" Width="60"/>
|
||||
<TextBox Name="FourthAxisTxBx" Grid.Column="1" Grid.Row="5" FontSize="20" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" Width="150" TextAlignment="Center" Style="{StaticResource NumericKeyboard}" />
|
||||
<Button Name="FifthAxisBtn" Grid.Row="6" FontSize="22" Content="B" Height="60" Width="60"/>
|
||||
<TextBox Name="FifthAxisTxBx" Grid.Column="1" Grid.Row="6" FontSize="20" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" Width="150" TextAlignment="Center" Style="{StaticResource NumericKeyboard}" />
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- Definizione della Grid inferiore -->
|
||||
<Grid Name="LowerButtonGrid" Grid.Column="0" Grid.Row="2" >
|
||||
<Grid Name="LowerButtonGrid" Grid.ColumnSpan="2" Grid.Row="2" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="13*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
</UserControl>
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
Public Class DirectCutPageUC
|
||||
|
||||
' Dichiarazione delle Page UserControl
|
||||
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
Friend m_MachineButtons As MachineButtonsUC
|
||||
Friend m_CN As CN_generico
|
||||
Private m_bFirst As Boolean
|
||||
|
||||
Private Sub DirectCutPage_Initialized(sender As Object, e As EventArgs)
|
||||
|
||||
@@ -17,4 +20,22 @@
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub DirectCutPage_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
If m_bFirst Then 'm_bfirst
|
||||
If m_MainWindow.m_bNCLink <> 0 Then
|
||||
'Rinomino cn per avere nome più corto
|
||||
m_CN = m_MainWindow.m_CNCommunication.m_CN
|
||||
End If
|
||||
m_bFirst = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub FirstAxisBtn_Click(sender As Object, e As RoutedEventArgs) Handles FirstAxisBtn.Click
|
||||
m_CN.DGeneralFunctions_WriteCncMode(2)
|
||||
m_CN.sz_ManualDataInput = FirstAxisTxBx.Text
|
||||
m_CN.MDI_command()
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="85.3" d:DesignWidth="1280" Initialized="MachineStatus_Initialized">
|
||||
d:DesignHeight="85.3" d:DesignWidth="1280" Initialized="MachineStatus_Initialized" PreviewMouseDown="MachineStatus_PreviewMouseDown" Loaded="MachineStatus_Loaded">
|
||||
|
||||
<!-- ** Definizione della MachineStatusBar ** -->
|
||||
<Grid Name="MachineStatusGrid" Background="DarkGray">
|
||||
|
||||
+88
-3
@@ -10,12 +10,99 @@ Public Class MachineStatusUC
|
||||
|
||||
' ' Riferimento alla MainWindow
|
||||
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
|
||||
Private m_MachinePage As MachinePageUC
|
||||
|
||||
Private Sub MachineStatus_Initialized(sender As Object, e As EventArgs)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub MachineStatus_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
m_MachinePage = m_MainWindow.m_MachinePageUC
|
||||
End Sub
|
||||
|
||||
Private Sub MachineStatus_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
|
||||
MachinePageClick()
|
||||
End Sub
|
||||
|
||||
Sub MachinePageClick()
|
||||
'Emulo il click della pagina Macchina
|
||||
Select Case m_MainWindow.m_ActivePage
|
||||
Case MainWindow.Pages.WorkInProgress
|
||||
m_MainWindow.WorkInProgressBtn.IsChecked = False
|
||||
m_MainWindow.MachineBtn.IsChecked = True
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_WorkInProgressPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_MachinePageUC)
|
||||
m_MainWindow.m_ActivePage = MainWindow.Pages.Machine
|
||||
AlarmsPageClick()
|
||||
Case MainWindow.Pages.DirectCut
|
||||
m_MainWindow.DirectCutBtn.IsChecked = False
|
||||
m_MainWindow.MachineBtn.IsChecked = True
|
||||
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(m_MainWindow.m_DirectCutPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_MachinePageUC)
|
||||
m_MainWindow.m_ActivePage = MainWindow.Pages.Machine
|
||||
AlarmsPageClick()
|
||||
Case MainWindow.Pages.CadCut
|
||||
m_MainWindow.CadCutBtn.IsChecked = False
|
||||
m_MainWindow.MachineBtn.IsChecked = True
|
||||
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(m_MainWindow.m_CadCutPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_MachinePageUC)
|
||||
m_MainWindow.m_ActivePage = MainWindow.Pages.Machine
|
||||
AlarmsPageClick()
|
||||
Case MainWindow.Pages.RawPart
|
||||
m_MainWindow.CadCutBtn.IsChecked = True
|
||||
m_MainWindow.MachineBtn.IsChecked = False
|
||||
Case MainWindow.Pages.Simulation
|
||||
m_MainWindow.CadCutBtn.IsChecked = True
|
||||
m_MainWindow.MachineBtn.IsChecked = False
|
||||
Case MainWindow.Pages.Draw
|
||||
m_MainWindow.CadCutBtn.IsChecked = True
|
||||
m_MainWindow.MachineBtn.IsChecked = False
|
||||
Case MainWindow.Pages.Import
|
||||
m_MainWindow.CadCutBtn.IsChecked = True
|
||||
m_MainWindow.MachineBtn.IsChecked = False
|
||||
Case MainWindow.Pages.FrameCut
|
||||
m_MainWindow.FrameCutBtn.IsChecked = False
|
||||
m_MainWindow.MachineBtn.IsChecked = True
|
||||
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(m_MainWindow.m_FrameCutPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_MachinePageUC)
|
||||
m_MainWindow.m_ActivePage = MainWindow.Pages.Machine
|
||||
AlarmsPageClick()
|
||||
Case MainWindow.Pages.Machine
|
||||
m_MainWindow.MachineBtn.IsChecked = True
|
||||
AlarmsPageClick()
|
||||
Case MainWindow.Pages.Options
|
||||
m_MainWindow.MachineBtn.IsChecked = True
|
||||
m_MainWindow.OptionsBtn.IsChecked = False
|
||||
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_OptionsPageUC)
|
||||
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_MachinePageUC)
|
||||
m_MainWindow.m_ActivePage = MainWindow.Pages.Machine
|
||||
AlarmsPageClick()
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub AlarmsPageClick()
|
||||
'Emulo il click della pagina allarmi dopo il click della pagina macchina
|
||||
Select Case m_MachinePage.m_ActiveMachinePage
|
||||
Case MachinePageUC.MachinePages.Alarms
|
||||
m_MachinePage.AlarmsBtn.IsChecked = True
|
||||
Case MachinePageUC.MachinePages.ToolsDb
|
||||
m_MachinePage.AlarmsBtn.IsChecked = False
|
||||
m_MachinePage.ToolsDBBtn.IsChecked = True
|
||||
Case MachinePageUC.MachinePages.MachiningDb
|
||||
m_MachinePage.AlarmsBtn.IsChecked = False
|
||||
m_MachinePage.MachiningDBBtn.IsChecked = True
|
||||
Case MachinePageUC.MachinePages.Testing
|
||||
m_MachinePage.AlarmsBtn.IsChecked = True
|
||||
m_MachinePage.TestingPageBtn.IsChecked = False
|
||||
m_MachinePage.MachinePageGrid.Children.Remove(m_MachinePage.m_TestingPage)
|
||||
m_MachinePage.MachinePageGrid.Children.Add(m_MachinePage.m_AlarmsPageUC)
|
||||
m_MachinePage.m_ActiveMachinePage = MachinePageUC.MachinePages.Alarms
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Sub DisplayPosition()
|
||||
|
||||
For n As Short = 0 To MAX_AXES - 1
|
||||
@@ -91,6 +178,4 @@ Public Class MachineStatusUC
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
+23
-3
@@ -47,6 +47,11 @@ Class MainWindow
|
||||
Friend m_sMachIniFile As String = String.Empty
|
||||
Private m_nDebug As Integer = 0
|
||||
|
||||
'Dichiarazione variabile contenente la lingua corrente
|
||||
Friend m_CurrLanguage As Language
|
||||
'Dichiarazione lista delle lingue disponibili e lingua corrente
|
||||
Friend m_LanguagesList As New List(Of Language)
|
||||
|
||||
' Dichiarazione lista per ListBox della ImportPage
|
||||
Friend m_ImportItemList As New ObservableCollection(Of IconListBoxItem)
|
||||
Friend m_OpenItemList As New ObservableCollection(Of IconListBoxItem)
|
||||
@@ -59,7 +64,7 @@ Class MainWindow
|
||||
' Riferimento alla pagina correntemente attiva
|
||||
Friend m_ActivePage As Pages
|
||||
|
||||
Enum Pages
|
||||
Friend Enum Pages
|
||||
WorkInProgress
|
||||
DirectCut
|
||||
CadCut
|
||||
@@ -151,14 +156,29 @@ Class MainWindow
|
||||
If GetPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir, m_sIniFile) = 0 Then
|
||||
sMsgDir = m_sConfigDir
|
||||
End If
|
||||
'Leggo elenco lingue disponibili da file ini
|
||||
Dim nIndex As Integer = 1
|
||||
Dim ReadLanguage As Language = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex, GetIniFile)
|
||||
While Not IsNothing(ReadLanguage)
|
||||
m_LanguagesList.Add(ReadLanguage)
|
||||
nIndex += 1
|
||||
ReadLanguage = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex, GetIniFile)
|
||||
End While
|
||||
' Leggo file messaggi
|
||||
Dim sMsgFile As String = String.Empty
|
||||
GetPrivateProfileString(S_GENERAL, K_MESSAGES, "", sMsgFile, m_sIniFile)
|
||||
Dim sMsgFilePath As String = sMsgDir & "\" & sMsgFile
|
||||
For i As Integer = 0 To m_LanguagesList.Count - 1
|
||||
If m_LanguagesList(i).LanguageName = sMsgFile Then
|
||||
m_CurrLanguage = m_LanguagesList(i)
|
||||
End If
|
||||
Next
|
||||
Dim sMsgFilePath As String = sMsgDir & "\EgalTechIta.txt"
|
||||
If Not IsNothing(m_CurrLanguage) Then
|
||||
sMsgFilePath = sMsgDir & "\" & m_CurrLanguage.FileName
|
||||
End If
|
||||
If Not EgtLoadMessages(sMsgFilePath) Then
|
||||
EgtOutLog("Error in EgtLoadMessages")
|
||||
End If
|
||||
' imposto dir font Nfe e font default
|
||||
Dim sNfeDir As String = String.Empty
|
||||
GetPrivateProfileString(S_GEOMDB, K_NFEFONTDIR, "", sNfeDir, m_sIniFile)
|
||||
Dim sDefFont As String = String.Empty
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
Private m_bFirst As Boolean
|
||||
|
||||
Private Sub TestingPage_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
If 1 Then 'm_bfirst
|
||||
If m_bFirst Then 'm_bfirst
|
||||
If m_MainWindow.m_bNCLink <> 0 Then
|
||||
'Rinomino cn per avere nome più corto
|
||||
m_CN = m_MainWindow.m_CNCommunication.m_CN
|
||||
|
||||
+71
-26
@@ -3,34 +3,79 @@ Imports EgtUILib
|
||||
|
||||
Module Utility
|
||||
|
||||
Friend Sub HideParkedParts()
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
While nPartId <> GDB_ID.NULL
|
||||
EgtSetStatus(nPartId, GDB_ST.OFF)
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
End While
|
||||
End Sub
|
||||
Friend Sub HideParkedParts()
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
While nPartId <> GDB_ID.NULL
|
||||
EgtSetStatus(nPartId, GDB_ST.OFF)
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Friend Sub ShowParkedParts()
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
While nPartId <> GDB_ID.NULL
|
||||
EgtSetStatus(nPartId, GDB_ST.ON_)
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
End While
|
||||
End Sub
|
||||
Friend Sub ShowParkedParts()
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
While nPartId <> GDB_ID.NULL
|
||||
EgtSetStatus(nPartId, GDB_ST.ON_)
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Friend Function DoubleToString(ByVal dVal As Double, ByVal nNumDec As UInteger) As String
|
||||
Dim sFormat As String = "F" + nNumDec.ToString()
|
||||
Dim sVal As String = dVal.ToString(sFormat, CultureInfo.InvariantCulture)
|
||||
If nNumDec > 0 Then
|
||||
Return sVal.TrimEnd("0".ToCharArray()).TrimEnd(".".ToCharArray)
|
||||
Else
|
||||
Return sVal
|
||||
End If
|
||||
End Function
|
||||
Friend Function DoubleToString(ByVal dVal As Double, ByVal nNumDec As UInteger) As String
|
||||
Dim sFormat As String = "F" + nNumDec.ToString()
|
||||
Dim sVal As String = dVal.ToString(sFormat, CultureInfo.InvariantCulture)
|
||||
If nNumDec > 0 Then
|
||||
Return sVal.TrimEnd("0".ToCharArray()).TrimEnd(".".ToCharArray)
|
||||
Else
|
||||
Return sVal
|
||||
End If
|
||||
End Function
|
||||
|
||||
Friend Function StringToDouble(ByVal sVal As String, ByRef dVal As Double) As Boolean
|
||||
Return EgtLuaEvalNumExpr(sVal, dVal)
|
||||
End Function
|
||||
Friend Function StringToDouble(ByVal sVal As String, ByRef dVal As Double) As Boolean
|
||||
Return EgtLuaEvalNumExpr(sVal, dVal)
|
||||
End Function
|
||||
|
||||
Public Class Language
|
||||
|
||||
Private m_sLanguageName As String
|
||||
Private m_sFileName As String
|
||||
|
||||
Public Property LanguageName As String
|
||||
Get
|
||||
Return m_sLanguageName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sLanguageName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property FileName As String
|
||||
Get
|
||||
Return m_sFileName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_sFileName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(LanguageName As String, FileName As String)
|
||||
Me.LanguageName = LanguageName
|
||||
Me.FileName = FileName
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Function GetPrivateProfileLanguage(
|
||||
ByVal lpAppName As String,
|
||||
ByVal lpKeyName As String,
|
||||
ByVal 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
|
||||
|
||||
End Module
|
||||
|
||||
Reference in New Issue
Block a user