private async void btnInstall_Click(object sender, EventArgs e) { if (cbVersions.SelectedItem is UpdateInfo selectedUpdateInfo) { await _controller.InstallVersionAsync(this, selectedUpdateInfo); UpdateControls(); } }
private async void btnUpdateLocalization_Click(object sender, EventArgs e) { if (Program.CurrentGame == null) { return; } var controller = new LocalizationController(Program.CurrentGame); controller.Load(); var installedVersion = controller.CurrentInstallation.InstalledVersion; if (installedVersion != null && await controller.RefreshVersionsAsync(this)) { var availableUpdate = controller.CurrentRepository.LatestUpdateInfo; if (availableUpdate != null && string.Compare(installedVersion, availableUpdate.GetVersion(), StringComparison.OrdinalIgnoreCase) != 0) { var dialogResult = MessageBox.Show(this, string.Format(Resources.Localization_UpdateAvailableInstallAsk_Text, $"\n{controller.CurrentRepository.Name} - {availableUpdate.GetVersion()}"), Resources.Localization_CheckForUpdate_Title, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes && await controller.InstallVersionAsync(this, availableUpdate)) { controller.CurrentRepository.SetCurrentVersion(availableUpdate.GetVersion()); } } else { MessageBox.Show(this, Resources.Localization_NoUpdatesFound_Text, Resources.Localization_CheckForUpdate_Title, MessageBoxButtons.OK, MessageBoxIcon.Information); } } }