/// <summary> /// Raises the button ok clicked event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> protected void OnButtonOkClicked(object sender, EventArgs e) { Application.Invoke(delegate { progressbar3.Text = Mono.Unix.Catalog.GetString("Verifying..."); }); bool bAreAllSettingsOK = true; Config.SetGameName(GameName_entry.Text); ESystemTarget SystemTarget = Utilities.ParseSystemTarget(combobox_SystemTarget.ActiveText); if (SystemTarget != ESystemTarget.Invalid) { Config.SetSystemTarget(SystemTarget); } else { bAreAllSettingsOK = false; } if (FTPURL_entry.Text.StartsWith("ftp://")) { Config.SetBaseFTPUrl(FTPURL_entry.Text); } else { bAreAllSettingsOK = false; Gdk.Color col = new Gdk.Color(255, 128, 128); FTPURL_entry.ModifyBase(StateType.Normal, col); FTPURL_entry.TooltipText = Mono.Unix.Catalog.GetString("The URL needs to begin with \"ftp://\". Please correct the URL."); } Config.SetFTPPassword(FTPPassword_entry.Text); Config.SetFTPUsername(FTPUsername_entry.Text); if (bAreAllSettingsOK) { if (Checks.CanConnectToFTP()) { Destroy(); } else { MessageDialog dialog = new MessageDialog( null, DialogFlags.Modal, MessageType.Warning, ButtonsType.Ok, Mono.Unix.Catalog.GetString("Failed to connect to the FTP server. Please check your FTP settings.")); dialog.Run(); dialog.Destroy(); } } progressbar3.Text = Mono.Unix.Catalog.GetString("Idle"); }
public MainForm() { InitializeComponent(); Config.Initialize(); MessageLabel.Text = LocalizationCatalog.GetString("idleString"); downloadProgressLabel.Text = String.Empty; //set the window text to match the game name this.Text = "Launchpad - " + Config.GetGameName(); //first of all, check if we can connect to the FTP server. if (!Checks.CanConnectToFTP()) { MessageBox.Show( this, LocalizationCatalog.GetString("ftpConnectionFailureMessage"), LocalizationCatalog.GetString("ftpConnectionFailureString"), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); MessageLabel.Text = LocalizationCatalog.GetString("ftpConnectionFailureString"); PrimaryButton.Text = ":("; PrimaryButton.Enabled = false; } else { //if we can connect, proceed with the rest of our checks. if (ChecksHandler.IsInitialStartup()) { DialogResult shouldInstallHere = MessageBox.Show( this, String.Format( LocalizationCatalog.GetString("initialStartupMessage"), ConfigHandler.GetLocalDir()), LocalizationCatalog.GetString("infoTitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (shouldInstallHere == DialogResult.Yes) { //yes, install here ConfigHandler.CreateUpdateCookie(); } else { //no, don't install here Environment.Exit(2); } } if (bSendAnonStats) { StatsHandler.SendUsageStats(); } else { Stream iconStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Launchpad.Launcher.Resources.RocketIcon.ico"); if (iconStream != null) { NotifyIcon noUsageStatsNotification = new NotifyIcon(); noUsageStatsNotification.Icon = new System.Drawing.Icon(iconStream); noUsageStatsNotification.Visible = true; noUsageStatsNotification.BalloonTipTitle = LocalizationCatalog.GetString("infoTitle"); noUsageStatsNotification.BalloonTipText = LocalizationCatalog.GetString("usageTitle"); noUsageStatsNotification.ShowBalloonTip(10000); } } //load the changelog from the server Launcher.ChangelogDownloadFinished += OnChangelogDownloadFinished; Launcher.LoadChangelog(); //Does the launcher need an update? if (!Checks.IsLauncherOutdated()) { if (Checks.IsManifestOutdated()) { Launcher.DownloadManifest(); } if (!Checks.IsGameInstalled()) { SetLauncherMode(ELauncherMode.Install, false); } else { if (Checks.IsGameOutdated()) { SetLauncherMode(ELauncherMode.Update, false); } else { SetLauncherMode(ELauncherMode.Launch, false); } } } else { SetLauncherMode(ELauncherMode.Update, false); } } }
public MainWindow() : base(WindowType.Toplevel) { //initialize localization Mono.Unix.Catalog.Init("Launchpad", "./locale"); //Initialize the config files and check values. Config.Initialize(); //Initialize the GTK UI this.Build(); //set the window title Title = "Launchpad - " + Config.GetGameName(); // Configure the WebView for our changelog Browser.SetSizeRequest(290, 300); scrolledwindow2.Add(Browser); scrolledwindow2.ShowAll(); MessageLabel.Text = Mono.Unix.Catalog.GetString("Idle"); //First of all, check if we can connect to the FTP server. if (!Checks.CanConnectToFTP()) { MessageDialog dialog = new MessageDialog( null, DialogFlags.Modal, MessageType.Warning, ButtonsType.Ok, Mono.Unix.Catalog.GetString("Failed to connect to the FTP server. Please check your FTP settings.")); dialog.Run(); dialog.Destroy(); MessageLabel.Text = Mono.Unix.Catalog.GetString("Could not connect to server."); } else { //if we can connect, proceed with the rest of our checks. if (ChecksHandler.IsInitialStartup()) { MessageDialog shouldInstallHereDialog = new MessageDialog( null, DialogFlags.Modal, MessageType.Question, ButtonsType.OkCancel, String.Format(Mono.Unix.Catalog.GetString( "This appears to be the first time you're starting the launcher.\n" + "Is this the location where you would like to install the game?" + "\n\n{0}"), ConfigHandler.GetLocalDir() )); if (shouldInstallHereDialog.Run() == (int)ResponseType.Ok) { shouldInstallHereDialog.Destroy(); //yes, install here Console.WriteLine("Installing in current directory."); ConfigHandler.CreateUpdateCookie(); } else { shouldInstallHereDialog.Destroy(); //no, don't install here Console.WriteLine("Exiting..."); Environment.Exit(0); } } if (bSendAnonStats) { StatsHandler.SendUsageStats(); } else { Notification noUsageStatsNotification = new Notification(); noUsageStatsNotification.IconName = Stock.DialogWarning; noUsageStatsNotification.Urgency = Urgency.Normal; noUsageStatsNotification.Summary = Mono.Unix.Catalog.GetString("Launchpad - Warning"); noUsageStatsNotification.Body = Mono.Unix.Catalog.GetString("Anonymous useage stats are not enabled."); noUsageStatsNotification.Show(); } //Start loading the changelog asynchronously Launcher.ChangelogDownloadFinished += OnChangelogDownloadFinished; Launcher.LoadChangelog(); //if the launcher does not need an update at this point, we can continue checks for the game if (!Checks.IsLauncherOutdated()) { if (Checks.IsManifestOutdated()) { Launcher.DownloadManifest(); } if (!Checks.IsGameInstalled()) { //if the game is not installed, offer to install it Console.WriteLine("Not installed."); SetLauncherMode(ELauncherMode.Install, false); } else { //if the game is installed (which it should be at this point), check if it needs to be updated if (Checks.IsGameOutdated()) { //if it does, offer to update it Console.WriteLine("Game is outdated or not installed"); SetLauncherMode(ELauncherMode.Update, false); } else { //if not, enable launching the game SetLauncherMode(ELauncherMode.Launch, false); } } } else { //the launcher was outdated. SetLauncherMode(ELauncherMode.Update, false); } } }