示例#1
0
    /// <summary>
    /// Adds header actions to page.
    /// </summary>
    private void InitHeaderActions()
    {
        // Tasks on azure are processed by special worker role  or by scheduler
        // Scheduler may be set to run the task only on one CMS server at the time (shared index files)
        // In this cases we cant allow user to start task processing on the current server.
        if (!SystemContext.IsRunningOnAzure && !SearchTaskInfoProvider.ProcessSearchTasksByScheduler)
        {
            // Add process tasks action
            mProcessTasksAction = new HeaderAction
            {
                Text        = Control.GetString("smartsearch.task.processtasks"),
                CommandName = PROCESS
            };
            Control.AddHeaderAction(mProcessTasksAction);
            ComponentEvents.RequestEvents.RegisterForEvent(PROCESS, (sender, args) => SearchTaskInfoProvider.ProcessTasks());
        }

        // Add refresh action
        mRefreshAction = new HeaderAction
        {
            Text        = Control.GetString("general.refresh"),
            CommandName = REFRESH
        };
        Control.AddHeaderAction(mRefreshAction);
    }