using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Yw.WinFrmUI
{
///
///
///
public static class VmoExceptionAlertHelper
{
private static AlertControl Alert
{
get
{
if (_alert == null)
{
lock (_locker)
{
if (_alert == null)
{
_alert = new AlertControl();
_alert.AutoFormDelay = 3000;
_alert.AutoHeight = false;
_alert.FormMaxCount = 1;
}
}
}
return _alert;
}
}
private static AlertControl _alert = null;
private static object _locker = new();
///
/// 显示右下角弹窗
///
public static void ShowAlertInfo(this Form owner, Yw.Vmo.VException ex)
{
var info = new AlertInfo(ex.ErrorCode, ex.ErrorMsg, HttpStatusImageHelper.ImgC.Images[ex.ErrorStatus]);
Alert.Show(owner, info);
}
///
/// 显示右下角弹窗
///
public static void ShowAlertInfo(this Control owner, Yw.Vmo.VException ex)
{
var form = owner.FindForm();
form.ShowAlertInfo(ex);
}
}
}