示例#1
0
//
// Enables and disables the connection rate edit box depending on the check box state.
void CPageDisk::OnCConnectionRate() 
{
	Manager *manager;
	Worker	*worker;
	// change the check box to true/false only (having clicked, cannot 
	// return to intermediate state)
	m_CConnectionRate.SetButtonStyle( BS_AUTOCHECKBOX );
	if ( IsDlgButtonChecked( CConnectionRate ) == 1 && 
		GetDlgItemInt( EConnectionRate ) != AMBIGUOUS_VALUE )
	{
		// Connection rate testing is enabled.  Update the edit box.
		m_EConnectionRate.SetPasswordChar( 0 );
	}
	else
	{
		m_EConnectionRate.SetPasswordChar( 32 );
	}
	// Seeing what kind of item is selected.
	switch ( theApp.pView->m_pWorkerView->GetSelectedType() )
	{
	case WORKER:
		worker = theApp.pView->m_pWorkerView->GetSelectedWorker();
		worker->SetConnectionRate( m_CConnectionRate.GetCheck() );
		break;
	case MANAGER:
		manager = theApp.pView->m_pWorkerView->GetSelectedManager();
		manager->SetConnectionRate( m_CConnectionRate.GetCheck(), GenericDiskType );
		break;
	case ALL_MANAGERS:
		theApp.manager_list.SetConnectionRate( m_CConnectionRate.GetCheck(),
			GenericDiskType );
		break;
	}
	EnableWindow();
}
void CPageNetwork::OnCConnectionRate()
{
	Manager *manager;
	Worker *worker;

	// change the check box to true/false only (having clicked, cannot 
	// return to intermediate state)
	m_CConnectionRate.SetButtonStyle(BS_AUTOCHECKBOX);
	if (IsDlgButtonChecked(CConnectionRate) == 1) {
		m_EConnectionRate.SetPasswordChar(0);
		if (GetDlgItemInt(EConnectionRate) == AMBIGUOUS_VALUE)
			SetDlgItemInt(EConnectionRate, 0);
	} else {
		m_EConnectionRate.SetPasswordChar(32);
	}
	switch (theApp.pView->m_pWorkerView->GetSelectedType()) {
	case WORKER:
		worker = theApp.pView->m_pWorkerView->GetSelectedWorker();
		worker->SetConnectionRate(m_CConnectionRate.GetCheck());
		break;
	case MANAGER:
		manager = theApp.pView->m_pWorkerView->GetSelectedManager();
		manager->SetConnectionRate(m_CConnectionRate.GetCheck(), GenericServerType);
		break;
	case ALL_MANAGERS:
		theApp.manager_list.SetConnectionRate(m_CConnectionRate.GetCheck(), GenericServerType);
		break;
	}
	EnableWindow();
}