|
- 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, Brush> Info { get; set; }
-
- /// <summary>
- /// 常规日志显示
- /// </summary>
- /// <param name="info">日志消息</param>
- /// <param name="brush">日志显示颜色</param>
- public void Show(string info, Brush brush = null)
- {
- Info?.Invoke($"消息:{info}", brush == null ? Brushes.Green : brush);
- }
-
- /// <summary>
- /// 应用程序异常日志显示
- /// </summary>
- /// <param name="info">日志信息</param>
- /// <param name="brush">日志显示颜色</param>
- public void ShowEx(string info, Brush brush = null)
- {
- Info?.Invoke($"异常:{info}", brush == null ? Brushes.Red : brush);
- }
-
- /// <summary>
- /// 错误日志显示
- /// </summary>
- /// <param name="info">日志信息</param>
- /// <param name="brush">日志显示颜色</param>
- public void ShowError(string info, Brush brush = null)
- {
- Info?.Invoke($"错误:{info}", brush == null ? Brushes.Red : brush);
- }
-
- /// <summary>
- /// 警告日志显示
- /// </summary>
- /// <param name="info">日志信息</param>
- /// <param name="brush">日志显示颜色</param>
- public void ShowWarning(string info, Brush brush = null)
- {
- Info?.Invoke($"警告:{info}", brush == null ? Brushes.Olive : brush);
- }
-
- }
- }
|