Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example of how to register event handlers for the Fotoware events in an InitializationModule

Code Block
languagec#
[ModuleDependency(typeof(InitializationModule))]
public class FotowareContentEventsInitializationModule : IInitializableModule
{
    public void Initialize(InitializationEngine context)
    {
        var events = context.Locate.Advanced.GetRequiredService<FotowareEvents>();
        events.OnContentDownloading += OnContentDownloading;
        events.OnContentDownloaded += OnContentDownloaded;
    }

    public void Uninitialize(InitializationEngine context)
    {
        var events = context.Locate.Advanced.GetRequiredService<FotowareEvents>();
        events.OnContentDownloading -= OnContentDownloading;
        events.OnContentDownloaded -= OnContentDownloaded;
    }

    private void OnContentDownloading(object sender, FotowareContentEventArgs e)
    {
        // Handle content downloaded event here
    }

    private void OnContentDownloaded(object sender, FotowareContentEventArgs e)
    {
        // Handle content downloaded event here
    }
}

...