Run client Main in an STA thread manually
This commit is contained in:
parent
6d56fc7011
commit
c91dff52a9
@ -3,13 +3,23 @@ using System.Net;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using TrueCraft.Core;
|
using TrueCraft.Core;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace TrueCraft.Client
|
namespace TrueCraft.Client
|
||||||
{
|
{
|
||||||
public static class Program
|
public static class Program
|
||||||
{
|
{
|
||||||
[STAThread]
|
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var thread = new Thread(() => Main_Thread(args));
|
||||||
|
thread.SetApartmentState(ApartmentState.STA);
|
||||||
|
thread.Start();
|
||||||
|
thread.Join();
|
||||||
|
}
|
||||||
|
|
||||||
|
// We need to spawn the main thread manually so we can register the assembly resolver
|
||||||
|
// and manage apartment state ourselves.
|
||||||
|
private static void Main_Thread(string[] args)
|
||||||
{
|
{
|
||||||
UserSettings.Local = new UserSettings();
|
UserSettings.Local = new UserSettings();
|
||||||
UserSettings.Local.Load();
|
UserSettings.Local.Load();
|
||||||
|
Reference in New Issue
Block a user