/// <summary> /// The main entry point for the application. /// </summary> private static void Main() { // Bind any unhandled exceptions in the main thread so that they are logged. AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; // Set correct working directory for compatibility with double-clicking Directory.SetCurrentDirectory(DirectoryHelpers.GetLocalLauncherDirectory()); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Environment.SetEnvironmentVariable("GTK_EXE_PREFIX", Directory.GetCurrentDirectory()); Environment.SetEnvironmentVariable("GTK_DATA_PREFIX", Directory.GetCurrentDirectory()); Environment.SetEnvironmentVariable("GSETTINGS_SCHEMA_DIR", "share\\glib-2.0\\schemas\\"); } Log.Info($"\n\n\n"); Log.Info($"----------------------------------------------------------------------------"); Log.Info($"Launching Youcanevent launcher {System.DateTime.Now}"); Log.Info($"Launchpad v{LocalVersionService.GetLocalLauncherVersion()} starting..."); var systemBitness = Environment.Is64BitOperatingSystem ? "x64" : "x86"; var processBitness = Environment.Is64BitProcess ? "64-bit" : "32-bit"; Log.Info($"Current platform: {PlatformHelpers.GetCurrentPlatform()} ({systemBitness} platform, {processBitness} process)"); Log.Info("Initializing UI..."); // Bind any unhandled exceptions in the GTK UI so that they are logged. ExceptionManager.UnhandledException += OnGLibUnhandledException; // Run the GTK UI Gtk.Application.Init(); var win = MainWindow.Create(); win.Show(); Timeout.Add ( 50, () => { Task.Factory.StartNew ( () => win.InitializeAsync(), CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.FromCurrentSynchronizationContext() ); return(false); } ); Gtk.Application.Run(); }
private static async Task Main() { // Bind any unhandled exceptions in the main thread so that they are logged. AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; log4net.Config.XmlConfigurator.Configure(); Log.Info("----------------"); Log.Info($"Launchpad v{LocalVersionService.GetLocalLauncherVersion()} starting..."); Log.Info($"Current platform: {PlatformHelpers.GetCurrentPlatform()} ({(Environment.Is64BitOperatingSystem ? "x64" : "x86")})"); // Set correct working directory for compatibility with double-clicking Directory.SetCurrentDirectory(DirectoryHelpers.GetLocalLauncherDirectory()); Log.Info("Initializing UI..."); // Bind any unhandled exceptions in the GTK UI so that they are logged. ExceptionManager.UnhandledException += OnGLibUnhandledException; // Run the GTK UI Gtk.Application.Init(); SynchronizationContext.SetSynchronizationContext(new GLibSynchronizationContext()); var win = new MainWindow(); win.Show(); Timeout.Add ( 50, () => { win.InitializeAsync(); return(false); } ); Gtk.Application.Run(); }