Ensure C# UI uses consistent culture on all threads. Closes #72

* This means that e.g. decimal separator will always be . and similar
  effects, which avoids the need to have culture specific formatting or
  special-case handling around CSV export etc.
This commit is contained in:
baldurk
2014-07-23 08:36:05 +01:00
parent e94726cbc1
commit 74a0330271
9 changed files with 29 additions and 12 deletions
+2
View File
@@ -105,6 +105,8 @@ namespace renderdocui.Code
// propogate float formatting settings to the Formatter class used globally to format float values
cfg.SetupFormatter();
Application.CurrentCulture = new System.Globalization.CultureInfo("en-GB");
var core = new Core(filename, temp, cfg);
try
+2 -2
View File
@@ -383,7 +383,7 @@ namespace renderdocui.Code
// We'll close it down when log loading finishes (whether it succeeds or fails)
ModalPopup modal = new ModalPopup(LogLoadCallback, true);
Thread modalThread = new Thread(new ThreadStart(() =>
Thread modalThread = Helpers.NewThread(new ThreadStart(() =>
{
modal.SetModalText(string.Format("Loading Log {0}.", m_LogFile));
@@ -396,7 +396,7 @@ namespace renderdocui.Code
// this thread continually ticks and notifies any threads of the progress, through a float
// that is updated by the main loading code
Thread thread = new Thread(new ThreadStart(() =>
Thread thread = Helpers.NewThread(new ThreadStart(() =>
{
modal.LogfileProgressBegin();
+15
View File
@@ -28,6 +28,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using Microsoft.Win32;
@@ -82,6 +83,20 @@ namespace renderdocui.Code
}
}
public static Thread NewThread(ParameterizedThreadStart s)
{
Thread ret = new Thread(s);
ret.CurrentCulture = Application.CurrentCulture;
return ret;
}
public static Thread NewThread(ThreadStart s)
{
Thread ret = new Thread(s);
ret.CurrentCulture = Application.CurrentCulture;
return ret;
}
public static void RefreshAssociations()
{
Win32PInvoke.SHChangeNotify(Win32PInvoke.HChangeNotifyEventID.SHCNE_ASSOCCHANGED,
+1 -1
View File
@@ -89,7 +89,7 @@ namespace renderdocui.Code
InitException = null;
m_Thread = new Thread(new ThreadStart(this.RunThread));
m_Thread = Helpers.NewThread(new ThreadStart(this.RunThread));
m_Thread.Priority = ThreadPriority.Highest;
m_Thread.Start();
+1 -1
View File
@@ -1351,7 +1351,7 @@ namespace renderdocui.Windows
Input input = state.m_Input;
uint instance = m_CurInst;
Thread th = new Thread(new ThreadStart(() =>
Thread th = Helpers.NewThread(new ThreadStart(() =>
{
byte[][] d = data.Buffers;
+1 -1
View File
@@ -115,7 +115,7 @@ namespace renderdocui.Windows
private void LiveCapture_Shown(object sender, EventArgs e)
{
m_ConnectThread = new Thread(new ThreadStart(ConnectionThreadEntry));
m_ConnectThread = Helpers.NewThread(new ThreadStart(ConnectionThreadEntry));
m_ConnectThread.Start();
}
@@ -87,7 +87,7 @@ namespace renderdocui.Windows.Dialogs
refresh.Enabled = false;
Thread th = new Thread(new ParameterizedThreadStart(LookupHostConnections));
Thread th = Helpers.NewThread(new ParameterizedThreadStart(LookupHostConnections));
th.Start(node);
}
@@ -263,7 +263,7 @@ namespace renderdocui.Windows.Dialogs
n.Image = global::renderdocui.Properties.Resources.hourglass;
n.Bold = false;
Thread th = new Thread(new ParameterizedThreadStart(LookupHostConnections));
Thread th = Helpers.NewThread(new ParameterizedThreadStart(LookupHostConnections));
th.Start(n);
}
hosts.EndUpdate();
+4 -4
View File
@@ -561,7 +561,7 @@ namespace renderdocui.Windows
}
}
thread = new Thread(new ThreadStart(() =>
thread = Helpers.NewThread(new ThreadStart(() =>
{
string[] drivers = new string[0];
try
@@ -644,7 +644,7 @@ namespace renderdocui.Windows
}
else
{
thread = new Thread(new ThreadStart(() => m_Core.LoadLogfile(filename, temporary)));
thread = Helpers.NewThread(new ThreadStart(() => m_Core.LoadLogfile(filename, temporary)));
}
thread.Start();
@@ -879,7 +879,7 @@ namespace renderdocui.Windows
m_Core.Config.CheckUpdate_LastUpdate = today;
var updateThread = new Thread(new ThreadStart(() =>
var updateThread = Helpers.NewThread(new ThreadStart(() =>
{
// spawn thread to check update
WebRequest g = HttpWebRequest.Create(String.Format("http://renderdoc.org/checkupdate/{0}", VersionString));
@@ -1263,7 +1263,7 @@ namespace renderdocui.Windows
{
bool killReplay = false;
Thread thread = new Thread(new ThreadStart(() =>
Thread thread = Helpers.NewThread(new ThreadStart(() =>
{
StaticExports.SpawnReplayHost(ref killReplay);
}));
+1 -1
View File
@@ -2302,7 +2302,7 @@ namespace renderdocui.Windows
return;
}
rangePaintThread = new Thread(new ThreadStart(() =>
rangePaintThread = Helpers.NewThread(new ThreadStart(() =>
{
m_Core.Renderer.Invoke((ReplayRenderer r) => { RT_UpdateAndDisplay(r); if (m_Output != null) m_Output.Display(); });
Thread.Sleep(8);