终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NoticeDemoViewModel.cs 2.9 KiB

преди 2 години
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Media;
  7. namespace BPASmartClient.CustomResource.UserControls.MessageShow
  8. {
  9. public class NoticeDemoViewModel
  10. {
  11. public static Notifiaction NotifiactionShow { get; set; }
  12. #region 右侧弹框
  13. /// <summary>
  14. /// 初始化
  15. /// </summary>
  16. public static void OnStartup()
  17. {
  18. //初始化通知弹框
  19. if (NotifiactionShow == null)
  20. {
  21. NotifiactionShow = new Notifiaction();
  22. }
  23. }
  24. /// <summary>
  25. /// 手动关闭
  26. /// </summary>
  27. public static void OnExit(string e)
  28. {
  29. switch (e)
  30. {
  31. case "Error":
  32. NotifiactionShow.Clear(EnumPromptType.Error);
  33. return;
  34. case "Success":
  35. NotifiactionShow.Clear(EnumPromptType.Success);
  36. return;
  37. case "Warm":
  38. NotifiactionShow.Clear(EnumPromptType.Warn);
  39. return;
  40. case "Info":
  41. NotifiactionShow.Clear(EnumPromptType.Info);
  42. return;
  43. default:
  44. break;
  45. }
  46. //NoticeManager.ExitNotifiaction();
  47. }
  48. /// <summary>
  49. /// 屏幕右下角信息提示弹窗
  50. /// </summary>
  51. /// <param name="e">弹窗类型:Error、Success、Warm、Info,分别对应不同颜色</param>
  52. /// <param name="title">弹窗消息类型:属性判证、XX告警...</param>
  53. /// <param name="content">弹窗消息内容</param>
  54. /// <param name="kcmbbh">一般为对应目标的目标编号</param>
  55. /// <param name="id">该条消息的ID</param>
  56. public static void OpenMsg(EnumPromptType type,System.Windows.Window window,string title,string content)
  57. {
  58. string text = string.Empty;
  59. if (content != null)
  60. {
  61. if (content.Length < 40)
  62. {
  63. int count = 40 - content.Length;
  64. for (int i = 0; i < count * 2; i++)
  65. {
  66. content += " ";
  67. }
  68. }
  69. text = content;
  70. }
  71. if (NotifiactionShow == null) NotifiactionShow = new Notifiaction();
  72. NotifiactionShow.AddNotifiaction(new NotifiactionModel()
  73. {
  74. Title = title,//"这是Error通知标题",
  75. Content = text,//"这条通知不会自动关闭,需要点击关闭按钮",
  76. ContentToolTip = content,
  77. NotifiactionType = type,
  78. window= window
  79. });
  80. }
  81. #endregion
  82. }
  83. }