Form_Popup_CutInfo.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Collections;
  9. namespace FPER
  10. {
  11. // cyim 2013.9.26 중계기차단 보완 : 화면에 정리된 리스트를 출력하기 위하여 전역으로 저장함
  12. // 차단의 경우 결국 속도가 오래걸린다. 또한 여기에서 정보가 다시 재저장되므로 이 정보를 이용하여 MDIParent.cs 에서 차단을 클릭하면 새로운 폼에서
  13. // 리스트의 정보를 출력하도록 유도한다
  14. // 표시될 정보는 예시는 아래와 같다
  15. // 날짜 - 통신보드[1] LOOP0 중계기[11] 회로[1] 타입[I] 차단
  16. // 날짜 - 통신보드[3] LOOP0 중계기[12] 차단
  17. public partial class Form_Popup_CutInfo : Form
  18. {
  19. // 크로스 스레드 처리
  20. public delegate void SetList_Callback(ArrayList Data);
  21. public delegate void SetForm_Callback(Form Data);
  22. // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  23. MDIParent mdi = null;
  24. // 생성자
  25. public Form_Popup_CutInfo(MDIParent mdiparent)
  26. {
  27. InitializeComponent();
  28. // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  29. mdi = mdiparent;
  30. // 폼로드 이벤트 핸들러 등록
  31. this.Load += new EventHandler(Form_Popup_OtherFireAlarm_Load);
  32. // 폼닫기 이벤트 핸들러 등록
  33. this.FormClosing += new FormClosingEventHandler(Form_Popup_OtherFireAlarm_FormClosing);
  34. // 팝업창 갱신 이벤트 핸들러
  35. mdi.Event.CutInfoPopup_Update_Inform_Event += new _Event.CutInfoPopup_Update_Handler(_Event_CutInfoPopup_Update_Inform_Event); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  36. }
  37. // 폼로드
  38. public void Form_Popup_OtherFireAlarm_Load(object sender, EventArgs e)
  39. {
  40. // 활성화
  41. mdi.Popup.Form_Popup_CutInfo_Enable = true; // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  42. // 갱신
  43. _Event_CutInfoPopup_Update_Inform_Event();
  44. }
  45. // 폼닫기
  46. public void Form_Popup_OtherFireAlarm_FormClosing(object sender, FormClosingEventArgs e)
  47. {
  48. // 숨김
  49. this.Hide();
  50. // 비활성화
  51. mdi.Popup.Form_Popup_CutInfo_Enable = false; // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  52. // 이벤트 핸들러 해제
  53. mdi.Event.CutInfoPopup_Update_Inform_Event -= new _Event.CutInfoPopup_Update_Handler(_Event_CutInfoPopup_Update_Inform_Event); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  54. }
  55. // 팝업창 갱신 이벤트 핸들러
  56. public void _Event_CutInfoPopup_Update_Inform_Event()
  57. {
  58. // 리스트 갱신
  59. Listview_Fire_Display(mdi.Popup.Form_Popup_CutInfo_List); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  60. // 화면 업데이트
  61. Form_Update(this);
  62. }
  63. // ListView : 차단 리스트
  64. public void Listview_Fire_Display(ArrayList Data)
  65. {
  66. if (this.listView_CutList.InvokeRequired)
  67. {
  68. SetList_Callback d = new SetList_Callback(Listview_Fire_Display);
  69. this.listView_CutList.Invoke(d, new object[] { Data });
  70. }
  71. else
  72. {
  73. this.listView_CutList.Items.Clear();
  74. if (Data != null)
  75. {
  76. // 인덱스가 작은것이 제일 오래된 데이타이므로 역순으로 출력시킨다
  77. for (int i = 1; i <= Data.Count; i++)
  78. {
  79. Listview_AddItem(i, (EventLogInfo)Data[i - 1]);
  80. }
  81. }
  82. }
  83. }
  84. // 화재리스트 항목 추가
  85. public void Listview_AddItem(int order, EventLogInfo Data)
  86. {
  87. // No, 항목 (Data.Message)
  88. string[] data = { " " + order.ToString(), /*Data.EventTime.ToString("yyyy-MM-dd HH:mm:ss"),*/ Data.Message };
  89. ListViewItem item = new ListViewItem(data);
  90. item.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold);
  91. listView_CutList.Items.Add(item);
  92. }
  93. // 폼업데이트
  94. public void Form_Update(Form Data)
  95. {
  96. if (this.InvokeRequired)
  97. {
  98. SetForm_Callback d = new SetForm_Callback(Form_Update);
  99. this.Invoke(d, new object[] { Data });
  100. }
  101. else
  102. {
  103. this.Update();
  104. }
  105. }
  106. }
  107. }