Example #1
0
UpdateCheckerDlg::UpdateCheckerDlg(Update_Status updateStatus, const Version& latestVersion, CWnd* pParent /*=nullptr*/)
    : CDialog(UpdateCheckerDlg::IDD, pParent)
    , m_updateStatus(updateStatus)
{
    switch (updateStatus) {
    case UPDATER_UPDATE_AVAILABLE:
    case UPDATER_UPDATE_AVAILABLE_IGNORED:
        m_text.Format(IDS_NEW_UPDATE_AVAILABLE,
                      latestVersion.ToString(),
                      UpdateChecker::MPC_HC_VERSION.ToString());
        break;
    case UPDATER_LATEST_STABLE:
        m_text.LoadString(IDS_USING_LATEST_STABLE);
        break;
    case UPDATER_NEWER_VERSION:
        m_text.Format(IDS_USING_NEWER_VERSION,
                      UpdateChecker::MPC_HC_VERSION.ToString(),
                      latestVersion.ToString());
        break;
    case UPDATER_ERROR:
        m_text.LoadString(IDS_UPDATE_ERROR);
        break;
    default:
        ASSERT(0); // should never happen
    }
}
Example #2
0
bool General::CheckForUpdates() {
    _checkNow->Enabled(false);
    HCURSOR waitCursor = LoadCursor(NULL, IDC_WAIT);
    if (waitCursor) {
        SetCursor(waitCursor);
    }

    if (Updater::NewerVersionAvailable()) {
        Settings *settings = Settings::Instance();
        LanguageTranslator *translator = settings->Translator();
        Version vers = Updater::RemoteVersion();

        int msgResult = MessageBox(
            DialogHandle(),
            translator->TranslateAndReplace(
                L"A new version of 3RVX ({1}) is available. Install now?",
                vers.ToString()).c_str(),
            translator->Translate(L"Update Available").c_str(),
            MB_YESNO | MB_ICONQUESTION);

        if (msgResult == IDYES) {
            ProgressWindow *pw = new ProgressWindow(vers);
        }

    } else {
        MessageBox(
            DialogHandle(),
            L"Your copy of 3RVX is up-to-date.",
            L"Update Check",
            MB_OK | MB_ICONINFORMATION);
    }

    HCURSOR arrowCursor = LoadCursor(NULL, IDC_ARROW);
    if (arrowCursor) {
        SetCursor(arrowCursor);
    }
    _checkNow->Enabled(true);
    return true;
}