protected void btnUpASProxyUpdateCheck_Click(object sender, EventArgs e) { Button btn = (Button)sender; if (btn.CommandName == "Update") { string pvName = btn.CommandArgument; try { EngineUpdateInfo updateInfo = EngineUpdater.DownloadEngineUpdateInfo(); DisplayEngineUpdate(updateInfo, false, null); } catch { DisplayEngineUpdate(null, false, null); } } }
protected void btnUpASProxyUpdate_Click(object sender, EventArgs e) { try { EngineUpdateInfo updateInfo = EngineUpdater.DownloadEngineUpdateInfo(); DisplayEngineUpdate(updateInfo, false, null); // download package and install it if (EngineUpdater.Install(updateInfo)) { DisplayEngineUpdate(updateInfo, true, null); } else { DisplayEngineUpdate(null, false, "Update installation failed!"); } } catch { DisplayEngineUpdate(null, false, null); } }
private void DisplayEngineUpdate(EngineUpdateInfo updateInfo, bool installed, string message) { pgUpdateASProxy.Visible = true; lblUpASProxyVersion.Text = Consts.General.ASProxyVersionFull; if (installed) { lblUpASProxyStatus.Text = "Update was successful"; lblUpASProxyStatus.ForeColor = Color.Green; btnUpASProxyUpdate.Enabled = false; } else if (updateInfo == null) { lblUpASProxyStatus.Text = "Unable to check for update."; lblUpASProxyStatus.ForeColor = Color.Red; btnUpASProxyUpdate.Enabled = false; } else { lblUpASProxyVersion.Text = updateInfo.UpdateVersion; if (Common.CompareASProxyVersions(updateInfo.UpdateVersion, Consts.General.ASProxyVersionFull) == 1) { lblUpASProxyStatus.Text = "Update is available."; lblUpASProxyStatus.ForeColor = Color.Green; btnUpASProxyUpdate.Enabled = true; } else { lblUpASProxyStatus.Text = "Update is not available."; lblUpASProxyStatus.ForeColor = Color.Red; btnUpASProxyUpdate.Enabled = false; } } if (!string.IsNullOrEmpty(message)) { lblUpASProxyStatus.Text = message; } }