0

我基本上遵循本指南,除了我正在为对象而不是文档编写代码。这是我的代码:

using CMS.TreeEngine;
using CMS.SettingsProvider;

[CustomObjectEvents]
public partial class CMSModuleLoader
{
    /// <summary>
    /// Attribute class that ensures the loading of custom handlers
    /// </summary>
    private class CustomObjectEventsAttribute : CMSLoaderAttribute
    {
        /// <summary>
        /// Called automatically when the application starts
        /// </summary>
        public override void Init()
        {
            // Assigns custom handlers to the appropriate events
            ObjectEvents.GetContent.Execute += Category_Get_Content; //error is here

        }

        private void Category_Get_Content(object sender, DocumentEventArgs e)
        {
            // Add custom actions here
        }

    }
}

上面的行抛出编译时错误:

错误 1 ​​无法将方法组“Category_Get_Content”转换为非委托类型“CMS.SettingsProvider.SimpleObjectHandler”。您是否打算调用该方法?C:\APPLICATIONS\DEVELOPMENT\KENTICO6\WebPartDev\wwwroot\App_Code\Blank Site\SearchByCategory.cs 22 40 C:...\wwwroot\

有任何想法吗?

4

1 回答 1

1

我不得不更改DocumentEventArgsObjectEventArgsCategory_Get_Content 方法。

于 2012-06-04T16:15:24.207 回答