/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.Monitoring.Contracts.Applications.Events;
using SafeExamBrowser.Settings.Applications;
namespace SafeExamBrowser.Monitoring.Contracts.Applications
{
///
/// Monitors applications running on the computer.
///
public interface IApplicationMonitor
{
///
/// Event fired when a new instance of the Windows Explorer has been started.
///
event ExplorerStartedEventHandler ExplorerStarted;
///
/// Event fired when a new instance of a whitelisted application has been started.
///
event InstanceStartedEventHandler InstanceStarted;
///
/// Event fired when the automatic termination of a blacklisted application failed.
///
event TerminationFailedEventHandler TerminationFailed;
///
/// Initializes the application monitor.
///
InitializationResult Initialize(ApplicationSettings settings);
///
/// Starts monitoring all initialized applications. Windows Explorer will always be monitored.
///
void Start();
///
/// Stops the application monitoring.
///
void Stop();
///
/// Attempts to retrieve the currently active application (i.e. the application which currently has input focus). Returns true if
/// successful, otherwise false.
///
bool TryGetActiveApplication(out ActiveApplication application);
///
/// Attempts to terminate all processes of the specified application. Returns true if successful, otherwise false.
///
bool TryTerminate(RunningApplication application);
}
}