mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-11-25 15:20:10 +00:00
50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using System;
|
|
|
|
namespace MSFSPopoutPanelManager.Shared
|
|
{
|
|
public class Logger
|
|
{
|
|
public static event EventHandler<EventArgs<StatusMessage>> OnStatusLogged;
|
|
public static event EventHandler<EventArgs<StatusMessage>> OnBackgroundStatusLogged;
|
|
|
|
public static void Status(string message, StatusMessageType MessageType)
|
|
{
|
|
var statusMessage = new StatusMessage() { Message = message, MessageType = MessageType };
|
|
OnStatusLogged?.Invoke(null, new EventArgs<StatusMessage>(statusMessage));
|
|
}
|
|
|
|
public static void ClearStatus()
|
|
{
|
|
Status(String.Empty, StatusMessageType.Info);
|
|
}
|
|
|
|
public static void BackgroundStatus(string message, StatusMessageType MessageType)
|
|
{
|
|
var statusMessage = new StatusMessage() { Message = message, MessageType = MessageType };
|
|
OnBackgroundStatusLogged?.Invoke(null, new EventArgs<StatusMessage>(statusMessage));
|
|
}
|
|
|
|
public static void ClearBackgroundStatus()
|
|
{
|
|
BackgroundStatus(String.Empty, StatusMessageType.Info);
|
|
}
|
|
}
|
|
|
|
public class StatusMessage
|
|
{
|
|
public string Message { get; set; }
|
|
|
|
public StatusMessageType MessageType { get; set; }
|
|
}
|
|
|
|
public enum StatusMessageType
|
|
{
|
|
Info,
|
|
Error
|
|
}
|
|
|
|
public class PopoutManagerException : Exception
|
|
{
|
|
public PopoutManagerException(string message) : base(message) { }
|
|
}
|
|
}
|