/* * ThreadPilot - Advanced Windows Process and Power Plan Manager * Copyright (C) 2025 Prime Build * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, version 3 only. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ namespace ThreadPilot.Services { using System; using System.Collections.Generic; using System.Threading.Tasks; using ThreadPilot.Models; /// /// Main orchestration service for process monitoring and power plan management. /// public interface IProcessMonitorManagerService : IDisposable { /// /// Event fired when a process-triggered power plan change occurs /// event EventHandler? ProcessPowerPlanChanged; /// /// Event fired when the service status changes /// event EventHandler? ServiceStatusChanged; /// /// Gets a value indicating whether gets whether the service is currently running. /// bool IsRunning { get; } /// /// Gets the current service status. /// string Status { get; } /// /// Gets currently running associated processes. /// IEnumerable RunningAssociatedProcesses { get; } /// /// Starts the process monitoring and power plan management service. /// Task StartAsync(); /// /// Stops the service. /// Task StopAsync(); /// /// Manually triggers a power plan evaluation for all running processes. /// Task EvaluateCurrentProcessesAsync(); /// /// Forces a return to the default power plan. /// Task ForceDefaultPowerPlanAsync(); /// /// Gets the current active power plan information. /// Task GetCurrentActivePowerPlanAsync(); /// /// Refreshes the configuration from the association service. /// Task RefreshConfigurationAsync(); /// /// Updates the service settings (polling intervals, etc.) /// void UpdateSettings(); } /// /// Event arguments for process-triggered power plan changes. /// public class ProcessPowerPlanChangeEventArgs : EventArgs { public ProcessModel Process { get; } public ProcessPowerPlanAssociation Association { get; } public PowerPlanModel? PreviousPowerPlan { get; } public PowerPlanModel? NewPowerPlan { get; } public string Action { get; } // "ProcessStarted", "ProcessStopped", "DefaultRestored" public DateTime Timestamp { get; } public ProcessPowerPlanChangeEventArgs( ProcessModel process, ProcessPowerPlanAssociation association, PowerPlanModel? previousPowerPlan, PowerPlanModel? newPowerPlan, string action) { this.Process = process; this.Association = association; this.PreviousPowerPlan = previousPowerPlan; this.NewPowerPlan = newPowerPlan; this.Action = action; this.Timestamp = DateTime.Now; } } /// /// Event arguments for service status changes. /// public class ServiceStatusEventArgs : EventArgs { public bool IsRunning { get; } public string Status { get; } public string? Details { get; } public Exception? Error { get; } public DateTime Timestamp { get; } public ServiceStatusEventArgs(bool isRunning, string status, string? details = null, Exception? error = null) { this.IsRunning = isRunning; this.Status = status; this.Details = details; this.Error = error; this.Timestamp = DateTime.Now; } } }