[]
Occurs when an error occurs within the viewer. This event provides detailed information about the error, allowing for custom error handling or logging.
public event EventHandler<ErrorInfo> ErrorOccured
Type | Description |
---|---|
EventHandler<ErrorInfo> | Occurs when an error occurs within the viewer. This event provides detailed information about the error, allowing for custom error handling or logging. |
The ErrorInfo object passed as a parameter to the event handler contains details about the error, including the exception object, a user-friendly message, and potentially other metadata related to the error condition. Subscribing to this event allows applications to gracefully handle errors, such as displaying custom error messages to the user, logging errors for diagnostics, or implementing specific recovery actions based on the type or severity of the error.
viewer.ErrorOccured += (sender, e) =>
{
// Log error details
Console.WriteLine($"Error: {e.Exception.Message}");
// Show a user-friendly message
MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
};