Esempio n. 1
0
// Activate the page with the specified dialog resource
void CNewWizDialog::SetActivePageByResource(UINT nResourceID)
{
	CNewWizPage* pPage = GetPageByResourceID(nResourceID);
	if (pPage == NULL) return;

	if (!DeactivatePage()) return;

	ActivatePage(pPage);
}
Esempio n. 2
0
void CNewWizDialog::OnWizardNext() 
{
	CNewWizPage* pPage = GetActivePage();
	ASSERT(pPage);

	LRESULT lResult = pPage->OnWizardNext();
	if (lResult == -1) return; // don't change pages

	if (lResult == 0)
	{
		POSITION Pos = m_PageList.Find(pPage);
		ASSERT(Pos);
		m_PageList.GetNext(Pos);
		if (Pos == NULL) return; // the current page was the last page
		pPage = (CNewWizPage*)m_PageList.GetAt(Pos);
	}
	else
	{
		pPage = GetPageByResourceID(lResult);
		if (pPage == NULL) return;
	}

	if (!ActivatePage(pPage)) return;	

	// enable Back button; it will be enabled later on
	EnableBack(TRUE);

	// if we are on the last page, then disable the next button and enable the finish button
	if (pPage == GetLastPage())
	{
		// DISABLE EVERYTHING FOR INSTALL PAGE
		EnableBack(FALSE);
		EnableNext(FALSE);
		EnableCancel(FALSE);
		EnableFinish(FALSE);
	}

	//  if we are not on the last page disable finish button
	if (pPage != GetLastPage())
	{
		EnableFinish(FALSE);
	}
}
Esempio n. 3
0
void CNewWizDialog::OnWizardBack() 
{
	CNewWizPage* pPage = GetActivePage();
	ASSERT(pPage);

	LRESULT lResult = pPage->OnWizardBack();
	if (lResult == -1) return; // don't change pages

	if (lResult == 0)
	{
		POSITION Pos = m_PageList.Find(pPage);
		ASSERT(Pos);
		m_PageList.GetPrev(Pos);
		if (Pos == NULL) return; // the current page was the first page
		pPage = (CNewWizPage*)m_PageList.GetAt(Pos);
	}
	else
	{
		pPage = GetPageByResourceID(lResult);
		if (pPage == NULL) return;
	}

	if (!ActivatePage(pPage)) return;	

	// if we are on the first page, then disable the back button
	if (pPage == GetFirstPage())
	{
		EnableBack(FALSE);
	}
	//  if we are not on the last page disable finish button
	if (pPage != GetLastPage())
	{
		EnableFinish(FALSE);
	}

	// enable the next button
	EnableNext(TRUE);
}
Esempio n. 4
0
int CSheetExchMain::Select()
{
 	try
 	{
 		// 保存设置
 		Apply();
 
 		CWnd* pOKBut = this->GetDlgItem(ID_WIZFINISH);
 		if( pOKBut != NULL )
 		{
 			CString strText;
 			pOKBut->GetWindowText(strText);
 			if( strText.CompareNoCase(_T("停止")) == 0 )
 			{
 				if( Stop() != TCaclReturn_Succ )
 				{
 					if( CExchCalcMain::s_uTheradState != TCaclThread_State_Stoping )
 					{
 						MessageBox(_T("停止交易评测计算失败!"), FORMULAMAN_EXCH_PROMPT, MB_OK);
 						return TCaclReturn_Fail;
 					}
 				}
 			}		
 			else if(strText.CompareNoCase(_T("执行")) == 0)
 			{
 				if( Start() != TCaclReturn_Succ )
 				{
 					MessageBox(_T("开始交易评测计算失败!"), FORMULAMAN_EXCH_PROMPT, MB_OK);
 					return TCaclReturn_Fail;
 				}
 			}
 			else //if(strText.CompareNoCase("详情") == 0)
 			{
 				CWizPageUnionExchCaclResult* pActivePage = (CWizPageUnionExchCaclResult*)GetPageByResourceID(IDD_EXCHANGE_CACL_RESULT);
 				if( pActivePage != NULL )
 				{
 					pActivePage->OpenDetailed();
 				}
 			}
 			return TCaclReturn_Succ;
 		}
 	}
 #ifdef VC_7_0
 	// 异常处理
 	catch(CMemoryException e) // 内存异常
 	{
 		TCHAR   szCause[255];
 		e.GetErrorMessage(szCause, 255);
 		CString strError;
 		strError.Format("MemoryException: %s", szCause);
 		// 调试日志
 		//WRITE_LOG (__FILE__, __LINE__, _T(strError));
 	}
 #endif
 	catch(...) // 其它异常
 	{
 		// 调试日志
 		CString strError;
 		strError.Format("Other Exception: %s", ::strerror(::GetLastError()));
 		//WRITE_LOG (__FILE__, __LINE__, _T(strError));
 	}

	return TCaclReturn_Fail;
}
Esempio n. 5
0
LRESULT CSheetExchMain::OnExchangeData(WPARAM wp,LPARAM lp)
{
 	switch( wp )
 	{
 	case EXCH_MSG_WP_CACL_FAIL:// 计算失败
 		{
 			SetStartBom(FALSE);
 			GetData()->SetApplySeting(TRUE);
 			FailDispose(lp);
 			GetData()->ResetDefParam();
 		}
 		break;
 	case EXCH_MSG_WP_CACL_STOP:// 停止
 		{
 			SetStartBom(FALSE);
 			GetData()->SetApplySeting(TRUE);
 			GetData()->ResetDefParam();
 		}
 		break;
 	case EXCH_MSG_WP_CACL_TEMPO:// 进度通知
 		{
 			m_wndPress.SetPos(lp);
 		}
 		break;
 	case EXCH_MSG_WP_CACL_START:// 开始
 		{
 			SetStartBom(TRUE);
 			GetData()->SetApplySeting(FALSE);
 			GetData()->FromExpToDefParam();
 		}
 		break;
 
 	case EXCH_MSG_WP_CALC_SET_BUY : // 重新设置BUY方式
 		{
 			CExchCalcMain* pMain = GetData();
 			if( pMain != NULL )
 			{
 				CExpression* pExp = (CExpression*)lp;
 				if( pMain->GetExchExp()->m_pMainTech == pExp || pExp == NULL )
 				{
 					return 0;
 				}
 
 				pMain->GetBuy()->Default(pExp, CTreeCtrlFormula::g_strFirstTechLine);
 				CWizPageExchBuy* pPage = (CWizPageExchBuy*)GetPageByResourceID(IDD_EXCHANGE_BUY);
 				if( pPage != NULL )
 				{
 					pPage->InitialData(pMain->GetBuy());
 					if( ::IsWindow(pPage->GetSafeHwnd()) )
 					{
 						pPage->InitCondition();
 					}
 				}
 			}
 		}
 		break;
 
 	case EXCH_MSG_UP_CACL_SUCC:// 计算完成
 		{
 			GetData()->ResetDefParam();
 
 			if( GetData()->GetOptimize()->GetValidItemCount() > 0 )
 			{
 				// 打开隐含的第六页
 				CWizPageUnionExchCaclResult* pPage = (CWizPageUnionExchCaclResult*)GetPageByResourceID(IDD_EXCHANGE_CACL_RESULT);
 				if( pPage == NULL )
 				{
 					pPage = new CWizPageUnionExchCaclResult(this);
 					AddPage(pPage, IDD_EXCHANGE_CACL_RESULT);
 					SetActivePageByResource(IDD_EXCHANGE_CACL_RESULT);
 					if( !pPage->Initial() )
 					{
 						MessageBox(_T("显示计算结果失败!"), FORMULAMAN_EXCH_PROMPT, MB_OK);
 						return 0;
 					}
 				}
 				else
 				{
 					SetActivePageByResource(IDD_EXCHANGE_CACL_RESULT);
 				}
 				pPage->ClearCell();
 				pPage->PlayData();
 			}
 			else
 			{
 				OpenTableWnd();
 			}
 			SetStartBom(FALSE);
 			GetData()->SetApplySeting(TRUE);
 		}
 		break;
 	}
 
 	CHSNewWizPage* pActivePage = GetActivePage();
 	if( pActivePage != NULL )
 	{
 		pActivePage->SendMessage( HX_USER_COMPILEDATA,wp,lp );
 	}
	return 0;
}