Base: Rename classes
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
@@ -76,10 +77,11 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="BaseClass.vb" />
|
||||
<Compile Include="ECM\ECM.vb" />
|
||||
<Compile Include="GraphicsEx.vb" />
|
||||
<Compile Include="IDB\Attributes.vb" />
|
||||
<Compile Include="IDB\Database.vb" />
|
||||
<Compile Include="IDB\FileStore.vb" />
|
||||
<Compile Include="Language.vb" />
|
||||
<Compile Include="LanguageEx.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
@@ -96,7 +98,7 @@
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="Performance.vb" />
|
||||
<Compile Include="PerformanceEx.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
|
||||
16
Base/GraphicsEx.vb
Normal file
16
Base/GraphicsEx.vb
Normal file
@@ -0,0 +1,16 @@
|
||||
Imports System.Drawing
|
||||
|
||||
Public Class GraphicsEx
|
||||
|
||||
Public Shared Function GetBrightness(c As Color) As Single
|
||||
Return (c.R * 0.299F + c.G * 0.587F + c.B * 0.114F) / 256.0F
|
||||
End Function
|
||||
|
||||
Public Shared Function GetContrastedColor(pOtherColor As Color) As Color
|
||||
If GetBrightness(pOtherColor) < 0.55 Then
|
||||
Return Color.White
|
||||
Else
|
||||
Return Color.Black
|
||||
End If
|
||||
End Function
|
||||
End Class
|
||||
@@ -1,32 +0,0 @@
|
||||
Imports System.Globalization
|
||||
Imports System.Threading
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Language
|
||||
Public Shared Sub SetApplicationLanguage(pLogger As Logger, pUserLanguage As String, Optional pUserDateFormat As String = Nothing)
|
||||
Try
|
||||
pLogger.Debug("Setting application language..")
|
||||
|
||||
'Dim Culture = CultureInfo.CreateSpecificCulture(pUserLanguage)
|
||||
Dim Culture As New CultureInfo(pUserLanguage)
|
||||
Culture.DateTimeFormat.ShortDatePattern = pUserDateFormat
|
||||
|
||||
pLogger.Debug("Culture object for language [{0}] created", pUserLanguage)
|
||||
|
||||
' The following line provides localization for data formats.
|
||||
Thread.CurrentThread.CurrentCulture = Culture
|
||||
' The following line provides localization for the application's user interface.
|
||||
Thread.CurrentThread.CurrentUICulture = Culture
|
||||
|
||||
' Set this culture as the default culture for all threads in this application.
|
||||
' Note: The following properties are supported in the .NET Framework 4.5+
|
||||
CultureInfo.DefaultThreadCurrentCulture = Culture
|
||||
CultureInfo.DefaultThreadCurrentUICulture = Culture
|
||||
|
||||
pLogger.Debug("Application language set to [{0}]", Culture.Name)
|
||||
Catch ex As Exception
|
||||
pLogger.Warn("Could not set application language!")
|
||||
pLogger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
55
Base/LanguageEx.vb
Normal file
55
Base/LanguageEx.vb
Normal file
@@ -0,0 +1,55 @@
|
||||
Imports System.Globalization
|
||||
Imports System.Threading
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
''' <summary>
|
||||
''' Functions relating to i18n, Cultures, Translations
|
||||
''' </summary>
|
||||
Public Class LanguageEx
|
||||
''' <summary>
|
||||
''' Sets the Language of the current thread by setting CurrentCulture and CurrentUICulture
|
||||
''' </summary>
|
||||
''' <param name="pLogger">A Logger instance</param>
|
||||
''' <param name="pUserLanguage">A language code in the form of 'de-DE'</param>
|
||||
''' <param name="pUserDateFormat">A custom date pattern</param>
|
||||
Public Shared Sub SetApplicationLanguage(pLogger As Logger, pUserLanguage As String, Optional pUserDateFormat As String = Nothing)
|
||||
Try
|
||||
pLogger.Debug("Setting application language..")
|
||||
|
||||
Dim Culture As New CultureInfo(pUserLanguage)
|
||||
If String.IsNullOrEmpty(pUserDateFormat) = False Then
|
||||
Culture.DateTimeFormat.ShortDatePattern = pUserDateFormat
|
||||
End If
|
||||
|
||||
pLogger.Debug("Culture object for language [{0}] created", pUserLanguage)
|
||||
|
||||
' The following line provides localization for data formats.
|
||||
Thread.CurrentThread.CurrentCulture = Culture
|
||||
' The following line provides localization for the application's user interface.
|
||||
Thread.CurrentThread.CurrentUICulture = Culture
|
||||
|
||||
' Set this culture as the default culture for all threads in this application.
|
||||
' Note: The following properties are supported in the .NET Framework 4.5+
|
||||
CultureInfo.DefaultThreadCurrentCulture = Culture
|
||||
CultureInfo.DefaultThreadCurrentUICulture = Culture
|
||||
|
||||
pLogger.Debug("Application language set to [{0}]", Culture.Name)
|
||||
Catch ex As Exception
|
||||
pLogger.Warn("Could not set application language!")
|
||||
pLogger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Logs the culture settings of the current thread
|
||||
''' </summary>
|
||||
''' <param name="pLogger">A Logger instance</param>
|
||||
Public Shared Sub LogApplicationLanguage(pLogger As Logger)
|
||||
pLogger.Debug("=== Application Language ===")
|
||||
pLogger.Debug("Thread.CurrentThread.CurrentCulture: [{0}]", Thread.CurrentThread.CurrentCulture)
|
||||
pLogger.Debug("Thread.CurrentThread.CurrentUICulture: [{0}]", Thread.CurrentThread.CurrentUICulture)
|
||||
pLogger.Debug("CultureInfo.DefaultThreadCurrentCulture: [{0}]", CultureInfo.DefaultThreadCurrentCulture)
|
||||
pLogger.Debug("CultureInfo.DefaultThreadCurrentUICulture: [{0}]", CultureInfo.DefaultThreadCurrentUICulture)
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
@@ -4,7 +4,7 @@ Imports System.Runtime.InteropServices
|
||||
Imports System.Security.Cryptography
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Performance
|
||||
Public Class PerformanceEx
|
||||
Public Sub New(pLogConfig As LogConfig, pAppDataPath As String)
|
||||
Dim savedHash = String.Empty
|
||||
Dim assemblyLocation = Assembly.GetEntryAssembly().Location
|
||||
Reference in New Issue
Block a user