8f50ec259fdd04eacbf75732170cc899a1e755b6.svn-base 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Windows.Forms;
  5. using System.Collections;
  6. namespace FPER
  7. {
  8. // 타수신기 화재 팝업창 전용 클래스
  9. public class _FIRE_LIST
  10. {
  11. public string FIRE_TIME; // 시간
  12. public bool FIRE_TYPE; // 화재 or 복구
  13. public string FIRE_TEXT; // 디바이스 정보
  14. }
  15. public class _Popup // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  16. {
  17. // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  18. MDIParent mdi = null;
  19. //
  20. // 팝업창을 관리하는 전용 팝업 클래스
  21. //
  22. // 공통 팝업창 (1개로 관리함 - 잠시기다려주세요)
  23. private Form_Popup CommonPopup = new Form_Popup();
  24. // 팝업 전용 위임자
  25. public delegate void CreateFormCallback(Form Target);
  26. public delegate void CreateEtcFirePopupCallback(string MyReceiver_ID, string FireReceiver_ID, MDIParent Target);
  27. // 수신기별로 관리되는 팝업창 (모두 Form_Popup_OtherFireAlarm 폼클래스 타입의 데이타가 저장된다)
  28. public Hashtable HASH_EtcReceiverFireAlarmPopup = new Hashtable();
  29. //
  30. // 차단 정보 팝업창
  31. //
  32. // cyim 2013.9.26 중계기차단 보완
  33. public Form_Popup_CutInfo Form_Popup_CutInfo_Main = null;
  34. // 차단정보를 새로운 폼에 출력하기 위한 전역 리스트 (차단시에 반드시 호출되는 함수에서 재설정되도록 함)
  35. public ArrayList Form_Popup_CutInfo_List = new ArrayList();
  36. // 차단 정보 팝업창 활성화 여부
  37. public bool Form_Popup_CutInfo_Enable = false;
  38. // 생성자
  39. public _Popup(MDIParent mdiparent)
  40. {
  41. mdi = mdiparent;
  42. }
  43. // 소멸자
  44. ~_Popup()
  45. {
  46. }
  47. //
  48. // 공통 팝업창 처리
  49. //
  50. // 출력
  51. public void CommonPopupShow(Form Target)
  52. {
  53. if (Target.InvokeRequired)
  54. {
  55. CreateFormCallback d = new CreateFormCallback(CommonPopupShow);
  56. Target.Invoke(d, new object[] { });
  57. }
  58. else
  59. {
  60. // 사전검사
  61. if (CommonPopup != null) CommonPopup.Close();
  62. // 메모리 할당
  63. CommonPopup = new Form_Popup();
  64. // 이벤트 등록
  65. Target.FormClosing += new FormClosingEventHandler(Target_FormClosing);
  66. Target.VisibleChanged += new EventHandler(Target_VisibleChanged);
  67. // 표시
  68. CommonPopup.Show(Target);
  69. // 위치
  70. CommonPopup.StartPosition = FormStartPosition.CenterParent;
  71. // 화면 갱신
  72. CommonPopup.Update();
  73. }
  74. }
  75. public void Target_VisibleChanged(object sender, EventArgs e)
  76. {
  77. Form frm = (Form)sender;
  78. if (frm.Visible == false)
  79. CommonPopupClose(frm);
  80. }
  81. // 닫힘
  82. public void CommonPopupClose(Form Target)
  83. {
  84. if (Target.InvokeRequired)
  85. {
  86. CreateFormCallback d = new CreateFormCallback(CommonPopupClose);
  87. Target.Invoke(d, new object[] { });
  88. }
  89. else
  90. {
  91. // 폼닫기
  92. if (CommonPopup != null)
  93. {
  94. CommonPopup.Hide(); // cyim 2013.9.23 대기팝업창 보완
  95. CommonPopup.Close();
  96. }
  97. // 이벤트 해제
  98. Target.VisibleChanged -= new EventHandler(Target_VisibleChanged);
  99. Target.FormClosing -= new FormClosingEventHandler(Target_FormClosing);
  100. }
  101. }
  102. // 부모 윈도우 닫힘 이벤트 핸들러
  103. public void Target_FormClosing(object sender, FormClosingEventArgs e)
  104. {
  105. // 부모가 종료되면 무조건 폼닫기 실행
  106. if (CommonPopup != null)
  107. {
  108. CommonPopup.Hide(); // cyim 2013.9.23 대기팝업창 보완
  109. CommonPopup.Close();
  110. }
  111. }
  112. //
  113. // 타수신기 화재 팝업창
  114. //
  115. // 출력
  116. public void EtcReceiverFirePopupShow(string MyReceiver_ID, string FireReceiver_ID, MDIParent Target)
  117. {
  118. // cyim 2013.8.9 타수신기 화재 정보 팝업창 출력 기능 추가
  119. // 제일먼저 타수신기 화재인지 알아내는것이 좋습니다. Contains 함수도 남용하면 속도에 악영향을 줍니다
  120. if (MyReceiver_ID != FireReceiver_ID && HASH_EtcReceiverFireAlarmPopup.Count != 0)
  121. {
  122. if (HASH_EtcReceiverFireAlarmPopup.Contains(FireReceiver_ID) == true)
  123. {
  124. if (((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).Visible == false)
  125. {
  126. if (Target.InvokeRequired)
  127. {
  128. CreateEtcFirePopupCallback d = new CreateEtcFirePopupCallback(EtcReceiverFirePopupShow);
  129. Target.Invoke(d, new object[] { MyReceiver_ID, FireReceiver_ID, Target });
  130. }
  131. else
  132. {
  133. // 표시
  134. ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).Show();
  135. // 위치
  136. ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).StartPosition = FormStartPosition.CenterParent;
  137. // 화면 갱신
  138. ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).Update();
  139. }
  140. }
  141. }
  142. }
  143. }
  144. // 데이타만 처리
  145. public void EtcReceiverFirePopupProcess(string MyReceiver_ID, string FireReceiver_ID, bool FireType, string FireDisplayText, string FireTime)
  146. {
  147. // cyim 2013.8.9 타수신기 화재 정보 팝업창 출력 기능 추가
  148. // 제일먼저 타수신기 화재인지 알아내는것이 좋습니다. Contains 함수도 남용하면 속도에 악영향을 줍니다
  149. if (MyReceiver_ID != FireReceiver_ID && HASH_EtcReceiverFireAlarmPopup.Count != 0)
  150. {
  151. if (HASH_EtcReceiverFireAlarmPopup.Contains(FireReceiver_ID) == true)
  152. {
  153. // 제일먼저 해당 수신기의 팝업창에 리스트의 개수를 파악한다. 만약 최대값에 도달했다면 제일 마지막에 저장된 데이타를 삭제한다
  154. if (((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.Count > 14) // cyim 2015.10.23 타수신기 화재 리스트에서 항목은 최대 15개로 표시
  155. {
  156. ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.RemoveAt(0);
  157. }
  158. // 데이타 생성
  159. _FIRE_LIST FIRE_LIST = new _FIRE_LIST();
  160. FIRE_LIST.FIRE_TEXT = FireDisplayText;
  161. FIRE_LIST.FIRE_TYPE = FireType;
  162. FIRE_LIST.FIRE_TIME = FireTime;//mdi.MyTime;//DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // cyim 2015.9.23 시간정보 표시 오류 (갱신을 안함) // cyim 2015.10.1 통보받은 화재 발생 시간을 기준으로 표시
  163. // 데이타 추가
  164. ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.Add(FIRE_LIST);
  165. //// 화재
  166. //if (FireType == true)
  167. //{
  168. // if (((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.Contains(DisplayText) == false)
  169. // {
  170. // ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.Add(DisplayText);
  171. // _Event.EtcFirePopup_Update_Inform_Write(FireReceiver_ID);
  172. // }
  173. //}
  174. //// 복구
  175. //else
  176. //{
  177. // if (((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.Contains(DisplayText) == true)
  178. // {
  179. // ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.Remove(DisplayText);
  180. // _Event.EtcFirePopup_Update_Inform_Write(FireReceiver_ID);
  181. // }
  182. //}
  183. }
  184. }
  185. }
  186. }
  187. }