Skip to content

Instantly share code, notes, and snippets.

@tslazarov
Created January 3, 2022 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tslazarov/08a0cbeb90a02a23b231672b56136205 to your computer and use it in GitHub Desktop.
Save tslazarov/08a0cbeb90a02a23b231672b56136205 to your computer and use it in GitHub Desktop.
Sitefinity Image Optimization
using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using Progress.Sitefinity.ImageOptimization.Scheduling;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Services;
namespace Progress.Sitefinity.ImageOptimization
{
/// <summary>
/// Contains the application startup event handlers registering the required components for the packaging module of Sitefinity.
/// </summary>
[ExcludeFromCodeCoverage]
public static class Startup
{
/// <summary>
/// Called before the Asp.Net application is started. Subscribes for the logging and exception handling configuration related events.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static void OnPreApplicationStart()
{
Bootstrapper.Bootstrapped -= Bootstrapper_Bootstrapped;
Bootstrapper.Bootstrapped += Bootstrapper_Bootstrapped;
}
private static void Bootstrapper_Bootstrapped(object sender, EventArgs e)
{
// ...
Startup.RegisterCrontabTasks();
}
private static void RegisterCrontabTasks()
{
ImageOptimizationTask.RemoveScheduledTasks();
SystemManager.CrontabTasksToRun.Add(ImageOptimizationTask.GetTaskName(), ImageOptimizationTask.NewInstance);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment