private void StartGame(string args) {
StartButton.IsEnabled = false;
LauncherManager LauncherManager = App.Kernel.Get<LauncherManager>();
Profile currentProfile = ProfileManager.CurrentProfile;
GameModel model = currentProfile.GameModel;
IConfiguration configuration = ConfigurationManager.GetConfiguration(model);
ILauncher launcher = LauncherManager.GetLauncher(currentProfile);
ConfigurationManager CM = ConfigurationManager as ConfigurationManager;
// we should not provide this api as public.
CM.UpdateRegistryPaths(model);
bool executed = false;
try {
executed = launcher.Execute(
UpdateRequired ? ConfigurationManager.GetLauncherEXE(model) : ConfigurationManager.GetGameEXE(model),
UpdateRequired ? configuration.ConvertLauncherStartArgs(args) : configuration.ConvertGameStartArgs(args));
} catch {
DialogManager.ShowMessageDialog(LanguageManager.Model.ErrorOccured, LanguageManager.Model.ErrorOccured);
}
if (executed) {
StartButton.SetBinding(Button.ContentProperty, WaitingButtonBinding);
if (currentProfile.KBLCServiceEnabled) {
launcher = LauncherManager.findByType<DirectLauncher>(typeof(DirectLauncher));
launcher.Execute(EnvironmentManager.KBLCFile, "-attach -notray");
}
TaskManager.CloseApp();
} else {
ProfileManager.OnProfileLocked(false);
EnvironmentManager.OnFileSystemLocked(false);
StartButton.IsEnabled = true;
}
}