|
- 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 右侧弹框
- /// <summary>
- /// 初始化
- /// </summary>
- public static void OnStartup()
- {
- //初始化通知弹框
- if (NotifiactionShow == null)
- {
- NotifiactionShow = new Notifiaction();
- }
- }
- /// <summary>
- /// 手动关闭
- /// </summary>
- 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();
-
- }
-
- /// <summary>
- /// 屏幕右下角信息提示弹窗
- /// </summary>
- /// <param name="e">弹窗类型:Error、Success、Warm、Info,分别对应不同颜色</param>
- /// <param name="title">弹窗消息类型:属性判证、XX告警...</param>
- /// <param name="content">弹窗消息内容</param>
- /// <param name="kcmbbh">一般为对应目标的目标编号</param>
- /// <param name="id">该条消息的ID</param>
- 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
- }
- }
|