mattercontrol/original/Launcher/Launcher.cs

44 lines
1.1 KiB
C#
Raw Normal View History

using System;
using System.Diagnostics;
2018-01-03 10:46:39 -08:00
using System.Globalization;
2015-04-08 15:20:10 -07:00
using System.IO;
2018-01-03 10:46:39 -08:00
using System.Threading;
namespace MatterHackers.MatterControl.Launcher
{
2015-04-08 15:20:10 -07:00
public class LauncherApp
{
public LauncherApp()
{
}
2015-04-08 15:20:10 -07:00
[STAThread]
public static void Main(string[] args)
{
2018-01-03 10:46:39 -08:00
// this sets the global culture for the app and all new threads
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
2018-01-24 09:04:33 -08:00
// and make sure the app is set correctly
2018-01-03 10:46:39 -08:00
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
2015-04-08 15:20:10 -07:00
if (args.Length == 2 && File.Exists(args[0]))
{
ProcessStartInfo runAppLauncherStartInfo = new ProcessStartInfo();
runAppLauncherStartInfo.FileName = args[0];
2015-04-08 15:20:10 -07:00
int timeToWait = 0;
int.TryParse(args[1], out timeToWait);
2015-04-08 15:20:10 -07:00
Stopwatch waitTime = new Stopwatch();
waitTime.Start();
while (waitTime.ElapsedMilliseconds < timeToWait)
{
}
2015-04-08 15:20:10 -07:00
Process.Start(runAppLauncherStartInfo);
}
}
}
}