|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace HKCardManager
- {
- public class MessageLogNotify
- {
-
- private volatile static MessageLogNotify _Instance;
- public static MessageLogNotify GetInstance => _Instance ?? (_Instance = new MessageLogNotify());
- private MessageLogNotify() { }
-
- public Action<string, Color> Info { get; set; }
-
- /// <summary>
- /// 常规日志显示
- /// </summary>
- /// <param name="info">日志消息</param>
- /// <param name="brush">日志显示颜色</param>
- public void Show(string info, Color brush = default)
- {
- Info?.Invoke($"消息:{info}", brush == default ? Color.Green : brush);
- }
-
- /// <summary>
- /// 应用程序异常日志显示
- /// </summary>
- /// <param name="info">日志信息</param>
- /// <param name="brush">日志显示颜色</param>
- public void ShowEx(string info, Color brush = default)
- {
- Info?.Invoke($"异常:{info}", brush == default ? Color.Red : brush);
- }
-
- /// <summary>
- /// 错误日志显示
- /// </summary>
- /// <param name="info">日志信息</param>
- /// <param name="brush">日志显示颜色</param>
- public void ShowError(string info, Color brush = default)
- {
- Info?.Invoke($"错误:{info}", brush == default ? Color.Red : brush);
- }
-
- /// <summary>
- /// 警告日志显示
- /// </summary>
- /// <param name="info">日志信息</param>
- /// <param name="brush">日志显示颜色</param>
- public void ShowWarning(string info, Color brush = default)
- {
- Info?.Invoke($"警告:{info}", brush == default ? Color.Olive : brush);
- }
-
- }
- }
|