using System;
using System.Threading.Tasks;
namespace ThreadPilot.Services
{
///
/// Interface for managing Windows autostart functionality
///
public interface IAutostartService
{
///
/// Event fired when autostart status changes
///
event EventHandler? AutostartStatusChanged;
///
/// Gets whether the application is currently set to autostart with Windows
///
bool IsAutostartEnabled { get; }
///
/// Gets the current autostart registry entry path
///
string? AutostartPath { get; }
///
/// Enables autostart with Windows
///
/// Whether to start the application minimized
/// True if successful, false otherwise
Task EnableAutostartAsync(bool startMinimized = true);
///
/// Disables autostart with Windows
///
/// True if successful, false otherwise
Task DisableAutostartAsync();
///
/// Checks if autostart is currently enabled
///
/// True if autostart is enabled, false otherwise
Task CheckAutostartStatusAsync();
///
/// Updates the autostart entry with new parameters
///
/// Whether to start minimized
/// True if successful, false otherwise
Task UpdateAutostartAsync(bool startMinimized = true);
///
/// Gets the command line arguments for autostart
///
/// Whether to include start minimized flag
/// Command line arguments string
string GetAutostartArguments(bool startMinimized = true);
}
///
/// Event arguments for autostart status changes
///
public class AutostartStatusChangedEventArgs : EventArgs
{
public bool IsEnabled { get; }
public bool StartMinimized { get; }
public string? RegistryPath { get; }
public Exception? Error { get; }
public AutostartStatusChangedEventArgs(bool isEnabled, bool startMinimized = false, string? registryPath = null, Exception? error = null)
{
IsEnabled = isEnabled;
StartMinimized = startMinimized;
RegistryPath = registryPath;
Error = error;
}
}
}