当前位置: 首页>>代码示例>>C++>>正文


C++ AddonPtr::OnEnabled方法代码示例

本文整理汇总了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));
}
开发者ID:nihalsunthankar,项目名称:xbmc,代码行数:14,代码来源:Addon.cpp

示例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;
}
开发者ID:mkortstiege,项目名称:xbmc,代码行数:49,代码来源:AddonDatabase.cpp

示例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
}
开发者ID:,项目名称:,代码行数:18,代码来源:


注:本文中的AddonPtr::OnEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。