private void Form2_Load(object sender, EventArgs e) { // Disables maximizing the window by setting the maximized size to the default size MaximizedBounds = Bounds; string installedModBotVersionString; do { _installationState = ModBotInstallerManager.GetModBotInstallationState(UserPreferences.Current.GameInstallationDirectory, out installedModBotVersionString, out string errorMessage); if (_installationState == ModBotInstallationState.Failed) { DialogResult dialogResult = MessageBox.Show(errorMessage, "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); if (dialogResult == DialogResult.Cancel) { // End current process Utils.EndCurrentProcess(); return; } // If the selected option is not Cancel, we should try again } }while (_installationState == ModBotInstallationState.Failed); refreshItemsBasedOnCurrentState(); if (installedModBotVersionString != null) // Just to be safe { LocalVersionLabel.Text = "Local version: " + installedModBotVersionString; } else { LocalVersionLabel.Visible = false; } if (ServerData.HasData) { LatestVersionLabel.Text = "Latest version: " + ServerData.LatestModBotVersion; } else { LatestVersionLabel.Visible = false; } }
private void Reinstall_Click(object sender, EventArgs e) { if (UserPreferences.Current.ShouldUseBetaPath) { UserPreferences.Current.ResetBetaSourceDirectory(); } StatusLabel.Hide(); installedModsView.Hide(); installedModsTitle.Hide(); InstallButton.Hide(); CloseButton.Hide(); Reinstall.Hide(); modBotSettingsButton.Hide(); LocalVersionLabel.Hide(); LatestVersionLabel.Hide(); ProgressBar.Show(); installingModBotLabel.Show(); ModBotInstallerManager.ProgressBar = ProgressBar; ModBotInstallerManager.Install(UserPreferences.Current.GameInstallationDirectory, OnInstallFinished); }
private void InstallButton_Click(object sender, EventArgs e) { if ((_installationState != ModBotInstallationState.UpToDate && _installationState != ModBotInstallationState.BetaVersion) || UserPreferences.Current.ShouldUseBetaPath) { StatusLabel.Hide(); installedModsView.Hide(); installedModsTitle.Hide(); InstallButton.Hide(); CloseButton.Hide(); Reinstall.Hide(); modBotSettingsButton.Hide(); LocalVersionLabel.Hide(); LatestVersionLabel.Hide(); ProgressBar.Show(); installingModBotLabel.Show(); ModBotInstallerManager.ProgressBar = ProgressBar; ModBotInstallerManager.Install(UserPreferences.Current.GameInstallationDirectory, OnInstallFinished); } else { StartGameAndExit(); } }