83 lines
2.8 KiB
C#
83 lines
2.8 KiB
C#
namespace LiveWall.Sdk;
|
|
|
|
// ---------------------------------------------------------------------------------------------
|
|
// Events published on IPluginEvents. Subscribe from ILiveWallPlugin.Initialize:
|
|
//
|
|
// context.Events.Subscribe<WallpaperChangedEvent>(e => context.Log.Info($"now: {e.Source}"));
|
|
//
|
|
// Handlers always run on the WPF UI thread.
|
|
// ---------------------------------------------------------------------------------------------
|
|
|
|
/// <summary>The host finished starting: settings are loaded and the wallpaper is attached.</summary>
|
|
public sealed class AppStartedEvent
|
|
{
|
|
public string HostVersion { get; init; } = "";
|
|
public string PluginApiVersion { get; init; } = "";
|
|
}
|
|
|
|
/// <summary>LiveWall is shutting down. Unsubscribe and release resources now.</summary>
|
|
public sealed class AppStoppingEvent
|
|
{
|
|
public string Reason { get; init; } = "exit";
|
|
}
|
|
|
|
/// <summary>A new wallpaper was applied (kind/source/renderer as they are now).</summary>
|
|
public sealed class WallpaperChangedEvent
|
|
{
|
|
public string Kind { get; init; } = "";
|
|
public string Source { get; init; } = "";
|
|
public string RendererName { get; init; } = "";
|
|
public bool FromPlugin { get; init; }
|
|
}
|
|
|
|
/// <summary>Playback started, stopped or was suspended (lock screen, battery, fullscreen…).</summary>
|
|
public sealed class PlaybackChangedEvent
|
|
{
|
|
public bool IsPlaying { get; init; }
|
|
public bool IsPaused { get; init; }
|
|
public string Reason { get; init; } = "";
|
|
}
|
|
|
|
/// <summary>Interactive mode was toggled.</summary>
|
|
public sealed class InteractionChangedEvent
|
|
{
|
|
public bool Interactive { get; init; }
|
|
}
|
|
|
|
/// <summary>Any settings change. <see cref="Property"/> is the property name that changed.</summary>
|
|
public sealed class SettingsChangedEvent
|
|
{
|
|
public string Property { get; init; } = "";
|
|
public ISettingsSnapshot Snapshot { get; init; } = null!;
|
|
}
|
|
|
|
/// <summary>Display topology changed or the wallpaper was re-attached.</summary>
|
|
public sealed class DisplayChangedEvent
|
|
{
|
|
public IReadOnlyList<string> Devices { get; init; } = Array.Empty<string>();
|
|
public bool Reattached { get; init; }
|
|
}
|
|
|
|
/// <summary>Session state (lock screen, battery, remote desktop) changed.</summary>
|
|
public sealed class SessionChangedEvent
|
|
{
|
|
public bool Locked { get; init; }
|
|
public bool OnBattery { get; init; }
|
|
public bool RemoteSession { get; init; }
|
|
}
|
|
|
|
/// <summary>Something failed inside the host; useful for plugins that surface errors.</summary>
|
|
public sealed class HostErrorEvent
|
|
{
|
|
public string Message { get; init; } = "";
|
|
public string Source { get; init; } = "";
|
|
}
|
|
|
|
/// <summary>Plugin-to-plugin messaging: publish any class you like.</summary>
|
|
public sealed class PluginMessageEvent
|
|
{
|
|
public string FromPluginId { get; init; } = "";
|
|
public string Topic { get; init; } = "";
|
|
public string? Payload { get; init; }
|
|
}
|