mirror of
https://github.com/Tichau/FileConverter.git
synced 2026-11-23 11:02:33 +01:00
Define the application culture in all threads
This commit is contained in:
1 parent
d2fac27419
commit
f037d74645
3 files changed
+38
-3
No files matched your search
@@ -112,7 +112,7 @@ namespace FileConverter
|
||||
|
||||
if (this.needToRunConversionThread)
|
||||
{
|
||||
Thread fileConvertionThread = new Thread(this.ConvertFiles);
|
||||
Thread fileConvertionThread = Helpers.InstantiateThread("ConversionQueueThread", this.ConvertFiles);
|
||||
fileConvertionThread.Start();
|
||||
}
|
||||
}
|
||||
@@ -396,7 +396,7 @@ namespace FileConverter
|
||||
Thread thread = jobThreads[threadIndex];
|
||||
if (thread == null || !thread.IsAlive)
|
||||
{
|
||||
jobThread = new Thread(this.ExecuteConversionJob);
|
||||
jobThread = Helpers.InstantiateThread("ConversionThread", this.ExecuteConversionJob);
|
||||
jobThreads[threadIndex] = jobThread;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace FileConverter.ConversionJobs
|
||||
// Sub conversion job (for compression).
|
||||
this.compressionConversionJob = ConversionJobFactory.Create(this.ConversionPreset, this.intermediateFilePath);
|
||||
this.compressionConversionJob.PrepareConversion(this.intermediateFilePath, this.OutputFilePath);
|
||||
this.compressionThread = new Thread(this.CompressAsync);
|
||||
this.compressionThread = Helpers.InstantiateThread("CDACompressionThread", this.CompressAsync);
|
||||
}
|
||||
|
||||
protected override void Convert()
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace FileConverter
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
||||
public static class Helpers
|
||||
{
|
||||
@@ -118,6 +119,40 @@ namespace FileConverter
|
||||
}
|
||||
}
|
||||
|
||||
public static Thread InstantiateThread(string name, ThreadStart threadStart)
|
||||
{
|
||||
Application application = Application.Current as Application;
|
||||
CultureInfo currentCulture = application?.Settings?.ApplicationLanguage;
|
||||
|
||||
Thread thread = new Thread(threadStart);
|
||||
thread.Name = name;
|
||||
|
||||
if (currentCulture != null)
|
||||
{
|
||||
thread.CurrentCulture = currentCulture;
|
||||
thread.CurrentUICulture = currentCulture;
|
||||
}
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
public static Thread InstantiateThread(string name, ParameterizedThreadStart parameterizedThreadStart)
|
||||
{
|
||||
Application application = Application.Current as Application;
|
||||
CultureInfo currentCulture = application?.Settings?.ApplicationLanguage;
|
||||
|
||||
Thread thread = new Thread(parameterizedThreadStart);
|
||||
thread.Name = name;
|
||||
|
||||
if (currentCulture != null)
|
||||
{
|
||||
thread.CurrentCulture = currentCulture;
|
||||
thread.CurrentUICulture = currentCulture;
|
||||
}
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
public static class InputCategoryNames
|
||||
{
|
||||
public const string Audio = "Audio";
|
||||
|
||||
Reference in new issue
Block a user