Exemplo n.º 1
0
void HotKeyManager::SaveSettings()
{
	TRACEST(_T("HotKeyManager::SaveSettings."));
	PrgAPI* pAPI = PRGAPI();
	AppSettings* appSettings = pAPI->GetAppSettings();
	appSettings->Write(HotKeyManagerSettingsCategory, cHotkeyPlay, (INT) m_HotKeys[HK_Play - HK_First - 1]);
	appSettings->Write(HotKeyManagerSettingsCategory, cHotkeyStop, (INT) m_HotKeys[HK_Stop - HK_First - 1]);
	appSettings->Write(HotKeyManagerSettingsCategory, cHotkeyPrev, (INT) m_HotKeys[HK_Prev - HK_First - 1]);
	appSettings->Write(HotKeyManagerSettingsCategory, cHotkeyNext, (INT) m_HotKeys[HK_Next - HK_First - 1]);
	appSettings->Write(HotKeyManagerSettingsCategory, cHotkeyMiniPlayer, (INT) m_HotKeys[HK_ToggleMiniPlayer - HK_First - 1]);
	appSettings->Write(HotKeyManagerSettingsCategory, cHotkeyTooltip, (INT) m_HotKeys[HK_Tooltip - HK_First - 1]);
	appSettings->Write(HotKeyManagerSettingsCategory, cHotkeyQuickSearch, (INT) m_HotKeys[HK_QuickSearch - HK_First - 1]);

}
Exemplo n.º 2
0
void CTeenSpiritDlg::SaveSettings()
{
	PrgAPI* pAPI = PRGAPI();
	AppSettings* params = pAPI->GetAppSettings();
	WINDOWPLACEMENT pl;
	GetWindowPlacement(&pl);
	params->Write(SettingsCategory, _T("CMDSHOW"), (int&) pl.showCmd);
	params->Write(SettingsCategory, _T("LEFT"), (int&) pl.rcNormalPosition.left);
	params->Write(SettingsCategory, _T("TOP"), (int&) pl.rcNormalPosition.top);
	params->Write(SettingsCategory, _T("RIGHT"), (int&) pl.rcNormalPosition.right);
	params->Write(SettingsCategory, _T("BOTTOM"), (int&) pl.rcNormalPosition.bottom);
	m_PaneController.SaveSettings();
	BOOL bIsPlayerVisible = FALSE;
	CMiniPlayerDlg* pMPDlg = pAPI->GetMiniPlayerDlg(FALSE);
	if (pMPDlg != NULL)
		bIsPlayerVisible = pMPDlg->IsWindowVisible();
	pAPI->SetOption(OPT_MINIPLR_ShowAtStartup, bIsPlayerVisible);

}
Exemplo n.º 3
0
void CQuizRunningDlg::SetState(FormStates st)
{
	m_curState = st;
	PrgAPI* pAPI = PRGAPI();
	DisplayRunningResult();
	switch (st)
	{
	case ST_Start:
		SetCurrentGame(m_curGameIdx);
		m_pPlayer->Stop();
		m_curTime = 0;
		m_correctAnswers = 0;
		m_totalAnswers = 0;
		m_lastResponseTime = 0;
		if (m_poolCount < 4)
		{	
			m_subTitle.SetWindowText(pAPI->GetString(IDS_NOTENOUGHTRACKSTOPLAYTHEQUIZ));
		}
		else
		{
			HideAll();
			m_pButtons[BT_Start]->ShowWindow(SW_SHOW);
			m_pButtons[BT_SelectNext]->ShowWindow(SW_SHOW);
			m_pButtons[BT_SelectPrev]->ShowWindow(SW_SHOW);
			m_pButtons[BT_Exit]->ShowWindow(SW_SHOW);

			m_subTitle.SetWindowText(pAPI->GetString(IDS_RECOGNISESONG));
			//m_subTitle.SetColor(CLabelEx::COL_Text, RGB(200,200,200));

		}
		break;
	case ST_DisplayingQuestionsAndWait:
		{
			KillTimer(TIMER_CONTINUOUS);
			if (m_pButtons[BT_Start] ->IsWindowVisible())
				HideAll();
			INT numTimes = 0;
			while (!DisplayNextQuestion() && numTimes<4)
				numTimes++;
			for (INT i = BT_Answer1; i <= BT_AnswerNo; i++)
			{
				m_pButtons[i]->SetState(CMillionaireButton::ST_Disabled);
				m_pButtons[i]->SetTextAlign(DT_LEFT);
				m_pButtons[i]->EnableWindow(FALSE);
				m_pButtons[i]->ShowWindow(SW_SHOW);
				m_pButtons[i]->Invalidate();
			}
			m_progress.ShowWindow(SW_SHOW);
			m_pButtons[BT_EndGame]->ShowWindow(SW_SHOW);
			if (numTimes == 4)
				SetState(ST_GameOver);
			SetTimer(TIMER_DISPLAYQUESTIONSTIMER, TIMER_DISPLAYQUESTIONSTIMER_DELAY, NULL);
		}
		break;
	case ST_RunningQuestions:
		SetFocus();
		for (int i = BT_Answer1; i <= BT_AnswerNo; i++)
		{
			m_pButtons[i]->SetState(CMillionaireButton::ST_Normal);
			m_pButtons[i]->EnableWindow(TRUE);
			m_pButtons[i]->Invalidate();
		}
		m_pPlayer->Start();
		m_progress.ShowWindow(SW_SHOW);
		m_LastTickCount = GetTickCount();
		SetTimer(TIMER_CONTINUOUS, 25, NULL);
		break;
	case ST_DisplayingResultsAndWait:
		KillTimer(TIMER_CONTINUOUS);
		for (int i = BT_Answer1; i <= BT_AnswerNo; i++)
		{
			//m_pButtons[i]->SetState(CMillionaireButton::ST_Normal);
			m_pButtons[i]->EnableWindow(FALSE);
			//m_pButtons[i]->Invalidate();
		}
		SetTimer(TIMER_DISPLAYRESULTSTIMER, TIMER_DISPLAYRESULTSTIMER_DELAY, NULL);
		break;
	case ST_GameOver:
		m_pPlayer->SetVolume(40);
		KillTimer(TIMER_CONTINUOUS);
		KillTimer(TIMER_DISPLAYRESULTSTIMER);
		KillTimer(TIMER_DISPLAYQUESTIONSTIMER);
		HideAll();
		m_pButtons[BT_Submit]->ShowWindow(SW_SHOW);
		m_pButtons[BT_NewGame]->ShowWindow(SW_SHOW);
		m_pButtons[BT_Exit]->ShowWindow(SW_SHOW);
		SYSTEMTIME st;
		GetSystemTime(&st);
		m_gameTimeStamp = SystemTime2UnixTimeStamp(st);

		if (m_curGameBestScore < m_correctAnswers)
		{
			m_curGameBestScore = m_correctAnswers;
			AppSettings* pSettings = pAPI->GetAppSettings();
			TCHAR bf[500];
			_sntprintf(bf, 500, _T("%s.best"), m_curGame.gameName);
			pSettings->Write(SettingsCategory, bf, m_curGameBestScore);
			_sntprintf(bf, 500, _T("%s.bestdate"), m_curGame.gameName);
			TCHAR dateBuffer[200];
			::GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, 0, 0, dateBuffer, 200);
			pSettings->Write(SettingsCategory, bf, dateBuffer);
			m_curGameBestScoreDate = dateBuffer;
		}

		m_subTitle.SetWindowText(pAPI->GetString(IDS_GAMEOVER));
		m_subTitle.SetColor(CLabelEx::COL_Text, RGB(200,200,200));
		break;
	default:
		ASSERT(0);
		break;
	}

}