public void Launch() { if (!checkController()) return; stopMediaPlayback(); OnStarted(); launcher = new GameLauncher(game); BackgroundTaskHandler handler = new BackgroundTaskHandler(); handler.ActionDelegate = () => { launcher.ExtractionProgress += (s, e) => { beginInvoke(() => { handler.ExecuteProgressHandler(string.Format("Extracting {0}%", e.Percent), e.Percent); }); }; launcher.ExtractionFailed += launcher_ExtractionFailed; launcher.Starting += launcher_Starting; launcher.StartFailed += launcher_StartFailed; launcher.Exited += launcher_Exited; launcher.Launch(); }; MP1Utils.ShowProgressDialog(handler); }
protected override void DoTask(NavigationContext context) { if (!getParameters(context)) return; SetProgress("Launching " + game.Title, 0); launcher = new GameLauncher(game); launcher.ExtractionProgress += (s, e) => SetProgress(string.Format("Extracting {0}%", e.Percent), e.Percent); launcher.Starting += (s, e) => SetProgress("Launching...", 50); launcher.Exited += launcher_Exited; launcher.Launch(); }