123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Windows.Forms;
- using System.Collections;
- namespace FPER
- {
- // 타수신기 화재 팝업창 전용 클래스
- public class _FIRE_LIST
- {
- public string FIRE_TIME; // 시간
- public bool FIRE_TYPE; // 화재 or 복구
- public string FIRE_TEXT; // 디바이스 정보
- }
- public class _Popup // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- {
- // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- MDIParent mdi = null;
- //
- // 팝업창을 관리하는 전용 팝업 클래스
- //
- // 공통 팝업창 (1개로 관리함 - 잠시기다려주세요)
- private Form_Popup CommonPopup = new Form_Popup();
- // 팝업 전용 위임자
- public delegate void CreateFormCallback(Form Target);
- public delegate void CreateEtcFirePopupCallback(string MyReceiver_ID, string FireReceiver_ID, MDIParent Target);
- // 수신기별로 관리되는 팝업창 (모두 Form_Popup_OtherFireAlarm 폼클래스 타입의 데이타가 저장된다)
- public Hashtable HASH_EtcReceiverFireAlarmPopup = new Hashtable();
-
- //
- // 차단 정보 팝업창
- //
- // cyim 2013.9.26 중계기차단 보완
- public Form_Popup_CutInfo Form_Popup_CutInfo_Main = null;
-
- // 차단정보를 새로운 폼에 출력하기 위한 전역 리스트 (차단시에 반드시 호출되는 함수에서 재설정되도록 함)
- public ArrayList Form_Popup_CutInfo_List = new ArrayList();
- // 차단 정보 팝업창 활성화 여부
- public bool Form_Popup_CutInfo_Enable = false;
-
- // 생성자
- public _Popup(MDIParent mdiparent)
- {
- mdi = mdiparent;
- }
- // 소멸자
- ~_Popup()
- {
- }
- //
- // 공통 팝업창 처리
- //
-
- // 출력
- public void CommonPopupShow(Form Target)
- {
- if (Target.InvokeRequired)
- {
- CreateFormCallback d = new CreateFormCallback(CommonPopupShow);
- Target.Invoke(d, new object[] { });
- }
- else
- {
- // 사전검사
- if (CommonPopup != null) CommonPopup.Close();
- // 메모리 할당
- CommonPopup = new Form_Popup();
- // 이벤트 등록
- Target.FormClosing += new FormClosingEventHandler(Target_FormClosing);
- Target.VisibleChanged += new EventHandler(Target_VisibleChanged);
- // 표시
- CommonPopup.Show(Target);
- // 위치
- CommonPopup.StartPosition = FormStartPosition.CenterParent;
- // 화면 갱신
- CommonPopup.Update();
- }
- }
-
- public void Target_VisibleChanged(object sender, EventArgs e)
- {
- Form frm = (Form)sender;
- if (frm.Visible == false)
- CommonPopupClose(frm);
- }
- // 닫힘
- public void CommonPopupClose(Form Target)
- {
- if (Target.InvokeRequired)
- {
- CreateFormCallback d = new CreateFormCallback(CommonPopupClose);
- Target.Invoke(d, new object[] { });
- }
- else
- {
-
- // 폼닫기
- if (CommonPopup != null)
- {
- CommonPopup.Hide(); // cyim 2013.9.23 대기팝업창 보완
- CommonPopup.Close();
- }
- // 이벤트 해제
- Target.VisibleChanged -= new EventHandler(Target_VisibleChanged);
- Target.FormClosing -= new FormClosingEventHandler(Target_FormClosing);
- }
- }
- // 부모 윈도우 닫힘 이벤트 핸들러
- public void Target_FormClosing(object sender, FormClosingEventArgs e)
- {
- // 부모가 종료되면 무조건 폼닫기 실행
- if (CommonPopup != null)
- {
- CommonPopup.Hide(); // cyim 2013.9.23 대기팝업창 보완
- CommonPopup.Close();
- }
- }
- //
- // 타수신기 화재 팝업창
- //
- // 출력
- public void EtcReceiverFirePopupShow(string MyReceiver_ID, string FireReceiver_ID, MDIParent Target)
- {
- // cyim 2013.8.9 타수신기 화재 정보 팝업창 출력 기능 추가
- // 제일먼저 타수신기 화재인지 알아내는것이 좋습니다. Contains 함수도 남용하면 속도에 악영향을 줍니다
- if (MyReceiver_ID != FireReceiver_ID && HASH_EtcReceiverFireAlarmPopup.Count != 0)
- {
- if (HASH_EtcReceiverFireAlarmPopup.Contains(FireReceiver_ID) == true)
- {
- if (((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).Visible == false)
- {
- if (Target.InvokeRequired)
- {
- CreateEtcFirePopupCallback d = new CreateEtcFirePopupCallback(EtcReceiverFirePopupShow);
- Target.Invoke(d, new object[] { MyReceiver_ID, FireReceiver_ID, Target });
- }
- else
- {
- // 표시
- ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).Show();
- // 위치
- ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).StartPosition = FormStartPosition.CenterParent;
- // 화면 갱신
- ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).Update();
- }
- }
- }
- }
- }
- // 데이타만 처리
- public void EtcReceiverFirePopupProcess(string MyReceiver_ID, string FireReceiver_ID, bool FireType, string FireDisplayText, string FireTime)
- {
- // cyim 2013.8.9 타수신기 화재 정보 팝업창 출력 기능 추가
- // 제일먼저 타수신기 화재인지 알아내는것이 좋습니다. Contains 함수도 남용하면 속도에 악영향을 줍니다
- if (MyReceiver_ID != FireReceiver_ID && HASH_EtcReceiverFireAlarmPopup.Count != 0)
- {
- if (HASH_EtcReceiverFireAlarmPopup.Contains(FireReceiver_ID) == true)
- {
- // 제일먼저 해당 수신기의 팝업창에 리스트의 개수를 파악한다. 만약 최대값에 도달했다면 제일 마지막에 저장된 데이타를 삭제한다
- if (((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.Count > 14) // cyim 2015.10.23 타수신기 화재 리스트에서 항목은 최대 15개로 표시
- {
- ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.RemoveAt(0);
- }
- // 데이타 생성
- _FIRE_LIST FIRE_LIST = new _FIRE_LIST();
- FIRE_LIST.FIRE_TEXT = FireDisplayText;
- FIRE_LIST.FIRE_TYPE = FireType;
- FIRE_LIST.FIRE_TIME = FireTime;//mdi.MyTime;//DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); // cyim 2015.9.23 시간정보 표시 오류 (갱신을 안함) // cyim 2015.10.1 통보받은 화재 발생 시간을 기준으로 표시
- // 데이타 추가
- ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.Add(FIRE_LIST);
- //// 화재
- //if (FireType == true)
- //{
-
- // if (((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.Contains(DisplayText) == false)
- // {
- // ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.Add(DisplayText);
- // _Event.EtcFirePopup_Update_Inform_Write(FireReceiver_ID);
- // }
- //}
- //// 복구
- //else
- //{
- // if (((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.Contains(DisplayText) == true)
- // {
- // ((Form_Popup_OtherFireAlarm)HASH_EtcReceiverFireAlarmPopup[FireReceiver_ID]).LIST_FIRE_INFO.Remove(DisplayText);
- // _Event.EtcFirePopup_Update_Inform_Write(FireReceiver_ID);
- // }
- //}
- }
- }
- }
- }
- }
|