/// <summary> /// Updates the web browser with the asynchronously loaded changelog from the server. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The arguments containing the HTML from the server.</param> protected void OnChangelogDownloadFinished(object sender, GameDownloadFinishedEventArgs e) { //Take the resulting HTML string from the changelog download and send it to the changelog browser Application.Invoke(delegate { Browser.LoadHtmlString(e.Result, e.ResultType); }); }
/// <summary> /// Initializes a new instance of the <see cref="Launchpad_Launcher.GameHandler"/> class. /// </summary> public GameHandler() { ProgressArgs = new FileDownloadProgressChangedEventArgs(); DownloadFinishedArgs = new GameDownloadFinishedEventArgs(); UpdateFinishedArgs = new GameUpdateFinishedEventArgs(); RepairFinishedArgs = new GameRepairFinishedEventArgs(); DownloadFailedArgs = new GameDownloadFailedEventArgs(); UpdateFailedArgs = new GameUpdateFailedEventArgs(); RepairFailedArgs = new GameRepairFailedEventArgs(); LaunchFailedArgs = new GameLaunchFailedEventArgs(); GameExitArgs = new GameExitEventArgs(); }
/// <summary> /// Allows the user to launch or repair the game once installation finishes. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">Contains the result of the download.</param> protected void OnGameDownloadFinished(object sender, GameDownloadFinishedEventArgs e) { this.Invoke((MethodInvoker) delegate { if (e.Result == "1") //there was an error { MessageLabel.Text = LocalizationCatalog.GetString("gameDownloadFailMessage"); Stream iconStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Launchpad.Launcher.Resources.RocketIcon.ico"); if (iconStream != null) { NotifyIcon launchFailedNotification = new NotifyIcon(); launchFailedNotification.Icon = new System.Drawing.Icon(iconStream); launchFailedNotification.Visible = true; launchFailedNotification.BalloonTipTitle = LocalizationCatalog.GetString("errorTitle"); launchFailedNotification.BalloonTipText = LocalizationCatalog.GetString("gameDownloadFailMessage");; launchFailedNotification.ShowBalloonTip(10000); } SetLauncherMode(ELauncherMode.Repair, false); } else //the game has finished downloading, and we should be OK to launch { MessageLabel.Text = LocalizationCatalog.GetString("idleString"); downloadProgressLabel.Text = ""; Stream iconStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Launchpad.Launcher.Resources.RocketIcon.ico"); if (iconStream != null) { NotifyIcon launchFailedNotification = new NotifyIcon(); launchFailedNotification.Icon = new System.Drawing.Icon(iconStream); launchFailedNotification.Visible = true; launchFailedNotification.BalloonTipTitle = LocalizationCatalog.GetString("infoTitle"); launchFailedNotification.BalloonTipText = LocalizationCatalog.GetString("gameDownloadFinishedMessage"); launchFailedNotification.ShowBalloonTip(10000); } SetLauncherMode(ELauncherMode.Launch, false); } }); }
/// <summary> /// Allows the user to launch or repair the game once installation finishes. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">Contains the result of the download.</param> protected void OnGameDownloadFinished(object sender, GameDownloadFinishedEventArgs e) { if (e != null) { if (e.Result == "1") //there was an error { MessageLabel.Text = Mono.Unix.Catalog.GetString("Game download failed. Are you missing the manifest?"); Notification failedNot = new Notification(); failedNot.IconName = Stock.DialogError; failedNot.Summary = Mono.Unix.Catalog.GetString("Launchpad - Error"); failedNot.Body = Mono.Unix.Catalog.GetString("Game download failed. Are you missing the manifest?"); failedNot.Show(); ELauncherMode parsedMode; if (Enum.TryParse(e.ResultType, out parsedMode)) { SetLauncherMode(parsedMode, false); } else { SetLauncherMode(ELauncherMode.Repair, false); } } else //the game has finished downloading, and we should be OK to launch { MessageLabel.Text = Mono.Unix.Catalog.GetString("Idle"); progressbar2.Text = ""; Notification completedNot = new Notification(); completedNot.IconName = Stock.Info; completedNot.Summary = Mono.Unix.Catalog.GetString("Launchpad - Info"); completedNot.Body = Mono.Unix.Catalog.GetString("Game download finished. Play away!"); completedNot.Show(); SetLauncherMode(ELauncherMode.Launch, false); } } }
/// <summary> /// Initializes a new instance of the <see cref="Launchpad_Launcher.LauncherHandler"/> class. /// </summary> public LauncherHandler() { ProgressArgs = new FileDownloadProgressChangedEventArgs(); DownloadFinishedArgs = new GameDownloadFinishedEventArgs(); }
/// <summary> /// Updates the web browser with the asynchronously loaded changelog from the server. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The arguments containing the HTML from the server.</param> private void OnChangelogDownloadFinished(object sender, GameDownloadFinishedEventArgs e) { changelogBrowser.DocumentText = e.Result; changelogBrowser.Refresh(); }