/// <summary> /// "Install app update" button click event handler. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">Event arguments.</param> private void UpdAppStatus_Click(object sender, EventArgs e) { if (!WrkChkApp.IsBusy) { if (UpMan.CheckAppUpdate()) { if (Platform.OS == CurrentPlatform.OSType.Windows) { if (InstallBinaryUpdate(UpMan.AppUpdateURL)) { Platform.Exit(ReturnCodes.AppUpdatePending); } } else { MessageBox.Show(String.Format(AppStrings.UPD_AppOtherPlatform, Platform.OSFriendlyName), Properties.Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show(AppStrings.UPD_LatestInstalled, Properties.Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show(AppStrings.DB_WrkInProgress, Properties.Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void UpdAppStatus_Click(object sender, EventArgs e) { if (!WrkChkApp.IsBusy) { // Проверяем наличие обновлений программы... if (UpMan.CheckAppUpdate()) { // Проверяем платформу, на которой запущено приложение... if (Platform.OS == CurrentPlatform.OSType.Windows) { // Устанавливаем доступное обновление... if (InstallBinaryUpdate(UpMan.AppUpdateURL, UpMan.AppUpdateHash)) { // Загрузка завершилась успешно. Завершаем работу приложения для установки... Environment.Exit(9); } } else { // Платформа не Windows, выведем сообщение... MessageBox.Show(String.Format(AppStrings.UPD_AppOtherPlatform, Platform.OSFriendlyName), Properties.Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { // Обновление не требуется, поэтому просто выводим сообщение об этом... MessageBox.Show(AppStrings.UPD_LatestInstalled, Properties.Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show(AppStrings.DB_WrkInProgress, Properties.Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Finalizes update checking procedure. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">Completion arguments and results.</param> private void WrkChkApp_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { if (e.Error == null) { // Checking for application update... if (UpMan.CheckAppUpdate()) { UpdAppImg.Image = Properties.Resources.upd_av; UpdAppStatus.Text = String.Format(AppStrings.UPD_AppUpdateAvail, UpMan.AppUpdateVersion); } else { UpdAppImg.Image = Properties.Resources.upd_nx; UpdAppStatus.Text = AppStrings.UPD_AppNoUpdates; UpdateTimeSetApp(); } } else { // Changing controls texts... UpdAppImg.Image = Properties.Resources.upd_err; UpdAppStatus.Text = AppStrings.UPD_AppCheckFailure; // Writing issue to log... Logger.Warn(e.Error); } } catch (Exception Ex) { Logger.Warn(Ex); } }
private void WrkChkApp_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { // Проверим статус проверки... if (e.Error == null) { // Проверим наличие обновлений для приложения... if (UpMan.CheckAppUpdate()) { UpdAppImg.Image = Properties.Resources.upd_av; UpdAppStatus.Text = String.Format(AppStrings.UPD_AppUpdateAvail, UpMan.AppUpdateVersion); } else { UpdAppImg.Image = Properties.Resources.upd_nx; UpdAppStatus.Text = AppStrings.UPD_AppNoUpdates; UpdateTimeSetApp(); } // Проверим наличие обновлений для базы игр... if (UpMan.CheckGameDBUpdate()) { UpdDBImg.Image = Properties.Resources.upd_av; UpdDBStatus.Text = String.Format(AppStrings.UPD_DbUpdateAvail, UpMan.GameUpdateHash.Substring(0, 7)); } else { UpdDBImg.Image = Properties.Resources.upd_nx; UpdDBStatus.Text = AppStrings.UPD_DbNoUpdates; } // Проверим наличие обновлений для базы HUD... if (UpMan.CheckHUDUpdate()) { UpdHUDDbImg.Image = Properties.Resources.upd_av; UpdHUDStatus.Text = String.Format(AppStrings.UPD_HUDUpdateAvail, UpMan.HUDUpdateHash.Substring(0, 7)); } else { UpdHUDDbImg.Image = Properties.Resources.upd_nx; UpdHUDStatus.Text = AppStrings.UPD_HUDNoUpdates; UpdateTimeSetHUD(); } } else { // Произошла ошибка... UpdAppImg.Image = Properties.Resources.upd_err; UpdAppStatus.Text = AppStrings.UPD_AppCheckFailure; UpdDBImg.Image = Properties.Resources.upd_err; UpdDBStatus.Text = AppStrings.UPD_DbCheckFailure; UpdHUDDbImg.Image = Properties.Resources.upd_err; UpdHUDStatus.Text = AppStrings.UPD_HUDCheckFailure; // Запишем в журнал... CoreLib.WriteStringToLog(e.Error.Message); } } catch (Exception Ex) { CoreLib.WriteStringToLog(Ex.Message); } }