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;
}