public void Command_Launch() { var process = new Process { StartInfo = { FileName = AppInfo.Executable.FullName, WorkingDirectory = Path.GetDirectoryName(AppInfo.Executable.FullName) }, EnableRaisingEvents = true }; process.Exited += delegate { State.Value = LaunchManagerState.Idle; }; State.HasChanged += delegate { _home.Invoke((Action)(() => { if (State.Value == LaunchManagerState.GameRunning) { _home.Hide(); _icon.Visible = true; _icon.ShowBalloonTip(1000, "Launching", "Launching the application. The launcher will remain in the tray for cleanup.", ToolTipIcon.Info); } else { Command_ExitApplication(); } })); }; State.Value = process.Start() ? LaunchManagerState.GameRunning : LaunchManagerState.Idle; }
public void Command_Launch() { var process = new Process { StartInfo = { FileName = AppInfo.Executable.FullName, WorkingDirectory = Path.GetDirectoryName(AppInfo.Executable.FullName) }, EnableRaisingEvents = true }; //UNCOMMENT TO ADD COMMAND LINE ARGUMENTS //process.StartInfo.Arguments = "-force-d3d11"; process.Exited += delegate { State.Value = LaunchManagerState.Idle; }; State.HasChanged += delegate { _home.Invoke((Action)(() => { if (State.Value == LaunchManagerState.GameRunning) { // Only Windows has native support for icon trays, so for this is only for Windows if (IsWindows) { _home.Hide(); _icon.Visible = true; _icon.ShowBalloonTip(1000, "Launching", "Launching the application. The launcher will remain in the tray for cleanup.", ToolTipIcon.Info); } } else { Command_ExitApplication(); } })); }; State.Value = process.Start() ? LaunchManagerState.GameRunning : LaunchManagerState.Idle; }