diff --git a/Application/FileConverter/Application.xaml.cs b/Application/FileConverter/Application.xaml.cs index 95e556b..04318e5 100644 --- a/Application/FileConverter/Application.xaml.cs +++ b/Application/FileConverter/Application.xaml.cs @@ -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; } diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_ExtractCDA.cs b/Application/FileConverter/ConversionJobs/ConversionJob_ExtractCDA.cs index 381fcc6..85e8726 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob_ExtractCDA.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob_ExtractCDA.cs @@ -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() diff --git a/Application/FileConverter/Helpers.cs b/Application/FileConverter/Helpers.cs index 3cf57b5..e748b31 100644 --- a/Application/FileConverter/Helpers.cs +++ b/Application/FileConverter/Helpers.cs @@ -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";