12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using Microsoft.Win32;
- using System.Net;
- using System.Diagnostics;
- using System.IO;
- using System.Collections;
- using System.Threading;
- using System.Media;
- namespace FPER
- {
- public partial class FireDesk : Form
- {
-
- public ArrayList LoadMdiparentFormList = new ArrayList();
-
- public bool FormLoadComplete = false;
-
- public frmWaitingMsg waitingForm_FireDesk = null;
-
- public _Timer_WindowBase Timer_WindowBase_FireDesk = new _Timer_WindowBase();
-
- public _Event Event = new _Event();
-
- public ArrayList CommErrorReceiver = new ArrayList();
-
-
-
-
- public int fireCount = 0, facilityCount = 0, errorCount = 0, blockingCount = 0, cutCnt = 0;
- public int fireCount_Accumulation = 0;
-
- public ArrayList PreFireList = new ArrayList();
- public ArrayList FireList = new ArrayList();
- public ArrayList FireList_Accumulation = new ArrayList();
- public ArrayList EquipList = new ArrayList();
-
- public int LEDCount = 0;
- public ArrayList LEDList = new ArrayList();
-
- public string MyTime = null;
-
-
- public SoundPlayer SoundPlayer_AlarmPopupSound = null;
- public int SoundPlayer_AlarmPopupSound_Count = 0;
-
- public FireDesk()
- {
- InitializeComponent();
-
- if (File.Exists(Environment.CurrentDirectory + "\\emergency.wav") == true)
- SoundPlayer_AlarmPopupSound = new SoundPlayer(Environment.CurrentDirectory + "\\emergency.wav");
-
- this.FormClosing += new FormClosingEventHandler(FireDesk_FormClosing);
- this.Load += new EventHandler(FireDesk_Load);
- Event.FireDesk_Update_SendMessage_Event += new _Event.FireDesk_Update_SendMessage_Handler(_Event_FireDesk_Update_SendMessage_Event);
-
- for (int id = 1; id <= 16; id++)
- {
-
- Button button_Receiver = (Button)Util.FineControl(panel_Middle, "button_Receiver" + id.ToString());
- button_Receiver.Tag = id.ToString();
- button_Receiver.Click += new EventHandler(button_Receiver_Click);
-
- Button button_Recover = (Button)Util.FineControl(panel_Middle, "button_Recover" + id.ToString());
- button_Recover.Tag = id.ToString();
- button_Recover.Click += new EventHandler(button_Recover_Click);
- }
-
- Timer_WindowBase_FireDesk.Create("timer_1000", 1000, timer_1000_Tick, true);
- Timer_WindowBase_FireDesk.Create("timer_500", 500, timer_500_Tick, true);
- }
-
- private void FireDesk_FormClosing(object sender, FormClosingEventArgs e)
- {
-
- Timer_WindowBase_FireDesk.Delete("timerDateTime");
-
-
-
-
- Application.ExitThread();
- for (int i = 0; i < 1000000; i++) { ;}
-
- Application.Exit();
-
- System.Diagnostics.Process[] mProcess = System.Diagnostics.Process.GetProcessesByName(Application.ProductName);
- foreach (System.Diagnostics.Process p in mProcess)
- p.Kill();
-
- Environment.Exit(0);
- }
-
-
-
-
- private void FireDesk_Load(object sender, EventArgs e)
- {
-
- ShowWaitingMsgForm("수신반을 시작합니다", 10);
-
-
-
-
-
-
-
-
-
- Initialize_Hash_Receiver(_Data.Hash_Receiver);
-
- _Data.Hash_Receiver_keys = new string[_Data.Hash_Receiver.Keys.Count];
- _Data.Hash_Receiver.Keys.CopyTo(_Data.Hash_Receiver_keys, 0);
-
- foreach (string id in _Data.Hash_Receiver_keys)
- {
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[id];
-
-
-
-
- DacReceiverConfig dacReceiverConfig = new DacReceiverConfig(0);
- DataTable dt = dacReceiverConfig.Config_Select(0);
-
- foreach (DataRow dr in dt.Rows)
- {
- if (id == dr["RECEIVER_ID"].ToString())
- {
- FireDesk_Receiver.MASTER_FLAG = dr["MASTER_FLAG"].ToString();
- break;
- }
- }
- }
-
-
-
- ShowWaitingMsgForm("수신기 디바이스 DB를 읽고 있습니다..", 20);
- this.GetDeviceDB();
- ShowWaitingMsgForm("수신기 중계기 DB를 읽고 있습니다..", 30);
- this.GetRepeaterDB();
-
- this.GetAnalogDetecterLevelDB();
- ShowWaitingMsgForm("수신기 통신 보드 설정을 읽고 있습니다..", 40);
- this.GetBoardDB();
- ShowWaitingMsgForm("수신기 기본 설정값을 읽고 있습니다..", 50);
-
-
-
-
- for (int id = 1; id <= 16; id++)
- {
-
- if (_Data.Hash_Receiver.ContainsKey(id.ToString()) == false)
- {
- Panel p = (Panel)Util.FineControl(panel_Middle, "panel_Receiver" + id.ToString());
- p.Enabled = false;
- p.ForeColor = Color.Gray;
- }
- else
- {
-
-
-
-
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[id.ToString()];
-
-
- if (_Ethernet.Ping_SyncCheck(FireDesk_Receiver.DATABASE_NAME_IP) == true)
- {
-
- FireDesk_Receiver.mdi = new MDIParent(id, Event);
-
- LoadMdiparentFormList.Add(id.ToString());
- }
- else
- {
- Panel p = (Panel)Util.FineControl(panel_Middle, "panel_Receiver" + id.ToString());
- p.Enabled = false;
- p.BackColor = Color.Red;
- CommErrorReceiver.Add(id.ToString());
- }
- }
- }
-
- if(CommErrorReceiver.Count != 0)
- label_ReceiverCount.Text = string.Format("전체 수신기 대수 : {0} 개 , 통신 불량 수신기 아이디 : {1}", _Data.Hash_Receiver.Keys.Count, _Convert.ArrayList_to_String(CommErrorReceiver,","));
- else
- label_ReceiverCount.Text = string.Format("전체 수신기 대수 : {0} 개", _Data.Hash_Receiver.Keys.Count);
-
-
- while (true)
- {
- foreach (string id in _Data.Hash_Receiver_keys)
- {
-
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[id];
-
- if (_Ethernet.Ping_SyncCheck(FireDesk_Receiver.DATABASE_NAME_IP) == true)
- {
- if (FireDesk_Receiver.LoadStart == false && FormLoadComplete == false)
- {
- FormLoadComplete = true;
- FireDesk_Receiver.LoadStart = true;
- FireDesk_Receiver.mdi.Show();
- }
- }
- }
- if (LoadMdiparentFormList.Count == 0)
- break;
- }
-
- ShowWaitingMsgForm("수신반을 시작합니다", 100);
- Thread.Sleep(2000);
- waitingForm_FireDesk.Close();
- waitingForm_FireDesk = null;
- }
-
-
-
-
- private void Initialize_Hash_Receiver(Hashtable hashtable)
- {
- hashtable.Clear();
- for (int i = 1; i <= 16; i++)
- {
-
- string use = _Ini.Read_Ini("RECEIVER"+i.ToString(), "USE", 1024, Environment.CurrentDirectory + "\\Config.ini");
- if (use == "1")
- {
-
- _FireDesk_Receiver firedesk_receiver = new _FireDesk_Receiver();
-
- firedesk_receiver.RECEIVER_ID = i.ToString();
-
- string Temp_DATABASE_NAME = _Ini.Read_Ini("RECEIVER" + i.ToString(), "DATABASE_NAME", 1024, Environment.CurrentDirectory + "\\Config.ini");
-
-
- firedesk_receiver.DATABASE_NAME = Temp_DATABASE_NAME;
-
-
- firedesk_receiver.DATABASE_NAME_IP = Temp_DATABASE_NAME.Substring(0, Temp_DATABASE_NAME.IndexOf(":"));
-
- firedesk_receiver.DATABASE_NAME_PATH = Temp_DATABASE_NAME.Substring(Temp_DATABASE_NAME.IndexOf(":") + 1);
-
- string Temp_PROJECT_DIR = _Ini.Read_Ini("RECEIVER" + i.ToString(), "PROJECT_DIR", 1024, Environment.CurrentDirectory + "\\Config.ini");
-
-
- firedesk_receiver.PROJECT_DIRECTORY = Temp_PROJECT_DIR;
-
- if (hashtable.ContainsKey(firedesk_receiver.RECEIVER_ID) == false)
- hashtable.Add(firedesk_receiver.RECEIVER_ID, firedesk_receiver);
- }
- }
-
- }
-
-
-
-
-
-
- delegate void WaitingMsg_Callback(string msg, int processValue);
- public void ShowWaitingMsgForm(string msg, int processValue)
- {
- if (this.InvokeRequired)
- {
- WaitingMsg_Callback d = new WaitingMsg_Callback(ShowWaitingMsgForm);
- this.Invoke(d, new object[] { msg, processValue });
- }
- else
- {
- if (this.waitingForm_FireDesk == null)
- {
-
-
- this.waitingForm_FireDesk = new frmWaitingMsg();
- this.waitingForm_FireDesk.Text = Application.ProductName;
- this.waitingForm_FireDesk.TopMost = true;
- Point loc = new Point(
- (1280 - this.waitingForm_FireDesk.Size.Width) / 2 + this.Location.X,
- (1024 - this.waitingForm_FireDesk.Size.Height) / 2 + this.Location.Y
- );
- this.waitingForm_FireDesk.Location = loc;
- this.waitingForm_FireDesk.Show();
- }
- this.waitingForm_FireDesk.setMessage(msg, processValue);
- this.Update();
- }
- }
-
-
-
-
- int timer_1000_Tick_Cnt = 0;
- private void timer_1000_Tick(object sende, EventArgs e)
- {
-
- MyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
-
- if (waitingForm_FireDesk != null && waitingForm_FireDesk.Visible == true) return;
-
- this.label_Time.Text = string.Format("{0:yyyy}년 {0:MM}월 {0:dd}일 {0:HH}:{0:mm}:{0:ss}", DateTime.Now);
-
- if (timer_1000_Tick_Cnt > 10)
- timer_1000_Tick_Cnt = 0;
- else
- timer_1000_Tick_Cnt++;
- if (timer_1000_Tick_Cnt == 0)
- {
- foreach (string id in _Data.Hash_Receiver_keys)
- {
-
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[id];
- if (_Ethernet.Ping_SyncCheck(FireDesk_Receiver.DATABASE_NAME_IP) == false)
- {
- FireDesk_Receiver.LoadStart = false;
- FireDesk_Receiver.mdi.Close();
- }
- else
- {
- if (FireDesk_Receiver.LoadStart == false && FormLoadComplete == false)
- {
- FormLoadComplete = true;
- FireDesk_Receiver.LoadStart = true;
- FireDesk_Receiver.mdi.Show();
- }
- }
- }
- }
- }
-
- bool timer_500_toggle = false;
-
- private void timer_500_Tick(object sende, EventArgs e)
- {
-
- if (waitingForm_FireDesk != null && waitingForm_FireDesk.Visible == true) return;
-
- timer_500_toggle = !timer_500_toggle;
-
-
-
- fireCount = 0;
- facilityCount = 0;
- errorCount = 0;
- blockingCount = 0;
- cutCnt = 0;
- fireCount_Accumulation = 0;
- PreFireList = new ArrayList();
- foreach (string id in _Data.Hash_Receiver_keys)
- {
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[id];
-
- if (FireDesk_Receiver.mdi != null)
- {
-
- fireCount = fireCount + FireDesk_Receiver.mdi.fireCount;
-
- facilityCount = facilityCount + FireDesk_Receiver.mdi.facilityCount;
-
- errorCount = errorCount + FireDesk_Receiver.mdi.errorCount;
-
- blockingCount = blockingCount + FireDesk_Receiver.mdi.blockingCount;
-
- cutCnt = cutCnt + FireDesk_Receiver.mdi.CutCnt;
-
- fireCount_Accumulation = fireCount_Accumulation + FireDesk_Receiver.mdi.fireCount_Accumulation;
-
- foreach (string data in FireDesk_Receiver.mdi.PreFireList)
- PreFireList.Add(data);
- }
- }
-
- Toggle_ControlForeColor(this.label_CurrentStatus_Fire, fireCount, string.Format("화재({0})", fireCount));
- Toggle_ControlForeColor(this.label_CurrentStatus_Facility, facilityCount, string.Format("설비({0})", facilityCount));
- Toggle_ControlForeColor(this.label_CurrentStatus_Error, errorCount, string.Format("통신({0})", errorCount));
- Toggle_ControlForeColor(this.label_CurrentStatus_Blocking, blockingCount, string.Format("단선({0})", blockingCount));
- Toggle_ControlForeColor(this.label_CurrentStatus_Cut, cutCnt, string.Format("차단({0})", cutCnt));
-
-
-
- foreach (string id in _Data.Hash_Receiver_keys)
- {
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[id];
- Button btn = (Button)Util.FineControl(panel_Middle, "button_Check" + id.ToString());
-
-
- if (FireDesk_Receiver.mdi != null)
- {
-
- if (FireDesk_Receiver.mdi.CheckBtn_Current_Status == true
- || FireDesk_Receiver.mdi.lblEmergencyBoardStatus_Visible == true
- || FireDesk_Receiver.mdi.socketUI.myCntLabel.Visible == true)
- {
- Toggle_ControlBackColor(btn, 1, null);
- }
- else
- Toggle_ControlBackColor(btn, 0, null);
- }
- }
-
- FireFacilityEventCheck();
-
- if (SoundPlayer_AlarmPopupSound_Count > 6)
- {
- SoundPlayer_AlarmPopupSound_Count = 0;
- AlarmPopup_PlaySound_Check();
- }
- else
- {
- SoundPlayer_AlarmPopupSound_Count++;
- }
- }
-
- public void AlarmPopup_PlaySound_Check()
- {
- if (SoundPlayer_AlarmPopupSound != null)
- {
- if (this.label_FireAlert.Visible == true || this.label_FacilityAlert.Visible == true)
- SoundPlayer_AlarmPopupSound.Play();
- else
- SoundPlayer_AlarmPopupSound.Stop();
- }
- }
-
- private void Toggle_ControlForeColor(Label label, int count, string text)
- {
- if (count > 0)
- {
- if (timer_500_toggle == true) label.ForeColor = Color.White;
- else label.ForeColor = Color.Red;
- }
- else
- {
- if (label.ForeColor != Color.White)
- label.ForeColor = Color.White;
- }
- if (text != null)
- label.Text = text;
- }
-
- private void Toggle_ControlBackColor(Control ctrl, int count, string text)
- {
- if (count > 0)
- {
- if (timer_500_toggle == true) ctrl.BackColor = Color.Transparent;
- else ctrl.BackColor = Color.Red;
- }
- else
- {
- if (ctrl.BackColor != Color.Transparent)
- ctrl.BackColor = Color.Transparent;
- }
- if (text != null)
- ctrl.Text = text;
- }
-
-
-
- public void FireFacilityEventCheck()
- {
- {
-
-
-
- if (this.fireCount > 0)
- {
- this.label_FireAlert.Visible = true;
-
- this.label_FireAlert_inform_1th.Visible = true;
- this.txtFirstFireWarnningMessage.Visible = true;
- if (this.fireCount > 1)
- {
- this.label_FireAlert_inform_2th.Visible = true;
- this.cboSecondFireWarnningMessage.Visible = true;
- }
- else
- {
- this.label_FireAlert_inform_2th.Visible = false;
- this.cboSecondFireWarnningMessage.Visible = false;
- }
- if (timer_500_toggle == false)
- {
- this.label_FireAlert.BackColor = Color.Red;
- this.label_FireAlert.ForeColor = Color.Black;
- }
- else
- {
- this.label_FireAlert.BackColor = Color.Transparent;
- this.label_FireAlert.ForeColor = Color.Red;
- }
- }
-
- else if (this.fireCount_Accumulation > 0)
- {
-
- this.label_FireAlert.Visible = true;
-
- this.label_FireAlert_inform_1th.Visible = true;
- this.txtFirstFireWarnningMessage.Visible = true;
- if (this.fireCount_Accumulation > 1)
- {
- this.label_FireAlert_inform_2th.Visible = true;
- this.cboSecondFireWarnningMessage.Visible = true;
- }
- else
- {
- this.label_FireAlert_inform_2th.Visible = false;
- this.cboSecondFireWarnningMessage.Visible = false;
- }
- if (timer_500_toggle == false)
- {
- this.label_FireAlert.BackColor = Color.Red;
- this.label_FireAlert.ForeColor = Color.Black;
- }
- else
- {
- this.label_FireAlert.BackColor = Color.Transparent;
- this.label_FireAlert.ForeColor = Color.Red;
- }
- }
- else
- {
- this.label_FireAlert.Visible = false;
- this.txtFirstFireWarnningMessage.Visible = false;
- this.label_FireAlert_inform_1th.Visible = false;
- this.cboSecondFireWarnningMessage.Visible = false;
- this.cboSecondFireWarnningMessage.Items.Clear();
- this.label_FireAlert_inform_2th.Visible = false;
- }
-
-
-
- if (this.PreFireList.Count > 0)
- {
- this.labelPreFireAlert.Visible = true;
- this.cboPreFireWarnningMessage.Visible = true;
- if (timer_500_toggle == false)
- {
- this.labelPreFireAlert.BackColor = Color.Red;
- this.labelPreFireAlert.ForeColor = Color.Black;
- }
- else
- {
- this.labelPreFireAlert.BackColor = Color.Transparent;
- this.labelPreFireAlert.ForeColor = Color.Red;
- }
- }
- else
- {
- this.labelPreFireAlert.Visible = false;
- this.cboPreFireWarnningMessage.Visible = false;
- this.cboPreFireWarnningMessage.Items.Clear();
- }
-
-
-
- if (this.facilityCount > 0)
- {
- this.label_FacilityAlert.Visible = true;
-
- this.cboWriteWarningMessage.Visible = true;
- this.label_FacilityAlert_inform_1th.Visible = true;
- if (timer_500_toggle == false)
- {
- this.label_FacilityAlert.BackColor = Color.Blue;
- this.label_FacilityAlert.ForeColor = Color.White;
- }
- else
- {
- this.label_FacilityAlert.BackColor = Color.Transparent;
- this.label_FacilityAlert.ForeColor = Color.LightSkyBlue;
- }
- }
- else
- {
- this.label_FacilityAlert.Visible = false;
- this.cboWriteWarningMessage.Visible = false;
- this.cboWriteWarningMessage.Items.Clear();
- this.label_FacilityAlert_inform_1th.Visible = false;
- }
- LEDCount = LEDList.Count;
- if (this.LEDCount > 0)
- {
- this.lblLEDText.Text = LEDList[LEDCount - 1].ToString();
- this.lblLEDText.Visible = true;
-
- if (timer_500_toggle == false)
- {
- this.lblLEDText.BackColor = Color.LightPink;
- this.lblLEDText.ForeColor = Color.White;
- }
- else
- {
- this.lblLEDText.BackColor = Color.Transparent;
- this.lblLEDText.ForeColor = Color.LightPink;
- }
- }
- else
- {
- this.lblLEDText.Visible = false;
- }
- }
- }
-
-
-
-
-
- public void FireEventProcess()
- {
-
- int iFireEventCount = FireList.Count;
-
- int iFireEventCount_Accumulation = FireList_Accumulation.Count;
- try
- {
- if (this.cboSecondFireWarnningMessage.InvokeRequired)
- {
- dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(FireEventProcess);
- this.cboSecondFireWarnningMessage.Invoke(d, new object[] { });
- }
- else
- {
- this.Focus();
- this.cboSecondFireWarnningMessage.Items.Clear();
- this.cboSecondFireWarnningMessage.Text = "";
- if (iFireEventCount > 0)
- {
-
- for (int iLoop = 1; iLoop < iFireEventCount; iLoop++)
- this.cboSecondFireWarnningMessage.Items.Add(FireList[iLoop].ToString());
- if (this.cboSecondFireWarnningMessage.Items.Count > 0)
- this.cboSecondFireWarnningMessage.Text = this.cboSecondFireWarnningMessage.Items[0].ToString();
-
- this.txtFirstFireWarnningMessage.Text = FireList[0].ToString();
-
- this.label_FireAlert.Text = "화재발생";
- }
-
- else if (iFireEventCount_Accumulation > 0)
- {
-
- for (int iLoop = 1; iLoop < iFireEventCount_Accumulation; iLoop++)
- this.cboSecondFireWarnningMessage.Items.Add(FireList_Accumulation[iLoop].ToString());
- if (this.cboSecondFireWarnningMessage.Items.Count > 0)
- this.cboSecondFireWarnningMessage.Text = this.cboSecondFireWarnningMessage.Items[0].ToString();
-
- this.txtFirstFireWarnningMessage.Text = FireList_Accumulation[0].ToString();
-
- this.label_FireAlert.Text = "화재축적상태 발생";
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
- public delegate void dCommandFuctionCallEvent_PreFireEventProcess();
- public void PreFireEventProcess()
- {
-
- int iPreFireListCount = PreFireList.Count;
- if (this.cboPreFireWarnningMessage.InvokeRequired)
- {
- dCommandFuctionCallEvent_PreFireEventProcess d = new dCommandFuctionCallEvent_PreFireEventProcess(PreFireEventProcess);
- this.cboPreFireWarnningMessage.Invoke(d, new object[] { });
- }
- else
- {
- this.Focus();
- this.cboPreFireWarnningMessage.Items.Clear();
- this.cboPreFireWarnningMessage.Text = "";
- if (PreFireList.Count > 0)
- {
- for (int i = 0; i < iPreFireListCount; i++)
- this.cboPreFireWarnningMessage.Items.Add(PreFireList[i].ToString());
- this.cboPreFireWarnningMessage.Text = PreFireList[0].ToString();
- }
- }
- }
- public delegate void dCommandFuctionCallEvent();
- public void EquipEventProcess()
- {
- int iEquipEventCount = EquipList.Count;
- try
- {
- if (this.cboWriteWarningMessage.InvokeRequired)
- {
- dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(EquipEventProcess);
- this.cboWriteWarningMessage.Invoke(d, new object[] { });
- }
- else
- {
- this.Focus();
- this.cboWriteWarningMessage.Items.Clear();
- this.cboWriteWarningMessage.Text = "";
- if (iEquipEventCount > 0)
- {
- for (int iLoop = 0; iLoop < iEquipEventCount; iLoop++)
- {
- this.cboWriteWarningMessage.Items.Add(EquipList[iLoop].ToString());
- }
- if (this.cboWriteWarningMessage.Items.Count > 0)
- {
- this.cboWriteWarningMessage.Text = this.cboWriteWarningMessage.Items[0].ToString();
- }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
-
-
-
- private void _Event_FireDesk_Update_SendMessage_Event(int id, string cmd, string type, int data)
- {
-
- if (cmd == "Count")
- {
-
- if (type == "FireDetect")
- {
- Button btn = (Button)Util.FineControl(panel_Middle, "button_FireDetect" + id.ToString());
- btn.Text = string.Format("화재 : {0:0000}", data);
- if (data > 9999) btn.Text = String.Format("화재 : {0:00000}", data);
- else btn.Text = String.Format("화재 : {0:0000}", data);
- }
-
- else if (type == "DeviceInput")
- {
- Button btn = (Button)Util.FineControl(panel_Middle, "button_DeviceInput" + id.ToString());
- btn.Text = string.Format("설비 : {0:0000}", data);
- if (data > 9999) btn.Text = String.Format("설비 : {0:00000}", data);
- else btn.Text = String.Format("설비 : {0:0000}", data);
- }
-
- else if (type == "RepeaterError")
- {
- Button btn = (Button)Util.FineControl(panel_Middle, "button_RepeaterError" + id.ToString());
- btn.Text = string.Format("통신 : {0:0000}", data);
- if (data > 9999) btn.Text = String.Format("통신 : {0:00000}", data);
- else btn.Text = String.Format("통신 : {0:0000}", data);
- }
-
- else if (type == "DeviceCut")
- {
- Button btn = (Button)Util.FineControl(panel_Middle, "button_DeviceCut" + id.ToString());
- btn.Text = string.Format("단선 : {0:0000}", data);
- if (data > 9999) btn.Text = String.Format("단선 : {0:00000}", data);
- else btn.Text = String.Format("단선 : {0:0000}", data);
- }
-
- else if (type == "DeviceNotuse")
- {
- Button btn = (Button)Util.FineControl(panel_Middle, "button_DeviceNotuse" + id.ToString());
- btn.Text = string.Format("차단 : {0:0000}", data);
- if (data > 9999) btn.Text = String.Format("차단 : {0:00000}", data);
- else btn.Text = String.Format("차단 : {0:0000}", data);
- }
- }
-
- else if (cmd == "FormLoad")
- {
-
- if (type == "MDIParentComplete")
- {
- FormLoadComplete = false;
- LoadMdiparentFormList.Remove(id.ToString());
- }
- }
-
- else if (cmd == "Popup")
- {
- ShowWaitingMsgForm(string.Format("수신기 [{0}]:",id) + type, data);
- }
-
- else if (cmd == "EventProcess")
- {
- if (type == "Fire")
- {
- FireList.Clear();
- FireList_Accumulation.Clear();
- foreach (string ID in _Data.Hash_Receiver_keys)
- {
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[ID];
- foreach (string item in FireDesk_Receiver.mdi.FireList)
- FireList.Add(item);
- foreach (string item in FireDesk_Receiver.mdi.FireList_Accumulation)
- FireList_Accumulation.Add(item);
- }
- FireEventProcess();
- }
- else if (type == "PreFire")
- {
- PreFireList.Clear();
- foreach (string ID in _Data.Hash_Receiver_keys)
- {
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[ID];
- foreach (string item in FireDesk_Receiver.mdi.PreFireList)
- PreFireList.Add(item);
- }
- PreFireEventProcess();
- }
- else if (type == "Equip")
- {
- EquipList.Clear();
- foreach (string ID in _Data.Hash_Receiver_keys)
- {
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[ID];
- foreach (string item in FireDesk_Receiver.mdi.EquipList)
- EquipList.Add(item);
- }
- EquipEventProcess();
- }
- else if (type == "Reset")
- {
- FireList.Clear();
- FireList_Accumulation.Clear();
- PreFireList.Clear();
- EquipList.Clear();
-
- foreach (string ID in _Data.Hash_Receiver_keys)
- {
- if (id.ToString() != ID)
- {
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[ID];
- foreach (string item in FireDesk_Receiver.mdi.FireList)
- FireList.Add(item);
- foreach (string item in FireDesk_Receiver.mdi.FireList_Accumulation)
- FireList_Accumulation.Add(item);
- foreach (string item in FireDesk_Receiver.mdi.PreFireList)
- PreFireList.Add(item);
- foreach (string item in FireDesk_Receiver.mdi.EquipList)
- EquipList.Add(item);
- }
- }
- FireEventProcess();
- PreFireEventProcess();
- EquipEventProcess();
- }
- }
- }
-
- private void button_Receiver_Click(object sender, EventArgs e)
- {
- Button btn = (Button)sender;
- string id = btn.Tag.ToString();
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[id];
- FireDesk_Receiver.mdi.Visible = true;
- }
-
- private void button_Recover_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show("수신기에 복구 명령을 수행하시겠습니까?", Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- Button btn = (Button)sender;
- string id = btn.Tag.ToString();
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[id];
- FireDesk_Receiver.mdi.Visible = true;
-
-
- FireDesk_Receiver.mdi.FireReset_Process();
- FireDesk_Receiver.mdi.socketUI.ReceiverDemonReset();
- }
- }
-
-
-
-
- private void button_MainSoundStop_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show("모든 수신기에 주음향정지 명령을 수행하시겠습니까?", Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- foreach (string id in _Data.Hash_Receiver_keys)
- {
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[id];
- FireDesk_Receiver.mdi.ShowControlWrite(true);
- }
- }
- }
-
- private void button_SearchControl_Click(object sender, EventArgs e)
- {
- if (_Data.FireDesk_Operation_Enable == false)
- {
- FireDesk_Operation Operation = new FireDesk_Operation();
- Operation.Show();
- }
- }
-
- private void button_SearchHistory_Click(object sender, EventArgs e)
- {
- if (_Data.FireDesk_FormLogView_Enable == false)
- {
- FireDesk_FormLogView FormLogView = new FireDesk_FormLogView(this);
- FormLogView.Show();
- }
- }
-
-
-
-
-
-
- public void GetBoardDB()
- {
- DacBoardConfig dacBoardConfig = new DacBoardConfig(0);
- _Data.dtBoardList = dacBoardConfig.SelectBoard(0);
- }
-
-
- public void GetRepeaterDB()
- {
- DacRepeaterConfig dacRepeaterConfig = new DacRepeaterConfig(0);
- _Data.dtRepeaterList2 = dacRepeaterConfig.SelectRepeater2(0);
- }
-
-
- public void GetAnalogDetecterLevelDB()
- {
- DacRepeaterConfig dacRepeaterConfig = new DacRepeaterConfig(0);
- _Data.dtAnalogDetecterLevel = dacRepeaterConfig.SelectRepeater_AnalogDetecterLevel(0);
- }
-
-
- public void GetDeviceDB()
- {
- DacDeviceConfig dacDeviceConfig = new DacDeviceConfig(0);
- _Data.dtDeviceDBList2 = dacDeviceConfig.SelectDevice2(0);
- }
-
-
-
-
- public string GetDeviceName(int BOARD_ID, int LOOP_NO, int REPEATER_ID)
- {
- string ret = "";
- if (_Data.dtRepeaterList2 != null)
- {
-
- DataRow[] result = _Data.dtRepeaterList2.Select(
- string.Format("BOARD_ID={0} AND LOOP_NO={1} AND REPEATER_ID={2}", BOARD_ID, LOOP_NO, REPEATER_ID));
- if (result != null && result.Length > 0)
- ret = result[0]["REPEATER_NAME"].ToString();
- }
- return ret;
- }
-
- public string GetDeviceName(int BOARD_ID, int CommID)
- {
- string ret = "";
- if (_Data.dtBoardList != null)
- {
-
- DataRow[] result = _Data.dtBoardList.Select(
- string.Format("BOARD_ID={0} AND COMM_ID={1}", BOARD_ID, CommID));
- if (result != null && result.Length > 0)
- ret = result[0]["BOARD_NAME"].ToString();
- }
- return ret;
- }
-
- public string GetDeviceName(int BOARD_ID, int LOOP_NO, int REPEATER_ID, int DEVICE_ID, String INOUT_TYPE)
- {
- string ret = "";
- if (_Data.dtDeviceDBList2 != null)
- {
-
- DataRow[] result = _Data.dtDeviceDBList2.Select(
- string.Format("BOARD_ID={0} AND COMM_ID={1} AND LOOP_NO={2} AND REPEATER_ID={3} AND DEVICE_ID={4} AND INOUT_TYPE='{5}'",
- BOARD_ID, 1, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE));
- if (result != null && result.Length > 0)
- ret = result[0]["DEVICE_NAME"].ToString();
- }
- return ret;
- }
-
- public string GetDevicePositionName(int BOARD_ID, int LOOP_NO, int REPEATER_ID)
- {
- string ret = "";
- if (_Data.dtRepeaterList2 != null)
- {
-
- DataRow[] result = _Data.dtRepeaterList2.Select(
- string.Format("BOARD_ID={0} AND LOOP_NO={2} AND REPEATER_ID={3}",
- BOARD_ID, 1, LOOP_NO, REPEATER_ID));
- if (result != null && result.Length > 0)
- {
-
- if (result[0]["POSITION_NAME"].ToString() != "")
- ret = result[0]["POSITION_NAME"].ToString();
-
- else if (result[0]["POSITION_CODE"].ToString() != "")
- ret = result[0]["POSITION_CODE"].ToString();
-
- else
- ret = result[0]["REPEATER_NAME"].ToString();
- }
- }
- return ret;
- }
-
- public string GetDevicePositionName(int BOARD_ID, int LOOP_NO, int REPEATER_ID, int DEVICE_ID, String INOUT_TYPE)
- {
- string ret = "";
- if (_Data.dtDeviceDBList2 != null)
- {
-
- string SQL = string.Format("BOARD_ID={0} AND COMM_ID={1} AND LOOP_NO={2} AND REPEATER_ID={3} AND DEVICE_ID={4} AND INOUT_TYPE='{5}'",
- BOARD_ID, 1, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE);
- DataRow[] result = _Data.dtDeviceDBList2.Select(SQL);
- if (result != null && result.Length > 0)
- {
-
- if (result[0]["POSITION_NAME"].ToString() != "")
- ret = result[0]["POSITION_NAME"].ToString();
-
- else if (result[0]["POSITION_CODE"].ToString() != "")
- ret = result[0]["POSITION_CODE"].ToString();
-
- else
- ret = result[0]["DEVICE_NAME"].ToString();
- }
- }
- return ret;
- }
-
-
-
- public Hashtable GetAnalogDetecterRepeaterID(int RECEIVER_ID, int BOARD_ID, int LOOP_NO)
- {
- Hashtable ret = new Hashtable();
- try
- {
- if (_Data.dtAnalogDetecterLevel != null)
- {
- DataRow[] result = _Data.dtAnalogDetecterLevel.Select(
- string.Format("RECEIVER_ID={0} AND BOARD_ID={1} AND LOOP_NO={2}", RECEIVER_ID, BOARD_ID, LOOP_NO));
- if (result.Length > 0)
- {
- foreach (DataRow Data in result)
- {
- string key = Data["REPEATER_ID"].ToString();
- AnalogLevel data = new AnalogLevel(
- Int32.Parse(Data["FAULT_VALUE"].ToString()),
- Int32.Parse(Data["PREFIRE_VALUE"].ToString()),
- Int32.Parse(Data["FIRED_VALUE"].ToString()),
- Int32.Parse(Data["FIREN_VALUE"].ToString()));
- ret.Add(key, data);
- }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return ret;
- }
-
- public string GetRepeaterType(int BOARD_ID, int LOOP_NO, int REPEATER_ID)
- {
- string ret = "";
- if (_Data.dtRepeaterList2 != null)
- {
-
- DataRow[] result = _Data.dtRepeaterList2.Select(
- string.Format("BOARD_ID={0} AND LOOP_NO={2} AND REPEATER_ID={3}",
- BOARD_ID, 1, LOOP_NO, REPEATER_ID));
- if (result != null && result.Length > 0)
- {
- ret = result[0]["REPEATER_TYPE"].ToString();
- }
- }
- return ret;
- }
- }
-
-
-
-
-
- public class _FireDesk_Receiver
- {
-
- public string RECEIVER_ID = "1";
- public string MASTER_FLAG = "N";
- public string PROJECT_DIRECTORY;
- public string DATABASE_NAME;
- public string DATABASE_NAME_IP;
- public string DATABASE_NAME_PATH;
-
- public int FireDetect = 0;
- public int DeviceInput = 0;
- public int RepeaterError = 0;
- public int DeviceCut = 0;
- public int DeviceNotuse = 0;
-
- public bool LoadStart = false;
- public MDIParent mdi = null;
- }
- }
|