2014-04-10 10:36:59 -07:00
|
|
|
|
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;
|
2014-04-10 10:36:59 -07:00
|
|
|
|
|
|
|
|
|
|
namespace MatterHackers.MatterControl.Launcher
|
|
|
|
|
|
{
|
2015-04-08 15:20:10 -07:00
|
|
|
|
public class LauncherApp
|
|
|
|
|
|
{
|
|
|
|
|
|
public LauncherApp()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
2014-04-10 10:36:59 -07:00
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
// and make sure tha appl is set correctly
|
|
|
|
|
|
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];
|
2014-04-10 10:36:59 -07:00
|
|
|
|
|
2015-04-08 15:20:10 -07:00
|
|
|
|
int timeToWait = 0;
|
|
|
|
|
|
int.TryParse(args[1], out timeToWait);
|
2014-04-10 10:36:59 -07:00
|
|
|
|
|
2015-04-08 15:20:10 -07:00
|
|
|
|
Stopwatch waitTime = new Stopwatch();
|
|
|
|
|
|
waitTime.Start();
|
|
|
|
|
|
while (waitTime.ElapsedMilliseconds < timeToWait)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
2014-04-10 10:36:59 -07:00
|
|
|
|
|
2015-04-08 15:20:10 -07:00
|
|
|
|
Process.Start(runAppLauncherStartInfo);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|