コード例 #1
0
ファイル: CDKInfo.cpp プロジェクト: boskee/Desurium-1
void CDKInfo::onButtonClicked(wxCommandEvent& event)
{
	if (event.GetId() == m_butClose->GetId())
	{
		GetParent()->Close();
	}
	else if (event.GetId() == m_imgCopyAll->GetId() || (m_vSplitKey.size() == 0 && event.GetId() == m_imgCopyPart->GetId()))
	{
		if (wxTheClipboard->Open())
		{
			wxTheClipboard->SetData(new wxTextDataObject(m_tbCdKey->GetValue()));
			wxTheClipboard->Close();
		}	

		m_tbCdKey->SetSelection(-1,-1);
	}
	else if (event.GetId() == m_imgCopyPart->GetId())
	{
		SplitInfo *info = m_vSplitKey[m_uiCurIndex];

		m_uiCurIndex++;

		if (m_uiCurIndex >= m_vSplitKey.size())
			m_uiCurIndex = 0;
		
		if (wxTheClipboard->Open())
		{
			wxTheClipboard->SetData(new wxTextDataObject(info->text));
			wxTheClipboard->Close();
		}

		m_tbCdKey->SetSelection(info->start,info->end);

		gcString label(Managers::GetString("#CDK_COPYPART"));

		if (m_uiCurIndex != 0)
			label = gcString(Managers::GetString("#CDK_COPYPART_X"), m_uiCurIndex+1);

		m_imgCopyPart->SetToolTip(label);
	}
	else if (m_butLaunch && m_butLaunch->GetId() == event.GetId())
	{
		g_pMainApp->handleInternalLink(getItemId(), ACTION_LAUNCH, FormatArgs("cdkey", std::string("exe=") + m_szExe));
		GetParent()->Close();
	}
	else if (m_butActivate && m_butActivate->GetId() == event.GetId())
	{
		UserCore::Item::ItemInfoI* info = getItemInfo();

		if (info && info->isLaunchable())
			info->addSFlag(UserCore::Item::ItemInfoI::STATUS_LAUNCHED);

#ifdef WIN32
		UTIL::WIN::runAs("steam://open/activateproduct");
#endif
	}
}
コード例 #2
0
ファイル: InstallBranch.cpp プロジェクト: Alasaad/Desurium
void InstallBranch::onButtonClick(wxCommandEvent &event)
{
	if (event.GetId() == m_butInfo->GetId())
	{
		if ((m_bIsMod || m_bIsExpansion) && !m_bSelectBranch)
			g_pMainApp->handleInternalLink(m_Item, ACTION_PROFILE, FormatArgs("?help=needgame"));
		else
			g_pMainApp->handleInternalLink(m_Item, ACTION_PROFILE, FormatArgs("?help=branches"));

		EndModal(wxID_CANCEL);
	}
	else if (event.GetId() == m_butInstall->GetId())
	{
		MCFBranch b = getBranch();

		if (b == UINT_MAX)
		{
			UserCore::Item::ItemInfoI* pItemInfo = GetUserCore()->getItemManager()->findItemInfo(m_Item);

			if ((m_bIsMod || m_bIsExpansion) && !m_bSelectBranch)
				pItemInfo = GetUserCore()->getItemManager()->findItemInfo(pItemInfo->getParentId());

			pItemInfo->addSFlag(UserCore::Item::ItemInfoI::STATUS_LINK|UserCore::Item::ItemInfoI::STATUS_INSTALLED|UserCore::Item::ItemInfoI::STATUS_READY);
			EndModal(wxID_OK);
		}
		else if (b == (UINT_MAX - 1))
		{
			g_pMainApp->handleInternalLink(m_Item, ACTION_SHOWSETTINGS, FormatArgs("tab=cip"));
			EndModal(wxID_CANCEL);
		}
		else if (m_bBuy)
		{
			MCFBranch g = getGlobal();
			gcString args;

			if (g == 0 || !g.isGlobal())
				args = gcString("?help=buy&branch={0}", b);
			else
				args = gcString("?help=buy&branchglobal={0}", g);
			
			g_pMainApp->handleInternalLink(m_Item, ACTION_PROFILE, FormatArgs(args));
			EndModal(wxID_CANCEL);
		}
		else
		{
			EndModal(wxID_OK);
		}
	}
	else if (event.GetId() == m_butCancel->GetId())
	{
		EndModal(wxID_CANCEL);
	}
}