123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208 |
- 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;
- using PushSharp;
- using PushSharp.Android;
- using PushSharp.Core;
- using MouseKeyboardActivityMonitor;
- using MouseKeyboardActivityMonitor.WinApi;
- using System.Runtime.InteropServices;
- using System.Net.NetworkInformation;
- namespace FPER
- {
- public partial class FireDesk_BigReceiver : 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, checkCnt = 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 int timer_1000_Tick_Fire_Cnt_New = 0;
- public int timer_1000_Tick_Fire_Cnt_Old = 0;
-
- public int timer_1000_Tick_Facility_Cnt_New = 0;
- public int timer_1000_Tick_Facility_Cnt_Old = 0;
-
- public int timer_1000_Tick_ComError_Cnt_New = 0;
- public int timer_1000_Tick_ComError_Cnt_Old = 0;
-
- public int timer_1000_Tick_Block_Cnt_New = 0;
- public int timer_1000_Tick_Block_Cnt_Old = 0;
-
- public int timer_1000_Tick_Cut_Cnt_New = 0;
- public int timer_1000_Tick_Cut_Cnt_Old = 0;
-
- public int timer_1000_Tick_Check_Cnt_New = 0;
- public int timer_1000_Tick_Check_Cnt_Old = 0;
-
- public ArrayList GCM_Fire_List = new ArrayList();
- public ArrayList GCM_Facility_List = new ArrayList();
- public ArrayList GCM_ComError_List = new ArrayList();
- public ArrayList GCM_Block_List = new ArrayList();
- public ArrayList GCM_Cut_List = new ArrayList();
- public ArrayList GCM_Check_List = new ArrayList();
- public ArrayList GCM_Fire_Clone = new ArrayList();
- public ArrayList GCM_Facility_Clone = new ArrayList();
- public ArrayList GCM_ComError_Clone = new ArrayList();
- public ArrayList GCM_Block_Clone = new ArrayList();
- public ArrayList GCM_Cut_Clone = new ArrayList();
- public ArrayList GCM_Check_Clone = new ArrayList();
- public System.Threading.Timer GCM_Thread_Timer = null;
- public TimerCallback GCM_CallBack = null;
- public int GCM_Sender_Tick_Cnt = 0;
-
- public static KeyboardHookListener m_KeyboardHookManager;
-
- public _Ethernet Ethernet = new _Ethernet();
-
- public FireDesk_BigReceiver()
- {
- 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 <= 32; id++)
- {
-
- Button button_Receiver = (Button)Util.FineControl(panel_Receiver, "button_Receiver" + id.ToString());
- button_Receiver.Tag = id.ToString();
- button_Receiver.Click += new EventHandler(button_Receiver_Click);
-
- Button button_Recover = (Button)Util.FineControl(panel_Receiver, "button_Recover" + id.ToString());
- button_Recover.Tag = id.ToString();
- button_Recover.Click += new EventHandler(button_Recover_Click);
- }
-
- Timer_WindowBase_FireDesk.Create("timer_1000_TimeLabelUpdate", 1000, timer_1000_TimeLabelUpdate_Tick, true);
- }
-
- private void FireDesk_FormClosing(object sender, FormClosingEventArgs e)
- {
-
- if (_Data.Hook_Enable != "OFF")
- {
- _Hook.Enable_TaskMgr();
- _Hook.Enable_NoClose();
- }
-
- 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)
- {
-
- if (_Data.Hook_Enable != "OFF")
- {
- _Hook.Disable_TaskMgr();
- _Hook.Disable_NoClose();
- GimmeTray();
- m_KeyboardHookManager = new KeyboardHookListener(new GlobalHooker());
- m_KeyboardHookManager.Enabled = true;
- }
-
- 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);
-
- _Data.Hash_Receiver_keys = Sort_StringArray(_Data.Hash_Receiver_keys);
-
-
-
- ArrayList temp = new ArrayList();
- 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();
-
- if (FireDesk_Receiver.MASTER_FLAG == "Y" && temp.Contains(id) == false) temp.Add(id);
- }
- }
- }
-
- this.label_Master.Text = string.Format("Master Receiver ID : {0}", _Convert.ArrayList_to_String(temp, ","));
-
-
- ShowWaitingMsgForm("수신기 디바이스 DB를 읽고 있습니다..", 20);
- this.GetDeviceDB();
- ShowWaitingMsgForm("수신기 중계기 DB를 읽고 있습니다..", 30);
- this.GetRepeaterDB();
-
- this.GetAnalogDetecterLevelDB();
- ShowWaitingMsgForm("수신기 통신 보드 설정을 읽고 있습니다..", 40);
- this.GetBoardDB();
- ShowWaitingMsgForm("수신기 기본 설정값을 읽고 있습니다..", 50);
-
-
-
-
-
- for (int id = 1; id <= 32; id++)
- {
-
- if (_Data.Hash_Receiver.ContainsKey(id.ToString()) == false)
- {
- Panel p = (Panel)Util.FineControl(panel_Receiver, "panel_Receiver" + id.ToString());
- p.Enabled = false;
- Button b = (Button)Util.FineControl(panel_Receiver, "button_Receiver" + id);
- b.Enabled = false;
- b.BackColor = Color.DarkGray;
- }
- }
-
- MDIParent_Load_Func();
-
- ShowWaitingMsgForm("수신반을 시작합니다", 100);
- System.Threading.Thread.Sleep(1000);
- waitingForm_FireDesk.Close();
- waitingForm_FireDesk = null;
-
- this.label_BuildingName.Text = _Data.Site_Name;
-
- GCM_CallBack = new TimerCallback(GCM_Sender_CallBack);
- GCM_Thread_Timer = new System.Threading.Timer(GCM_CallBack, this, 1000, 1000);
-
-
-
- int timer_cnt = 0;
- switch (_Data.Hash_Receiver.Keys.Count)
- {
- case 1: timer_cnt = 3000; break;
- case 2: timer_cnt = 3000; break;
- case 3: timer_cnt = 3000; break;
- case 4: timer_cnt = 3000; break;
- case 5: timer_cnt = 2500; break;
- default: timer_cnt = 2000; break;
- }
-
- Timer_WindowBase_FireDesk.Create("ConnectCheck_Timer", timer_cnt, ConnectCheck_Timer_Tick, true);
-
- Timer_WindowBase_FireDesk.Create("Display_Timer", 1000, Display_Timer_Tick, true);
- }
-
- private string[] Sort_StringArray(string[] Data)
- {
- ArrayList temp = new ArrayList();
- foreach (string id in Data)
- temp.Add(id);
- temp.Sort(new _Sort.ID());
- string[] result = new string[temp.Count];
- temp.CopyTo(result);
- return result;
- }
-
- private void MDIParent_Load_Func()
- {
-
- LoadMdiparentFormList.Clear();
- while (true)
- {
- foreach (string id in _Data.Hash_Receiver_keys)
- {
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[id];
-
- if (FormLoadComplete == false)
- {
-
- FormLoadComplete = true;
-
- if (FireDesk_Receiver.LoadingOk == false)
- {
-
- if (Ethernet.Ping_SyncCheck(FireDesk_Receiver.DATABASE_NAME_IP) == true)
- {
- Receiver_MDIParent_Load(FireDesk_Receiver, Int32.Parse(id));
- UPDATE_TB_RECEIVER_ERROR_COUNT_DETAILS(id);
- Receiver_ComNormal(id.ToString());
- }
- else
- {
- Receiver_MDIParent_Close(FireDesk_Receiver, Int32.Parse(id));
- Receiver_ComError(id.ToString());
- FormLoadComplete = false;
- }
-
- if (LoadMdiparentFormList.Contains(id.ToString()) == false)
- LoadMdiparentFormList.Add(id.ToString());
- System.Threading.Thread.Sleep(300);
- }
- }
- }
-
- if (LoadMdiparentFormList.Count == _Data.Hash_Receiver_keys.Length)
- {
- break;
- }
- }
- }
-
- private void MDIParent_Update_Func(string Receiver_ID)
- {
-
- if (Receiver_ID == "" || Receiver_ID == "0" || _Data.Hash_Receiver.ContainsKey(Receiver_ID.ToString()) == false)
- return;
-
- if (waitingForm_FireDesk != null && waitingForm_FireDesk.Visible == true)
- {
- waitingForm_FireDesk.Close();
- waitingForm_FireDesk = null;
- }
- string id = Receiver_ID.ToString();
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[id];
-
- if (FormLoadComplete == false)
- {
-
- FormLoadComplete = true;
-
- if (FireDesk_Receiver.LoadingOk == false)
- {
- if (Ethernet.Ping_SyncCheck(FireDesk_Receiver.DATABASE_NAME_IP) == true)
- {
- Receiver_MDIParent_Load(FireDesk_Receiver, Int32.Parse(id));
- UPDATE_TB_RECEIVER_ERROR_COUNT_DETAILS(id);
- Receiver_ComNormal(id.ToString());
- }
- else
- {
-
-
- Receiver_ComError(id.ToString());
- FormLoadComplete = false;
- }
- }
- else
- {
- if (Ethernet.Ping_SyncCheck(FireDesk_Receiver.DATABASE_NAME_IP) == true)
- {
- UPDATE_TB_RECEIVER_ERROR_COUNT_DETAILS(id);
- Receiver_ComNormal(id.ToString());
- FormLoadComplete = false;
- }
- else
- {
-
-
- Receiver_ComError(id.ToString());
- FormLoadComplete = false;
- }
- }
- }
- }
-
-
-
- private void Receiver_ComError(string id)
- {
- Button p = (Button)Util.FineControl(panel_Receiver, "button_Receiver" + id);
- p.Enabled = false;
- p.BackColor = Color.HotPink;
- if (CommErrorReceiver.Contains(id) == false) CommErrorReceiver.Add(id);
- }
- private void Receiver_ComNormal(string id)
- {
- Button p = (Button)Util.FineControl(panel_Receiver, "button_Receiver" + id);
- p.Enabled = true;
- p.BackColor = Color.WhiteSmoke;
- if (CommErrorReceiver.Contains(id) == true) CommErrorReceiver.Remove(id);
- }
-
-
-
- private void Receiver_MDIParent_Load(_FireDesk_Receiver FireDesk_Receiver, int id)
- {
-
- if (FireDesk_Receiver.mdi == null)
- {
- try
- {
- FireDesk_Receiver.mdi = new MDIParent(id, Event);
- FireDesk_Receiver.mdi.TopMost = false;
- FireDesk_Receiver.mdi.Show();
- FireDesk_Receiver.mdi.Visible = false;
- FireDesk_Receiver.LoadingOk = true;
- }
- catch
- {
- FireDesk_Receiver.LoadingOk = false;
- FormLoadComplete = false;
- }
- }
- }
- private void Receiver_MDIParent_Close(_FireDesk_Receiver FireDesk_Receiver, int id)
- {
- FireDesk_Receiver.LoadingOk = false;
- if (FireDesk_Receiver.mdi != null)
- {
- FireDesk_Receiver.mdi.Close();
- FireDesk_Receiver.mdi = null;
- }
- }
-
-
-
- private void Initialize_Hash_Receiver(Hashtable hashtable)
- {
- hashtable.Clear();
- for (int i = 1; i <= 32; 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();
- }
- }
- string GetDevicePositionName(CEventLogData eventLog, MDIParent mdi)
- {
- string ret = "";
- {
-
- string DefaultValue = "";
- switch (eventLog.ioType)
- {
-
-
-
- case "M":
- {
-
- ret = DefaultValue;
- }
- break;
-
-
-
- case "A":
-
- {
-
-
- ret = DefaultValue;
- }
- break;
- case "C":
-
- {
-
-
- if (eventLog.eventType == "DC")
- {
-
- if (eventLog.boardID == 0 && eventLog.repeaterID == 0 && eventLog.deviceID == 0)
- {
- ret = DefaultValue;
- }
-
- else if (eventLog.boardID != 0 && eventLog.repeaterID == 0 && eventLog.deviceID == 0)
- {
- ret = mdi.GetDeviceName(eventLog.boardID, eventLog.commID);
- if (eventLog.commID == 1)
- {
- ret += string.Format(":{0}계통", eventLog.loopNO.ToString());
- }
- }
-
- else if (eventLog.boardID != 0 && eventLog.repeaterID != 0 && eventLog.deviceID == 0)
- {
- ret = mdi.GetDevicePositionName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID);
- }
- else
- ret = DefaultValue;
- }
- }
- break;
- case "B":
- {
-
-
- ret = DefaultValue;
- }
- break;
- case "L":
- {
-
-
-
- ret = DefaultValue;
- }
- break;
- case "R":
- {
-
-
-
-
- ret = mdi.GetDevicePositionName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID);
- }
- break;
- case "D":
- {
-
-
- ret = DefaultValue;
- }
- break;
- case "I":
- case "O":
- {
-
- if (eventLog.eventType == "MS"
- || eventLog.eventType == "LS"
- || eventLog.eventType == "EB"
- || eventLog.eventType == "RP"
- || eventLog.eventType == "BF"
- || eventLog.eventType == "ED"
- )
- {
- ret = DefaultValue;
- }
- else
- {
-
- ret = mdi.GetDevicePositionName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID, eventLog.deviceID, eventLog.ioType);
- }
- }
- break;
- default:
- {
-
- ret = DefaultValue;
- }
- break;
- }
-
-
- }
- return ret;
- }
- string GetRemarkInfo(string Original, string Attribute)
- {
- try
- {
- string result = "";
-
-
-
-
- ArrayList temp_list = new ArrayList();
- Hashtable temp_hash = new Hashtable();
-
- string[] temp_1th = Original.Split(',');
- char[] remove_char1 = { '(', ')' };
- char[] remove_char2 = { '[', ']' };
- foreach (string temp in temp_1th)
- {
-
- if (temp.Contains(Attribute) == true)
- {
- string[] temp_2st = temp.Split(':');
- result = temp_2st[1].Trim(remove_char1);
- return result.Trim(remove_char2);
- }
- }
- return result;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- return "";
- }
- }
- string GetDeviceName(CEventLogData eventLog, MDIParent mdi)
- {
-
- string ret = "";
-
- {
-
- string receiverID = string.Format("수신기[{0}]", eventLog.receiverID);
-
- string remark_device_type = GetRemarkInfo(eventLog.eventRemark, "DEVICE TYPE");
- if (remark_device_type.Length != 0) remark_device_type = "-" + remark_device_type;
-
- string DefaultValue = receiverID + remark_device_type;
- switch (eventLog.ioType)
- {
-
-
-
- case "M":
- {
- ret = "MASTER 수신기" + remark_device_type;
- }
- break;
-
-
-
- case "A":
- if (Convert.ToInt32(eventLog.receiverID) > 0)
- {
- ret = DefaultValue;
-
- }
- break;
- case "C":
- {
-
-
-
-
-
-
- if (eventLog.eventType == "DC")
- {
-
- if (eventLog.boardID == 0 && eventLog.repeaterID == 0 && eventLog.deviceID == 0)
- {
- ret = DefaultValue;
- }
-
- else if (eventLog.boardID != 0 && eventLog.repeaterID == 0 && eventLog.deviceID == 0)
- {
- ret = mdi.GetDeviceName(eventLog.boardID, eventLog.commID);
- if (eventLog.commID == 1)
- {
- ret += string.Format(":{0}계통", eventLog.loopNO.ToString());
- }
- }
-
- else if (eventLog.boardID != 0 && eventLog.repeaterID != 0 && eventLog.deviceID == 0)
- {
- ret = mdi.GetDeviceName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID);
- }
- else
- ret = DefaultValue;
- }
- else if (Convert.ToInt32(eventLog.receiverID) > 0)
- {
- ret = DefaultValue;
- }
- }
- break;
- case "B":
- {
-
- ret = mdi.GetDeviceName(eventLog.boardID, eventLog.commID);
- }
- break;
- case "L":
- {
-
- ret = mdi.GetDeviceName(eventLog.boardID, eventLog.commID);
- if (eventLog.commID == 1)
- {
- ret += string.Format(":{0}계통", eventLog.loopNO.ToString());
- }
- }
- break;
- case "R":
- {
-
- ret = mdi.GetDeviceName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID);
- break;
- }
- case "D":
- {
- ret = "장치";
- break;
- }
- case "I":
- case "O":
- {
-
- if (eventLog.eventType == "MS"
- || eventLog.eventType == "LS"
- || eventLog.eventType == "EB"
- || eventLog.eventType == "RP"
- || eventLog.eventType == "BF"
- || eventLog.eventType == "ED"
- )
- {
- ret = DefaultValue;
- }
- else
- {
- ret = mdi.GetDeviceName(eventLog.boardID, eventLog.loopNO, eventLog.repeaterID, eventLog.deviceID, eventLog.ioType);
- }
- break;
- }
- default:
- {
- break;
- }
- }
-
- if (ret == null || ret.Length == 0) ret = DefaultValue;
- }
- return ret;
- }
-
- private void UPDATE_TB_RECEIVER_ERROR_COUNT_DETAILS(string ID)
- {
- if (_Data.Hash_Receiver.ContainsKey(ID) == false) return;
- if (_Data.MOBILE_ENABLE == "ON")
- {
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[ID];
-
- if (FireDesk_Receiver.mdi == null)
- return;
-
- using (DacReceiverConfig query_session = new DacReceiverConfig(0))
- {
-
-
-
- query_session.ExecuteNonQuery(string.Format("delete from TB_RECEIVER_ERROR_COUNT_DETAILS where IP_ADDRESS = '{0}'", FireDesk_Receiver.DATABASE_NAME_IP));
-
-
-
- string IP_ADDRESS = FireDesk_Receiver.DATABASE_NAME_IP;
- string ERROR_TYPE = "";
- string LOCATION = "";
- string DEVICE_NAME = "";
- string EVENT_TYPE = "";
- string DEVICE_NUMBER = "";
- Hashtable eventLogInfos_temp = (Hashtable)FireDesk_Receiver.mdi.AryEventLogs.Clone();
- if (eventLogInfos_temp != null && eventLogInfos_temp.Count != 0)
- {
- foreach (DictionaryEntry d in eventLogInfos_temp)
- {
-
-
- EventLogInfo eventLogMsg = (EventLogInfo)d.Value;
- {
- if (eventLogMsg.LiveMsgFlag)
- {
-
-
- CEventLogData elog = new CEventLogData(eventLogMsg);
- {
- elog.eventTypeName = eventLogMsg.EventTypeName;
- LOCATION = elog.devicePosition = GetDevicePositionName(elog, FireDesk_Receiver.mdi);
- DEVICE_NAME = elog.deviceName = GetDeviceName(elog, FireDesk_Receiver.mdi);
-
- string temp_Report_EventPostion = "";
- if (elog.EventPositon == null
- || elog.EventPositon.Length == 0
- || elog.ioType == "M"
- || elog.EventPositon.Contains("수신기") == true)
- temp_Report_EventPostion = "없음";
- else temp_Report_EventPostion = elog.EventPositon;
-
- string RepeaterType = FireDesk_Receiver.mdi.GetRepeaterType(elog.boardID, elog.loopNO, elog.repeaterID);
-
-
-
-
- if (RepeaterType == "4" || RepeaterType == "5")
- {
- elog.eventTypeName = elog.eventTypeName.Replace("중계기", "감지기");
- temp_Report_EventPostion = temp_Report_EventPostion.Replace("중계기", "감지기");
- }
- DEVICE_NUMBER = elog.Report_EventPositon = temp_Report_EventPostion;
-
- if (elog.eventType == "DC")
- {
- string temp = GetRemarkInfo(elog.eventRemark, "STATUS");
- if (temp == "INACTIVE")
- elog.Report_EventErrorStatus = 0;
- else
- elog.Report_EventErrorStatus = 2;
- }
-
-
- else if (elog.eventType == "MS"
- || elog.eventType == "LS"
- || elog.eventType == "EB"
- || elog.eventType == "RP"
- || elog.eventType == "BF"
- || elog.eventType == "ED"
- )
- {
-
- string temp = elog.eventRemark;
- int idx1 = temp.LastIndexOf('(');
- int idx2 = temp.LastIndexOf(')');
- string temp1 = temp.Substring(idx1);
- temp1 = temp1.Replace(")", "");
- temp1 = temp1.Replace("(", "");
- if (temp1 == "ON")
- elog.Report_EventErrorStatus = 0;
- else
- elog.Report_EventErrorStatus = 2;
- }
-
- else
- elog.Report_EventErrorStatus = elog.EventErrorStatus;
- EVENT_TYPE = FireDesk_Receiver.mdi.EventTypeName.Hash_EventType[elog.eventType].ToString();
- ERROR_TYPE = FireDesk_Receiver.mdi.EventTypeName.EventType_Division(elog.eventType);
- query_session.ExecuteSql(string.Format("insert into TB_RECEIVER_ERROR_COUNT_DETAILS (IP_ADDRESS,ERROR_TYPE,LOCATION,DEVICE_NAME,EVENT_TYPE,DEVICE_NUMBER,EVENT_TIME) values ('{0}','{1}','{2}','{3}','{4}','{5}',current_timestamp)",
- IP_ADDRESS, ERROR_TYPE, LOCATION, DEVICE_NAME, EVENT_TYPE, DEVICE_NUMBER));
- }
- }
- }
- }
- }
- }
- }
- }
-
-
-
-
- private void timer_1000_TimeLabelUpdate_Tick(object sende, EventArgs e)
- {
-
- MyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
-
- this.label_Time.Text = string.Format("{0:yyyy}년 {0:MM}월 {0:dd}일 {0:HH}:{0:mm}:{0:ss}", DateTime.Now);
-
- if (CommErrorReceiver.Count != 0)
- label_ReceiverCount.Text = string.Format("전체 수신기 대수 : {0} 개 , 통신 불량 수신기 개수 : {1}", _Data.Hash_Receiver.Keys.Count, CommErrorReceiver.Count);
- else
- label_ReceiverCount.Text = string.Format("전체 수신기 대수 : {0} 개", _Data.Hash_Receiver.Keys.Count);
- }
-
- int ConnectCheck_Timer_Tick_Cnt = 0;
-
- private void ConnectCheck_Timer_Tick(object sende, EventArgs e)
- {
-
- if (ConnectCheck_Timer_Tick_Cnt >= _Data.Hash_Receiver_keys.Length - 1)
- ConnectCheck_Timer_Tick_Cnt = 0;
- else
- ConnectCheck_Timer_Tick_Cnt++;
-
- MDIParent_Update_Func(_Data.Hash_Receiver_keys[ConnectCheck_Timer_Tick_Cnt]);
- }
-
- public void GCM_Sender_CallBack(object target)
- {
- if (this.InvokeRequired)
- {
- this.Invoke(new TimerCallback(GCM_Sender_CallBack), new object[] { target });
- }
- else
- {
- if (GCM_Sender_Tick_Cnt > 10)
- GCM_Sender_Tick_Cnt = 0;
- else
- GCM_Sender_Tick_Cnt++;
- if (_Data.MOBILE_ENABLE == "ON" && _Data.GCM_ENABLE == "ON" && _Data.GCM_API_KEY != null)
- {
- string Comment = "";
-
-
-
-
-
- if (_Data.GCM_INFO_FIRE == "ON" && GCM_Sender_Tick_Cnt == 0)
- {
- Comment = ""; if (GCM_Fire_Clone.Count != 0) Comment = string.Format("화재! 수신기ID:{0}", Receiver_ID_List_String(GCM_Fire_Clone));
- if (timer_1000_Tick_Fire_Cnt_New != timer_1000_Tick_Fire_Cnt_Old && timer_1000_Tick_Fire_Cnt_New > timer_1000_Tick_Fire_Cnt_Old) GCM_Send(Comment);
- timer_1000_Tick_Fire_Cnt_Old = timer_1000_Tick_Fire_Cnt_New;
- }
-
- if (_Data.GCM_INFO_FACILITY == "ON" && GCM_Sender_Tick_Cnt == 2)
- {
- Comment = ""; if (GCM_Facility_Clone.Count != 0) Comment = string.Format("설비! 수신기ID:{0}", Receiver_ID_List_String(GCM_Facility_Clone));
- if (timer_1000_Tick_Facility_Cnt_New != timer_1000_Tick_Facility_Cnt_Old && timer_1000_Tick_Facility_Cnt_New > timer_1000_Tick_Facility_Cnt_Old) GCM_Send(Comment);
- timer_1000_Tick_Facility_Cnt_Old = timer_1000_Tick_Facility_Cnt_New;
- }
-
- if (_Data.GCM_INFO_COMERROR == "ON" && GCM_Sender_Tick_Cnt == 4)
- {
- Comment = ""; if (GCM_ComError_Clone.Count != 0) Comment = string.Format("통신! 수신기ID:{0}", Receiver_ID_List_String(GCM_ComError_Clone));
- if (timer_1000_Tick_ComError_Cnt_New != timer_1000_Tick_ComError_Cnt_Old && timer_1000_Tick_ComError_Cnt_New > timer_1000_Tick_ComError_Cnt_Old) GCM_Send(Comment);
- timer_1000_Tick_ComError_Cnt_Old = timer_1000_Tick_ComError_Cnt_New;
- }
-
- if (_Data.GCM_INFO_BLOCK == "ON" && GCM_Sender_Tick_Cnt == 6)
- {
- Comment = ""; if (GCM_Block_Clone.Count != 0) Comment = string.Format("단선! 수신기ID:{0}", Receiver_ID_List_String(GCM_Block_Clone));
- if (timer_1000_Tick_Block_Cnt_New != timer_1000_Tick_Block_Cnt_Old && timer_1000_Tick_Block_Cnt_New > timer_1000_Tick_Block_Cnt_Old) GCM_Send(Comment);
- timer_1000_Tick_Block_Cnt_Old = timer_1000_Tick_Block_Cnt_New;
- }
-
- if (_Data.GCM_INFO_CUT == "ON" && GCM_Sender_Tick_Cnt == 8)
- {
- Comment = ""; if (GCM_Cut_Clone.Count != 0) Comment = string.Format("차단! 수신기ID:{0}", Receiver_ID_List_String(GCM_Cut_Clone));
- if (timer_1000_Tick_Cut_Cnt_New != timer_1000_Tick_Cut_Cnt_Old && timer_1000_Tick_Cut_Cnt_New > timer_1000_Tick_Cut_Cnt_Old) GCM_Send(Comment);
- timer_1000_Tick_Cut_Cnt_Old = timer_1000_Tick_Cut_Cnt_New;
- }
-
- if (_Data.GCM_INFO_CHECK == "ON" && GCM_Sender_Tick_Cnt == 10)
- {
- Comment = ""; if (GCM_Check_Clone.Count != 0) Comment = string.Format("점검! 수신기ID:{0}", Receiver_ID_List_String(GCM_Check_Clone));
- if (timer_1000_Tick_Check_Cnt_New != timer_1000_Tick_Check_Cnt_Old && timer_1000_Tick_Check_Cnt_New > timer_1000_Tick_Check_Cnt_Old) GCM_Send(Comment);
- timer_1000_Tick_Check_Cnt_Old = timer_1000_Tick_Check_Cnt_New;
- }
- }
- }
- }
-
- private string Receiver_ID_List_String(ArrayList al)
- {
- string DataString = null;
- foreach (string datas in al)
- DataString += datas + " ";
- return DataString.Trim();
- }
-
- public void GCM_Send(string Comment)
- {
- Thread WorkingThread = new Thread(new ParameterizedThreadStart(GCM_Send_Thread));
- WorkingThread.Start(Comment);
- }
-
- public void GCM_Send_Thread(object Comment)
- {
- using (DacReceiverConfig push_info_select_query = new DacReceiverConfig(0))
- {
- DataSet ds = push_info_select_query.Select("select * from TB_PUSH_DEVICE");
- DataTable dt = ds.Tables[0];
- foreach (DataRow dr in dt.Rows)
- {
- string Regid = dr["REG_ID"].ToString();
- var push = new PushBroker();
- push.OnNotificationSent += NotificationSent;
- push.OnChannelException += ChannelException;
- push.OnServiceException += ServiceException;
- push.OnNotificationFailed += NotificationFailed;
- push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
- push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
- push.OnChannelCreated += ChannelCreated;
- push.OnChannelDestroyed += ChannelDestroyed;
-
- push.RegisterGcmService(new GcmPushChannelSettings(_Data.GCM_API_KEY));
-
- push.QueueNotification(new GcmNotification()
- .ForDeviceRegistrationId(Regid)
- .WithJson("{\"message\":\"" + Comment.ToString() + "\"}"));
- push.StopAllServices();
- }
- }
- }
- private void NotificationSent(object sender, INotification notification)
- {
-
- }
- private void ChannelException(object sender, IPushChannel pushChannel, Exception error)
- {
-
- }
- private void ServiceException(object sender, Exception error)
- {
-
- }
- private void NotificationFailed(object sender, INotification notification, Exception error)
- {
-
- }
- private void DeviceSubscriptionExpired(object sender, string expiredSubscriptionId, DateTime expirationDateUtc, INotification notification)
- {
-
- }
- private void DeviceSubscriptionChanged(object sender, string oldSubscriptionId, string newSubscriptionId, INotification notification)
- {
-
- }
- private void ChannelCreated(object sender, IPushChannel pushChannel)
- {
-
- }
- private void ChannelDestroyed(object sender)
- {
-
- }
-
- bool Display_Timer_toggle = false;
-
- private void Display_Timer_Tick(object sende, EventArgs e)
- {
-
- if (waitingForm_FireDesk != null && waitingForm_FireDesk.Visible == true) return;
-
- Display_Timer_toggle = !Display_Timer_toggle;
-
-
-
- fireCount = 0;
- facilityCount = 0;
- errorCount = 0;
- blockingCount = 0;
- cutCnt = 0;
- checkCnt = 0;
- fireCount_Accumulation = 0;
- PreFireList = new ArrayList();
-
- GCM_Fire_List.Clear();
- GCM_Facility_List.Clear();
- GCM_ComError_List.Clear();
- GCM_Block_List.Clear();
- GCM_Cut_List.Clear();
- GCM_Check_List.Clear();
- 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);
-
- if (FireDesk_Receiver.mdi.fireCount > 0) GCM_Fire_List.Add(id);
- if (FireDesk_Receiver.mdi.facilityCount > 0) GCM_Facility_List.Add(id);
- if (FireDesk_Receiver.mdi.errorCount > 0) GCM_ComError_List.Add(id);
- if (FireDesk_Receiver.mdi.blockingCount > 0) GCM_Block_List.Add(id);
- if (FireDesk_Receiver.mdi.CutCnt > 0) GCM_Cut_List.Add(id);
- if (FireDesk_Receiver.mdi.fireCount > 0) GCM_Check_List.Add(id);
- if (FireDesk_Receiver.mdi.CheckBtn_Current_Status == true
- || FireDesk_Receiver.mdi.CommDaemon_ComStatus == false
- || FireDesk_Receiver.mdi.lblEmergencyBoardStatus_Visible == true
- )
-
-
- {
-
- checkCnt = checkCnt + 1;
- GCM_Check_List.Add(id);
- }
- }
- }
-
- timer_1000_Tick_Fire_Cnt_New = fireCount;
- timer_1000_Tick_Facility_Cnt_New = facilityCount;
- timer_1000_Tick_ComError_Cnt_New = errorCount;
- timer_1000_Tick_Block_Cnt_New = blockingCount;
- timer_1000_Tick_Cut_Cnt_New = cutCnt;
- timer_1000_Tick_Check_Cnt_New = checkCnt;
- GCM_Fire_Clone = (ArrayList)GCM_Fire_List.Clone();
- GCM_Facility_Clone = (ArrayList)GCM_Facility_List.Clone();
- GCM_ComError_Clone = (ArrayList)GCM_ComError_List.Clone();
- GCM_Block_Clone = (ArrayList)GCM_Block_List.Clone();
- GCM_Cut_Clone = (ArrayList)GCM_Cut_List.Clone();
- GCM_Check_Clone = (ArrayList)GCM_Check_List.Clone();
-
- 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_Receiver, "button_Check" + id.ToString());
-
- if (FireDesk_Receiver.mdi != null)
- {
-
- if (FireDesk_Receiver.mdi.CheckBtn_Current_Status == true
- || FireDesk_Receiver.mdi.CommDaemon_ComStatus == false
- || FireDesk_Receiver.mdi.lblEmergencyBoardStatus_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 (Display_Timer_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 (Display_Timer_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 (Display_Timer_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 (Display_Timer_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 (Display_Timer_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 (Display_Timer_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 (Display_Timer_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 UPDATE_TB_RECEIVER_ERROR_COUNT(int ID, string Type, int pValue)
- {
- if (_Data.MOBILE_ENABLE == "ON")
- {
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[ID.ToString()];
-
- string Value = pValue.ToString();
- using (DacReceiverConfig query_session = new DacReceiverConfig(0))
- {
- switch (Type)
- {
- case "FireDetect":
- query_session.ExecuteSql(string.Format("update TB_RECEIVER_ERROR_COUNT set {1} = {2} where IP_ADDRESS = '{0}'", FireDesk_Receiver.DATABASE_NAME_IP, "INFO1", Value));
- break;
- case "DeviceInput":
- query_session.ExecuteSql(string.Format("update TB_RECEIVER_ERROR_COUNT set {1} = {2} where IP_ADDRESS = '{0}'", FireDesk_Receiver.DATABASE_NAME_IP, "INFO2", Value));
- break;
- case "RepeaterError":
- query_session.ExecuteSql(string.Format("update TB_RECEIVER_ERROR_COUNT set {1} = {2} where IP_ADDRESS = '{0}'", FireDesk_Receiver.DATABASE_NAME_IP, "INFO3", Value));
- break;
- case "DeviceCut":
- query_session.ExecuteSql(string.Format("update TB_RECEIVER_ERROR_COUNT set {1} = {2} where IP_ADDRESS = '{0}'", FireDesk_Receiver.DATABASE_NAME_IP, "INFO4", Value));
- break;
- case "DeviceNotuse":
- query_session.ExecuteSql(string.Format("update TB_RECEIVER_ERROR_COUNT set {1} = {2} where IP_ADDRESS = '{0}'", FireDesk_Receiver.DATABASE_NAME_IP, "INFO5", Value));
- break;
- }
- }
- }
- }
-
-
-
-
- private void _Event_FireDesk_Update_SendMessage_Event(int id, string cmd, string type, int data)
- {
-
- if (cmd == "Count")
- {
-
- UPDATE_TB_RECEIVER_ERROR_COUNT(id, type, data);
-
- if (type == "FireDetect")
- {
- Button btn = (Button)Util.FineControl(panel_Receiver, "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_Receiver, "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_Receiver, "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_Receiver, "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_Receiver, "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;
-
-
-
-
- }
- }
-
- 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)
- if (FireList.Contains(item) == false) FireList.Add(item);
- foreach (string item in FireDesk_Receiver.mdi.FireList_Accumulation)
- if (FireList_Accumulation.Contains(item) == false) 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)
- if (PreFireList.Contains(item) == false) 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)
- if (EquipList.Contains(item) == false) 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)
- if (FireList.Contains(item) == false) FireList.Add(item);
- foreach (string item in FireDesk_Receiver.mdi.FireList_Accumulation)
- if (FireList_Accumulation.Contains(item) == false) FireList_Accumulation.Add(item);
- foreach (string item in FireDesk_Receiver.mdi.PreFireList)
- if (PreFireList.Contains(item) == false) PreFireList.Add(item);
- foreach (string item in FireDesk_Receiver.mdi.EquipList)
- if (EquipList.Contains(item) == false) 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, 0);
- }
- }
- }
-
- 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;
- }
-
- private void pictureBox_CI_Click(object sender, EventArgs e)
- {
- if (_Data.GCM_TEST_MODE == "ON")
- {
-
- using (DacReceiverConfig push_info_select_query = new DacReceiverConfig(0))
- {
- DataSet ds = push_info_select_query.Select("select * from TB_PUSH_DEVICE");
- DataTable dt = ds.Tables[0];
- foreach (DataRow dr in dt.Rows)
- {
- string Regid = dr["REG_ID"].ToString();
- var push = new PushBroker();
- push.OnNotificationSent += NotificationSent;
- push.OnChannelException += ChannelException;
- push.OnServiceException += ServiceException;
- push.OnNotificationFailed += NotificationFailed;
- push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
- push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
- push.OnChannelCreated += ChannelCreated;
- push.OnChannelDestroyed += ChannelDestroyed;
-
- push.RegisterGcmService(new GcmPushChannelSettings(_Data.GCM_API_KEY));
-
- push.QueueNotification(new GcmNotification()
- .ForDeviceRegistrationId(Regid)
- .WithJson("{\"message\":\"" + "TEST" + "\"}"));
- push.StopAllServices();
- }
- }
- }
- }
-
-
-
-
- private NotifyIcon trayIcon;
- private ContextMenu trayMenu;
- private void GimmeTray()
- {
-
- trayMenu = new ContextMenu();
- trayMenu.MenuItems.Add("Exit", OnExit);
-
- trayIcon = new NotifyIcon();
- trayIcon.Text = "Windows System Key Blocker";
- trayIcon.Icon = new Icon(SystemIcons.Shield, 40, 40);
-
- trayIcon.ContextMenu = trayMenu;
- trayIcon.Visible = true;
- }
- private void OnExit(object sender, EventArgs e)
- {
- Console.WriteLine(" ! OSK exited.");
- trayIcon.Dispose();
- m_KeyboardHookManager.Dispose();
- Application.Exit();
- ShowToolbars();
- }
-
- private const int SW_HIDE = 0;
- private const int SW_SHOW = 1;
- [DllImport("user32.dll")]
- private static extern int FindWindow(string className, string windowText);
- [DllImport("user32.dll")]
- private static extern int ShowWindow(int hwnd, int command);
- private void HideToolbars()
- {
- int hWnd = FindWindow("Shell_TrayWnd", "");
- ShowWindow(hWnd, SW_HIDE);
- }
- private void ShowToolbars()
- {
- int hWnd = FindWindow("Shell_TrayWnd", "");
- ShowWindow(hWnd, SW_SHOW);
- }
- }
- }
|