终端一体化运控平台
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

91 rinda
2.9 KiB

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