本文整理汇总了C++中AddonPtr::OnDisabled方法的典型用法代码示例。如果您正苦于以下问题:C++ AddonPtr::OnDisabled方法的具体用法?C++ AddonPtr::OnDisabled怎么用?C++ AddonPtr::OnDisabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AddonPtr
的用法示例。
在下文中一共展示了AddonPtr::OnDisabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDisabled
void OnDisabled(const std::string& id)
{
AddonPtr addon;
if (CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_PVRDLL, false) ||
CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_ADSPDLL, false))
return addon->OnDisabled();
if (CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_SERVICE, false))
std::static_pointer_cast<CService>(addon)->Stop();
if (CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_CONTEXT_ITEM, false))
CContextMenuManager::GetInstance().Unregister(std::static_pointer_cast<CContextMenuAddon>(addon));
}
示例2: DisableAddon
bool CAddonDatabase::DisableAddon(const std::string &addonID, bool disable /* = true */)
{
try
{
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
if (disable)
{
if (!IsAddonDisabled(addonID)) // Enabled
{
std::string sql = PrepareSQL("insert into disabled(id, addonID) values(NULL, '%s')", addonID.c_str());
m_pDS->exec(sql);
// If the addon is a special, call the disabled handler
AddonPtr addon;
if ((CAddonMgr::Get().GetAddon(addonID, addon, ADDON_SERVICE, false)
|| CAddonMgr::Get().GetAddon(addonID, addon, ADDON_PVRDLL, false)
|| CAddonMgr::Get().GetAddon(addonID, addon, ADDON_CONTEXT_ITEM, false)) && addon)
addon->OnDisabled();
return true;
}
return false; // already disabled or failed query
}
else
{
bool disabled = IsAddonDisabled(addonID); //we need to know if service addon is running
std::string sql = PrepareSQL("delete from disabled where addonID='%s'", addonID.c_str());
m_pDS->exec(sql);
if (disabled)
{
// If the addon is a special, call the enabled handler
AddonPtr addon;
if ((CAddonMgr::Get().GetAddon(addonID, addon, ADDON_SERVICE, false)
|| CAddonMgr::Get().GetAddon(addonID, addon, ADDON_PVRDLL, false)
|| CAddonMgr::Get().GetAddon(addonID, addon, ADDON_CONTEXT_ITEM, false)) && addon)
addon->OnEnabled();
}
}
return true;
}
catch (...)
{
CLog::Log(LOGERROR, "%s failed on addon '%s'", __FUNCTION__, addonID.c_str());
}
return false;
}