本文整理汇总了C++中AddonPtr::OnEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ AddonPtr::OnEnabled方法的具体用法?C++ AddonPtr::OnEnabled怎么用?C++ AddonPtr::OnEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AddonPtr
的用法示例。
在下文中一共展示了AddonPtr::OnEnabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnEnabled
void OnEnabled(const std::string& id)
{
// If the addon is a special, call enabled handler
AddonPtr addon;
if (CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_PVRDLL) ||
CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_ADSPDLL))
return addon->OnEnabled();
if (CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_SERVICE))
std::static_pointer_cast<CService>(addon)->Start();
if (CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_CONTEXT_ITEM))
CContextMenuManager::GetInstance().Register(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;
}
示例3: OnEnabled
void OnEnabled(const std::string& id)
{
// If the addon is a special, call enabled handler
AddonPtr addon;
if (CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_PVRDLL) ||
CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_ADSPDLL) ||
CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_PERIPHERALDLL))
return addon->OnEnabled();
if (CAddonMgr::GetInstance().ServicesHasStarted())
{
if (CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_SERVICE))
std::static_pointer_cast<CService>(addon)->Start();
}
if (CAddonMgr::GetInstance().GetAddon(id, addon, ADDON_REPOSITORY))
CRepositoryUpdater::GetInstance().ScheduleUpdate(); //notify updater there is a new addon
}