using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; namespace BPASmartClient.CustomResource.UserControls.MessageShow { public class NoticeDemoViewModel { public static Notifiaction NotifiactionShow { get; set; } #region 右侧弹框 /// /// 初始化 /// public static void OnStartup() { //初始化通知弹框 if (NotifiactionShow == null) { NotifiactionShow = new Notifiaction(); } } /// /// 手动关闭 /// public static void OnExit(string e) { switch (e) { case "Error": NotifiactionShow.Clear(EnumPromptType.Error); return; case "Success": NotifiactionShow.Clear(EnumPromptType.Success); return; case "Warm": NotifiactionShow.Clear(EnumPromptType.Warn); return; case "Info": NotifiactionShow.Clear(EnumPromptType.Info); return; default: break; } //NoticeManager.ExitNotifiaction(); } /// /// 屏幕右下角信息提示弹窗 /// /// 弹窗类型:Error、Success、Warm、Info,分别对应不同颜色 /// 弹窗消息类型:属性判证、XX告警... /// 弹窗消息内容 /// 一般为对应目标的目标编号 /// 该条消息的ID public static void OpenMsg(EnumPromptType type,System.Windows.Window window,string title,string content) { string text = string.Empty; if (content != null) { if (content.Length < 40) { int count = 40 - content.Length; for (int i = 0; i < count * 2; i++) { content += " "; } } text = content; } if (NotifiactionShow == null) NotifiactionShow = new Notifiaction(); NotifiactionShow.AddNotifiaction(new NotifiactionModel() { Title = title,//"这是Error通知标题", Content = text,//"这条通知不会自动关闭,需要点击关闭按钮", ContentToolTip = content, NotifiactionType = type, window= window }); } #endregion } }