/*****************************************************************************
* Copyright (c) 2000 Digi International Inc., All Rights Reserved
* 
* This software contains proprietary and confidential information of Digi
* International Inc.  By accepting transfer of this copy, Recipient agrees
* to retain this software in confidence, to prevent disclosure to others, 
* and to make no use of this software other than that for which it was
* delivered.  This is an unpublished copyrighted work of Digi International
* Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
* prohibited.
* 
* Restricted Rights Legend
*
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
* Technical Data and Computer Software clause at DFARS 252.227-7031 or
* subparagraphs (c)(1) and (2) of the Commercial Computer Software -
* Restricted Rights at 48 CFR 52.227-19, as applicable.
*
* Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
*
*****************************************************************************/

// PropPageOldDriver.cpp : implementation file
//

#include "stdafx.h"
#include "customapp.h"
#include "PropPageOldDriver.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPropPageOldDriver property page

IMPLEMENT_DYNCREATE(CPropPageOldDriver, CPropertyPageEx)

CPropPageOldDriver::CPropPageOldDriver() : CPropertyPageEx(CPropPageOldDriver::IDD,0,IDS_TitleOldDriver,IDS_SubTitleOldDriver)
{
	//{{AFX_DATA_INIT(CPropPageOldDriver)
	m_OldDriverInfo1 = _T("");
	m_OldDriverInfo2 = _T("");
	m_OldDriverInfo3 = _T("");
	//}}AFX_DATA_INIT
}

CPropPageOldDriver::~CPropPageOldDriver()
{
}

void CPropPageOldDriver::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPageEx::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPropPageOldDriver)
	DDX_Text(pDX, IDC_OldDriverInfo1, m_OldDriverInfo1);
	DDX_Text(pDX, IDC_OldDriverInfo2, m_OldDriverInfo2);
	DDX_Text(pDX, IDC_OldDriverInfo3, m_OldDriverInfo3);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPropPageOldDriver, CPropertyPageEx)
	//{{AFX_MSG_MAP(CPropPageOldDriver)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPropPageOldDriver message handlers

BOOL CPropPageOldDriver::OnSetActive() 
{
   CPropertySheetEx* psheet = (CPropertySheetEx*) GetParent();
#if defined ALLOW_OLD_DRIVER_INSTALL

   // NOTE: NOTE: We may want to disable the next button by default and put
   // a confirmation check box so the user doesn't just skip over the reading
   // of the info on this dialog

   psheet->SetWizardButtons(PSWIZB_NEXT);
#else // #if defined ALLOW_OLD_DRIVER_INSTALL
   psheet->SetWizardButtons(PSWIZB_FINISH);
#endif // #if defined ALLOW_OLD_DRIVER_INSTALL

   // NOTE: NOTE: Need to load a string based on the Allow or don't allow old driver....
   m_OldDriverInfo1.Format(IDS_OldDriverInfoForm1,
                           ((CCustomAppApp *)(AfxGetApp()))->GetExistingDriverMajor(),
                           ((CCustomAppApp *)(AfxGetApp()))->GetExistingDriverMinor(),
                           ((CCustomAppApp *)(AfxGetApp()))->GetExistingDriverBuildNumber());

   m_OldDriverInfo2.Format(IDS_OldDriverInfoForm2,DXBVER_VERSION_MAJOR,DXBVER_VERSION_MINOR,DXBVER_BUILDNUMBER);

   m_OldDriverInfo3.LoadString(IDS_OldDriverInfo3);

   UpdateData(FALSE); // Copy to the controls
   
	return CPropertyPageEx::OnSetActive();
}

LRESULT CPropPageOldDriver::OnWizardNext() 
{
   LRESULT Result = -1; // Don't allow the switch

#if defined ALLOW_OLD_DRIVER_INSTALL
   // This page just gives the user the option of cancelling out of the install
   // If they choose to proceed, it implies that they want to install the same
   // or older version of the driver... We'll just let them.
   Result =
      (((CCustomAppApp *)(AfxGetApp()))->DevMgrRunning()) ?
      ((CCustomAppApp *)(AfxGetApp()))->GetPropPageDevMgrRunningIdent() :
      ((CCustomAppApp *)(AfxGetApp()))->GetPropPageUpdateAdapterIdent() ;
#else // #if defined ALLOW_OLD_DRIVER_INSTALL

   ASSERT(FALSE); // Don't allow this!
   return Result; // moot

#endif // #if defined ALLOW_OLD_DRIVER_INSTALL
}
