diff --git a/Base/Base.vbproj b/Base/Base.vbproj
index 42e132b1..66cdaafa 100644
--- a/Base/Base.vbproj
+++ b/Base/Base.vbproj
@@ -52,6 +52,7 @@
+
@@ -76,10 +77,11 @@
+
-
+
True
@@ -96,7 +98,7 @@
Settings.settings
True
-
+
diff --git a/Base/GraphicsEx.vb b/Base/GraphicsEx.vb
new file mode 100644
index 00000000..d4c840b4
--- /dev/null
+++ b/Base/GraphicsEx.vb
@@ -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
diff --git a/Base/Language.vb b/Base/Language.vb
deleted file mode 100644
index 6c9b0e10..00000000
--- a/Base/Language.vb
+++ /dev/null
@@ -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
diff --git a/Base/LanguageEx.vb b/Base/LanguageEx.vb
new file mode 100644
index 00000000..2f349fd5
--- /dev/null
+++ b/Base/LanguageEx.vb
@@ -0,0 +1,55 @@
+Imports System.Globalization
+Imports System.Threading
+Imports DigitalData.Modules.Logging
+
+'''
+''' Functions relating to i18n, Cultures, Translations
+'''
+Public Class LanguageEx
+ '''
+ ''' Sets the Language of the current thread by setting CurrentCulture and CurrentUICulture
+ '''
+ ''' A Logger instance
+ ''' A language code in the form of 'de-DE'
+ ''' A custom date pattern
+ 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
+
+ '''
+ ''' Logs the culture settings of the current thread
+ '''
+ ''' A Logger instance
+ 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
diff --git a/Base/Performance.vb b/Base/PerformanceEx.vb
similarity index 98%
rename from Base/Performance.vb
rename to Base/PerformanceEx.vb
index f94d50a6..0ab72cba 100644
--- a/Base/Performance.vb
+++ b/Base/PerformanceEx.vb
@@ -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