📄 resorgoptionsupdatespage.cpp
字号:
/************************************************************************
*
* Resource ID Organiser Core Library
*
* (c) Copyright 2000-2003 by Anna-Jayne Metcalfe (resorg@annasplace.me.uk)
* All rights reserved.
*
************************************************************************
*
* Filename : ResOrgOptionsUpdatesPage.cpp
*
* Description : CResOrgOptionsUpdatesPage - property page class
*
* Compiler : Microsoft Visual C++ 6.0, Service Pack 3 or later
* Microsoft Visual C++ .NET 2002
*
* Target
* Environment : Windows 98/NT/2000/XP
*
* NOTE:
*
* This software is provided "as is" free for personal use. All
* title and copyrights in and to the software, including but not
* limited to any images, text, etc. incorporated into it, are
* owned by Anna-Jayne Metcalfe, except where acknowledged otherwise.
*
* Your may freely to use this code in your own products, PROVIDED
* this notice is not removed or modified.
*
*
* Visit http://www.annasplace.me.uk/resorg for latest updates
*
************************************************************************
*
* MODIFICATION HISTORY:
*
* This is a controlled document. See project configuration
* control tool for latest version and full version history.
*
* $Archive: /Projects/AddIns/ResOrg/ResOrgCore/ResOrgOptionsUpdatesPage.cpp $
* $Revision: 10 $
* $Date: 15/04/03 20:37 $
* $Author: Anna $
*
* $History: ResOrgOptionsUpdatesPage.cpp $
*
* ***************** Version 10 *****************
* User: Anna Date: 15/04/03 Time: 20:37
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* 1. Removed unnecessary file guards (#pragma once works well enough)
* 2. Updated file banners
*
* ***************** Version 9 *****************
* User: Anna Date: 3/12/02 Time: 20:16
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Replaced the rich edit control with an HTML static control
*
* ***************** Version 8 *****************
* User: Anna Date: 25/11/02 Time: 15:14
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Changed website address in banner
*
* ***************** Version 7 *****************
* User: Anna Date: 22/10/02 Time: 13:24
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Changed name/mail address (at last!)
*
* ***************** Version 6 *****************
* User: Andy Date: 7/06/02 Time: 17:04
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Renamed the ResOrgUtils module to ResOrgCore. Updated file banners
* accordingly
*
* ***************** Version 5 *****************
* User: Andy Date: 11/15/01 Time: 1:44p
* Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
* Added new option to determine whether development versions should be
* checked for updates
*
* ***************** Version 4 *****************
* User: Andy Date: 2/07/01 Time: 22:08
* Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
* Added a timer to enable the "Check Now" button once an automatic
* version check completes
*
* ***************** Version 3 *****************
* User: Andy Date: 22/05/01 Time: 16:02
* Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
* Disable the property sheet whilst checking for new versions
*
* ***************** Version 2 *****************
* User: Andy Date: 22/05/01 Time: 6:45
* Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
* OnClickedCheckVersionNow() now displays a message box if the version
* checker fails to connect to the server
*
* ***************** Version 1 *****************
* User: Andy Date: 16/05/01 Time: 20:55
* Created in $/Projects/AddIns/ResOrg/ResOrgUtils
*
*
* $Nokeywords: $
*
************************************************************************/
#include "StdAfx.h"
#include "ResOrgCore_Priv.h"
#include "ResOrgVersionCheck.h"
#include "ResOrgVersionUpdatedDlg.h"
#include "ResOrgOptionsUpdatesPage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CResOrgOptionsUpdatesPage property page
IMPLEMENT_DYNCREATE(CResOrgOptionsUpdatesPage, CResOrgOptionsUpdatesPage_BASE)
CResOrgOptionsUpdatesPage::CResOrgOptionsUpdatesPage(void)
: CResOrgOptionsUpdatesPage_BASE(CResOrgOptionsUpdatesPage::IDD)
{
//{{AFX_DATA_INIT(CResOrgOptionsUpdatesPage)
m_bEnableVersionCheck = FALSE;
m_nVersionCheckInterval = 0;
m_bCheckDevelopmentVersions = FALSE;
//}}AFX_DATA_INIT
m_nTimerID = 0;
}
CResOrgOptionsUpdatesPage::~CResOrgOptionsUpdatesPage(void)
{
}
void CResOrgOptionsUpdatesPage::DoDataExchange(CDataExchange* pDX)
{
CResOrgOptionsUpdatesPage_BASE::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CResOrgOptionsUpdatesPage)
DDX_Control(pDX, IDC_RESORG_VERSION_CHECK_CAPTION, m_ctrlVersionCheckDetails);
DDX_Check(pDX, IDC_RESORG_VERSION_CHECK, m_bEnableVersionCheck);
DDX_Text(pDX, IDC_RESORG_VERSION_CHECK_INTERVAL, m_nVersionCheckInterval);
DDV_MinMaxInt(pDX, m_nVersionCheckInterval, 0, 90);
DDX_Radio(pDX, IDC_RESORG_VERSION_CHECK_TYPE, m_bCheckDevelopmentVersions);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CResOrgOptionsUpdatesPage, CResOrgOptionsUpdatesPage_BASE)
//{{AFX_MSG_MAP(CResOrgOptionsUpdatesPage)
ON_COMMAND( IDC_RESORG_VERSION_CHECK, OnCmdEnableVersionCheck)
ON_BN_CLICKED( IDC_RESORG_VERSION_CHECK_NOW, OnClickedCheckVersionNow)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResOrgOptionsUpdatesPage virtual overrides
BOOL CResOrgOptionsUpdatesPage::OnInitDialog(void)
{
CResOrgOptionsUpdatesPage_BASE::OnInitDialog();
m_ctrlVersionCheckDetails.SetWindowText( CString( (LPCSTR)IDS_RESORG_OPTIONS_UPDATE_PAGE_WAFFLE) );
if (Options.IsVersionCheckRunning() )
{
// If the version check is already running, we need to wait until
// it's finished before enabling this control
EnableDlgControl(IDC_RESORG_VERSION_CHECK_NOW, FALSE);
m_nTimerID = SetTimer(1, 500, NULL);
}
OnCmdEnableVersionCheck();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
////////////////////////////////////////////////////////////////////////////
// CResOrgOptionsUpdatesPage message handlers
void CResOrgOptionsUpdatesPage::OnCmdEnableVersionCheck(void)
{
EnableDlgControl(IDC_RESORG_VERSION_CHECK_INTERVAL, m_bEnableVersionCheck);
}
void CResOrgOptionsUpdatesPage::OnClickedCheckVersionNow(void)
{
if (!Options.IsVersionCheckRunning() )
{
CResOrgVersionCheck* pVersionChecker = Options.StartVersionCheck(FALSE);
ASSERT(NULL != pVersionChecker);
if (NULL != pVersionChecker)
{
DWORD dwStartAt = ::GetTickCount();
// Disable the property sheet
GetParent()->EnableWindow(FALSE);
// AJM 27.6.2001 for some reason TWO CWaitCursors
// are needed to prevent flickering!!!
CWaitCursor wait;
while (pVersionChecker->IsDownloading() && (::GetTickCount() - dwStartAt <= 60000) )
{
CWaitCursor wait;
MSG msg;
while (::PeekMessage( &msg,
NULL,
NULL,
NULL,
PM_NOREMOVE))
{
if (WM_SETCURSOR != LOWORD(msg.message) )
{
AfxGetThread()->PumpMessage();
}
}
// Now let MFC do its idle processing...
LONG lIdle = 0;
while ( AfxGetApp()->OnIdle(lIdle++) ) {}
}
GetParent()->EnableWindow(TRUE);
DWORD dwErrorCode = Options.GetVersionChecker()->GetErrorCode();
Options.OnVersionCheckCompleted(m_bCheckDevelopmentVersions, TRUE);
if (ERROR_SUCCESS != dwErrorCode)
{
AfxMessageBox( _T("The version information could not be read from the server"),
MB_OK | MB_ICONEXCLAMATION);
}
}
}
}
void CResOrgOptionsUpdatesPage::OnTimer(UINT nIDEvent)
{
if (!Options.IsVersionCheckRunning() )
{
// If the version check is already running, we need to wait until
// it's finished before enabling this control
EnableDlgControl(IDC_RESORG_VERSION_CHECK_NOW, TRUE);
KillTimer(m_nTimerID);
}
CResOrgOptionsUpdatesPage_BASE::OnTimer(nIDEvent);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -