123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Collections;
- namespace FPER
- {
- // cyim 2013.8.9 타수신기 화재 정보 팝업창 출력 기능 추가
- // 지금 이 폼의 경우 프로그램이 실행되면서 여러개가 생성되므로 해당 수신기 아이디는 프로그램 종료직전까지 알고 있어야 한다.
- // 이는 _Popup.EtcReceiverFireAlarmPopup 해쉬테이블에서 관리된다
- // 키값은 수신기 아이디이다. 데이타는 이 클래스 자체로 관리되며 데이타중 회로번호를 키로 가지는 해쉬테이블에서 화재정보표시문구를 저장해둔다
- public partial class Form_Popup_OtherFireAlarm : Form
- {
- // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- MDIParent mdi = null;
- // 크로스 스레드 처리
- public delegate void SetText_Callback(string Data);
- public delegate void SetHash_Callback(Hashtable Data);
- public delegate void SetList_Callback(ArrayList Data);
- public delegate void SetForm_Callback(Form Data);
- // 수신기정보
- // 맨처음 프로그램 기동시에 데이타베이스에서 읽어 들어온다
- public string POPUP_RECEIVER_ID = null;
- public string POPUP_RECEIVER_IP = null;
- public string POPUP_RECEIVER_NAME = null;
- // 화재정보표시되는 문구
- public ArrayList LIST_FIRE_INFO = new ArrayList();
- // 생성자
- public Form_Popup_OtherFireAlarm(string RECEIVER_ID, MDIParent mdiparent) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- {
- InitializeComponent();
- mdi = mdiparent; // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- //public _Popup = new _Popup(mdi);
- // 폼로드 이벤트 핸들러 등록
- this.Load += new EventHandler(Form_Popup_OtherFireAlarm_Load);
- // 폼닫기 이벤트 핸들러 등록
- this.FormClosing += new FormClosingEventHandler(Form_Popup_OtherFireAlarm_FormClosing);
- // 팝업창 갱신 이벤트 핸들러
- mdi.Event.EtcFirePopup_Update_Inform_Event += new _Event.EtcFirePopup_Update_Handler(_Event_EtcFirePopup_Update_Inform_Event); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // 수신기 아이디
- POPUP_RECEIVER_ID = RECEIVER_ID;
- }
- // 폼로드
- public void Form_Popup_OtherFireAlarm_Load(object sender, EventArgs e)
- {
- _Event_EtcFirePopup_Update_Inform_Event(POPUP_RECEIVER_ID);
- }
- // 폼닫기
- public void Form_Popup_OtherFireAlarm_FormClosing(object sender, FormClosingEventArgs e)
- {
- // 이벤트 핸들러 해제
- mdi.Event.EtcFirePopup_Update_Inform_Event -= new _Event.EtcFirePopup_Update_Handler(_Event_EtcFirePopup_Update_Inform_Event); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- }
- // 팝업창 갱신 이벤트 핸들러
- public void _Event_EtcFirePopup_Update_Inform_Event(string RECEIVER_ID)
- {
- try // cyim 2015.10.23 보완 코드 추가
- {
- // 수신기 아이디에 의하여 이벤트를 거절할 수 있다
- //if (POPUP_RECEIVER_ID == RECEIVER_ID) // ID 제한 제거 - 타수신기 팝업 통일화
- //{
- // 수신기 정보
- Label_Receiver_Display(string.Format("ID [{0}] - [{1} , {2}]", POPUP_RECEIVER_ID, POPUP_RECEIVER_NAME, POPUP_RECEIVER_IP));
- //this.Text = "[" + POPUP_RECEIVER_NAME + ", " + POPUP_RECEIVER_IP + "]";
- // 화재 정보
- if (LIST_FIRE_INFO.Count == 0)
- {
- // 화재 상태
- Label_Fire_Status_1th_Display("");
- // 화재 상태 세부
- Label_Fire_Status_2st_Display("");
- // 화재 리스트
- Listview_Fire_Display(null);
- }
- else
- {
- // 최신 정보
- string Recently_FireText = ((_FIRE_LIST)LIST_FIRE_INFO[LIST_FIRE_INFO.Count - 1]).FIRE_TEXT;
- string Recently_FireTime = ((_FIRE_LIST)LIST_FIRE_INFO[LIST_FIRE_INFO.Count - 1]).FIRE_TIME;
- string Recently_FireType = ((_FIRE_LIST)LIST_FIRE_INFO[LIST_FIRE_INFO.Count - 1]).FIRE_TYPE == true ? "화재" : "복구"; ;
- // 화재 상태
- Label_Fire_Status_1th_Display(string.Format("{0} 에 {1} 정보 수신되었습니다", Recently_FireTime, Recently_FireType)); // cyim 2014.8.6 문구 수정 및 화면폼 크게 변경
- // 화재 상태 세부
- Label_Fire_Status_2st_Display(Recently_FireText);
- // 모든 정보를 표시하자
- Listview_Fire_Display(LIST_FIRE_INFO);
- }
- // 화면 업데이트
- Form_Update(this);
- //}
- }
- catch
- { }
- }
- // Label : 수신기 정보
- public void Label_Receiver_Display(string Data)
- {
- if (this.label_Receiver.InvokeRequired)
- {
- SetText_Callback d = new SetText_Callback(Label_Receiver_Display);
- this.label_Receiver.Invoke(d, new object[] { Data });
- }
- else
- {
- this.label_Receiver.Text = "수신기 : " + Data;
- }
- }
- // Label : 상태 정보
- public void Label_Fire_Status_1th_Display(string Data)
- {
- if (this.label_Fire_Status_1th.InvokeRequired)
- {
- SetText_Callback d = new SetText_Callback(Label_Fire_Status_1th_Display);
- this.label_Fire_Status_1th.Invoke(d, new object[] { Data });
- }
- else
- {
- this.label_Fire_Status_1th.Text = "상 태 : " + Data;
- }
- }
- // Textbox : 화재 정보
- public void Label_Fire_Status_2st_Display(string Data)
- {
- if (this.label_Fire_Status_2st.InvokeRequired)
- {
- SetText_Callback d = new SetText_Callback(Label_Fire_Status_2st_Display);
- this.label_Fire_Status_2st.Invoke(d, new object[] { Data });
- }
- else
- {
- this.label_Fire_Status_2st.Text = Data;
- }
- }
- // ListView : 화재 리스트
- public void Listview_Fire_Display(ArrayList pData)
- {
- if (this.listView_FireList.InvokeRequired)
- {
- SetList_Callback d = new SetList_Callback(Listview_Fire_Display);
- this.listView_FireList.Invoke(d, new object[] { pData });
- }
- else
- {
- this.listView_FireList.Items.Clear();
- // cyim 2016.12.06 : 이벤트 로그 해쉬테이블을 복사본으로 현재내역 조회하도록 함
- ArrayList Data = (ArrayList)pData.Clone();
- // cyim 2015.10.23 1개 및 역순출력 오류 수정
- if (Data != null && Data.Count != 0)
- {
- if (Data.Count == 1)
- {
- Listview_AddItem((_FIRE_LIST)Data[0]);
- }
- else
- {
- // 인덱스가 작은것이 제일 오래된 데이타이므로 역순으로 출력시킨다
- for (int i = Data.Count - 1; i > -1; i--)
- {
- Listview_AddItem((_FIRE_LIST)Data[i]);
- }
- }
- }
- }
- }
- // 화재리스트 항목 추가
- public void Listview_AddItem(_FIRE_LIST Data)
- {
- // 시간, 타입, 항목
- string temp_type = Data.FIRE_TYPE == true ? "화재" : "복구";
- string[] data = { Data.FIRE_TIME, Data.FIRE_RECEIVERNAME, Data.FIRE_RECEIVERIP, temp_type, Data.FIRE_TEXT };
- ListViewItem item = new ListViewItem(data);
- item.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold);
- listView_FireList.Items.Add(item);
- }
- // 폼업데이트
- public void Form_Update(Form Data)
- {
- if (this.InvokeRequired)
- {
- SetForm_Callback d = new SetForm_Callback(Form_Update);
- this.Invoke(d, new object[] { Data });
- }
- else
- {
- this.Update();
- }
- }
- // 창닫기 버튼
- public void button_FirePopupClose_Click(object sender, EventArgs e)
- {
- // 리소스 해제 금지 : 차후에 다시 알람이 발생한 경우 메모리 할당 루틴은 없다
- this.Hide();
- }
- internal void Form_Popup_OtherFireAlarm_FormClosing()
- {
- throw new NotImplementedException();
- }
- }
- }
|