frmWarningBox.cs 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Collections;
  9. using System.IO;
  10. namespace FPER
  11. {
  12. public partial class frmWarningBox : Form// 경고 창 클래스
  13. {
  14. MDIParent parent;
  15. bool chkDetailViewMode = false;
  16. // cyim 2015.7.6 속도개선작업
  17. Hashtable eventLogInfos; //ArrayList eventLogInfos;
  18. delegate void deleFormInit();
  19. public bool faultmode = false;
  20. private string strImagePathCommConnect = "경고창_통신에러_이미지.gif"; //통신에러
  21. private string strImagePathFireOn = "경고창_화재_이미지.gif"; //화재
  22. private string strImagePathWriteOn = "경고창_설비_이미지.gif"; //설비가동
  23. private string strImagePathFaultOn = "경고창_FAULT_이미지.gif"; //에러
  24. private string strImagePathAccumul = "경고창_축적화재_이미지.gif"; //축적
  25. private string strImagePathPhoneOn = "경고창_전화_이미지.gif"; //전화
  26. private string strImagePathFireRecover = "경고창_화재복구_이미지.gif"; //화재복구
  27. private string ImagePathCommConnect { get { return Path.Combine(this.ImgBasePath, this.strImagePathCommConnect); } }
  28. private void ImageLoadingCommConnect()
  29. {
  30. Image img = ImgLoad(this.ImagePathCommConnect);
  31. if (img != null)
  32. {
  33. this.picTitle.Image = img;
  34. }
  35. }
  36. private string ImagePathFireOn { get { return Path.Combine(this.ImgBasePath, this.strImagePathFireOn); } }
  37. private void ImageLoadingFireOn()
  38. {
  39. Image img = ImgLoad(this.ImagePathFireOn);
  40. if (img != null)
  41. {
  42. this.picTitle.Image = img;
  43. }
  44. }
  45. private string ImagePathWriteOn { get { return Path.Combine(this.ImgBasePath, this.strImagePathWriteOn); } }
  46. private void ImageLoadingWriteOn()
  47. {
  48. Image img = ImgLoad(this.ImagePathWriteOn);
  49. if (img != null)
  50. {
  51. this.picTitle.Image = img;
  52. }
  53. }
  54. private string ImagePathFaultOn { get { return Path.Combine(this.ImgBasePath, this.strImagePathFaultOn); } }
  55. private void ImageLoadingFaultOn()
  56. {
  57. Image img = ImgLoad(this.ImagePathFaultOn);
  58. if (img != null)
  59. {
  60. this.picTitle.Image = img;
  61. }
  62. }
  63. private string ImagePathAccumul { get { return Path.Combine(this.ImgBasePath, this.strImagePathAccumul); } }
  64. private void ImageLoadingAccumul()
  65. {
  66. Image img = ImgLoad(this.ImagePathAccumul);
  67. if (img != null)
  68. {
  69. this.picTitle.Image = img;
  70. }
  71. }
  72. private string ImagePathPhoneOn { get { return Path.Combine(this.ImgBasePath, this.strImagePathPhoneOn); } }
  73. private void ImageLoadingPhoneOn()
  74. {
  75. Image img = ImgLoad(this.ImagePathPhoneOn);
  76. if (img != null)
  77. {
  78. this.picTitle.Image = img;
  79. }
  80. }
  81. private string ImagePathFireRecover { get { return Path.Combine(this.ImgBasePath, this.strImagePathFireRecover); } }
  82. private void ImageLoadingFireRecover()
  83. {
  84. Image img = ImgLoad(this.ImagePathFireRecover);
  85. if (img != null)
  86. {
  87. this.picTitle.Image = img;
  88. }
  89. }
  90. private string strImgBasePath = "image";
  91. private string ImgBasePath { get { return Path.Combine(Directory.GetCurrentDirectory(), this.strImgBasePath); } }
  92. private string strImagePathBackground = "경고창_폼배경.gif";
  93. private string ImagePathBackground { get { return Path.Combine(this.ImgBasePath, this.strImagePathBackground); } }
  94. private Image ImgLoad(string path)
  95. {
  96. Image ret = null;
  97. try
  98. {
  99. ret = Image.FromFile(path);
  100. }
  101. catch (Exception e)
  102. {
  103. Util.UErrorMessage(e, 0, 0);
  104. }
  105. return ret;
  106. }
  107. private void ImageLoadingBackground()
  108. {
  109. Image img = ImgLoad(this.ImagePathBackground);
  110. if (img != null)
  111. {
  112. this.BackgroundImage = img;
  113. }
  114. }
  115. /**********************************************/
  116. /* 화면 경고 표시 아이콘 이미지리스트 */
  117. /**********************************************/
  118. const int cstCommConnectImageIdx = 0; //통신에러
  119. const int cstFireOnImageIdx = 1; //화재
  120. const int cstWriteOnImageIdx = 2; //설비가동
  121. const int cstFaultOnImageIdx = 3; //에러
  122. const int cstAccumulImageIdx = 4; //축적
  123. const int cstPhoneOnImageIdx = 5; //전화
  124. const int cstFireRecoverImageIdx = 6; //화재복구
  125. /**********************************************/
  126. //화면이동을 위해---------------
  127. private Boolean WindowsMove = true;
  128. private Point mouseOffset;
  129. //--------------------------------------------------------
  130. public frmWarningBox()
  131. {
  132. InitializeComponent();
  133. }
  134. public void Form_Init()
  135. {
  136. try
  137. {
  138. }
  139. catch (Exception ex)
  140. {
  141. Util.UErrorMessage(ex, 0, 0);
  142. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
  143. }
  144. }
  145. private void frmWarningBox_Load(object sender, EventArgs e)
  146. {
  147. try
  148. {
  149. //dataGridView1.Rows.Clear();
  150. this.ImageLoadingBackground();
  151. this.Size = new Size(583, 234);
  152. this.Show();
  153. // cyim 2013.8.5 팝업창 종료 막음 : 안보이도록 함
  154. this.btnClose.Visible = false;
  155. }
  156. catch (Exception ex)
  157. {
  158. Util.UErrorMessage(ex, 0, 0);
  159. }
  160. }
  161. //각메세지별 우선순위를 판별한다..
  162. public void setMessage(MappingStatus sta, string message, string deviceMessage)
  163. {
  164. try
  165. {
  166. MappingStatus dispStatus = sta;
  167. string dispMessage = message;
  168. string dispDeviceMessage = deviceMessage;
  169. //화면 표시 우선순위를 판별한다..
  170. EventLogInfo sEventLogMsg = null;
  171. //이벤트 로그
  172. this.eventLogInfos = parent.AryEventLogs;
  173. // cyim 2015.7.6 속도개선작업
  174. // 해쉬 리스트 구현 방법은 아래와 같다
  175. // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
  176. // 데이타 : EventLogInfo 클래스
  177. if (this.eventLogInfos != null && this.eventLogInfos.Count != 0)
  178. {
  179. int eventLogCnt = this.eventLogInfos.Count;
  180. if (eventLogCnt > 0)
  181. {
  182. // 해쉬테이블 키 추출
  183. string[] tmp_keys = new string[eventLogInfos.Keys.Count];
  184. this.eventLogInfos.Keys.CopyTo(tmp_keys, 0);
  185. sEventLogMsg = (EventLogInfo)this.eventLogInfos[tmp_keys[tmp_keys.Length - 1]];
  186. //sEventLogMsg = (EventLogInfo)this.eventLogInfos[eventLogCnt - 1]; //최종 메세지를 저장한다..
  187. for (int i = tmp_keys.Length - 1; i >= 0; i--)
  188. //for (int i = eventLogCnt - 1; i > -1; i--)
  189. {
  190. EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[tmp_keys[i]];
  191. //EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[i];
  192. if (eventLogMsg.LiveMsgFlag)
  193. {
  194. //둘다 Live한 메세지라면 EventStatus가 높은 메세지로 수정
  195. if (faultmode == true)
  196. {
  197. if (eventLogMsg.EventStatus == MappingStatus.FaultOn ||
  198. eventLogMsg.EventStatus == MappingStatus.FaultOff
  199. )
  200. {
  201. if (statusLevel(sEventLogMsg.EventStatus) > statusLevel(eventLogMsg.EventStatus))
  202. {
  203. sEventLogMsg = eventLogMsg;
  204. //이전메세지가 Live가 아니라면 표시메세지 수정
  205. if (!sEventLogMsg.LiveMsgFlag && eventLogMsg.LiveMsgFlag)
  206. {
  207. sEventLogMsg = eventLogMsg;
  208. }
  209. }
  210. }
  211. }
  212. else
  213. {
  214. if (statusLevel(sEventLogMsg.EventStatus) > statusLevel(eventLogMsg.EventStatus))
  215. {
  216. sEventLogMsg = eventLogMsg;
  217. //이전메세지가 Live가 아니라면 표시메세지 수정
  218. if (!sEventLogMsg.LiveMsgFlag && eventLogMsg.LiveMsgFlag)
  219. {
  220. sEventLogMsg = eventLogMsg;
  221. }
  222. }
  223. }
  224. }
  225. }
  226. dispStatus = sEventLogMsg.EventStatus;
  227. dispMessage = sEventLogMsg.Message;
  228. dispDeviceMessage = sEventLogMsg.DeviceMessage;
  229. }
  230. }
  231. //if (dispDeviceMessage != null)
  232. // this.txtWarningMessage.Text = string.Format("{0} 위치:{1}", dispMessage, dispDeviceMessage);
  233. //else
  234. if (dispStatus == MappingStatus.FireOn || dispStatus == MappingStatus.FireOff)
  235. {
  236. this.lblTitle.ForeColor = Color.Red;
  237. }
  238. else if (dispStatus == MappingStatus.WriteOn || dispStatus == MappingStatus.WriteOff)
  239. {
  240. this.lblTitle.ForeColor = Color.Blue;
  241. }
  242. else
  243. {
  244. this.lblTitle.ForeColor = Color.Black;
  245. }
  246. this.lblTitle.Text = StaTitleMsg(dispStatus);
  247. //this.txtWarningMessage.Text = string.Format("{0} 위치:{1}", dispMessage, dispDeviceMessage);
  248. this.txtWarningMessage.Text = string.Format("{1}", dispMessage, dispDeviceMessage);
  249. //this.picTitle.Image = imgLstIcon.Images[StaTitleImageIdx(dispStatus)];
  250. this.SetPicImage(dispStatus);
  251. //
  252. int ListTotalCnt = 10;
  253. if (dataGridView1.Rows.Count > ListTotalCnt)
  254. {
  255. int listRows = dataGridView1.Rows.Count;
  256. for (int i = ListTotalCnt; i < listRows; i++)
  257. dataGridView1.Rows.RemoveAt(i);
  258. }
  259. string msg = message.Replace("\n", " ");
  260. dataGridView1.Rows.Add(String.Format("{0:yyyy}-{0:MM}-{0:dd} {0:HH}:{0:mm}:{0:ss}", DateTime.Now),
  261. msg, deviceMessage);
  262. SetToggleColor();//2010.10.29,k.s.d, alram popup color toggle value set.
  263. timer_color_Tick(null, EventArgs.Empty);//2010.10.29,k.s.d, alram popup color toggle timer.
  264. timer_color.Enabled = true;
  265. }
  266. catch (Exception ex)
  267. {
  268. Util.UErrorMessage(ex, 0, 0);
  269. //MessageBox.Show(ex.Message, Application.ProductName);
  270. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  271. }
  272. }
  273. public void setMessage2(MappingStatus sta, string message, string deviceMessage)
  274. {
  275. try
  276. {
  277. MappingStatus dispStatus = sta;
  278. string dispMessage = message;
  279. string dispDeviceMessage = deviceMessage;
  280. this.lblTitle.ForeColor = Color.Black;
  281. this.lblTitle.Text = StaTitleMsg(dispStatus);
  282. this.txtWarningMessage.Text = string.Format("{1}", dispMessage, dispDeviceMessage);
  283. //this.picTitle.Image = imgLstIcon.Images[StaTitleImageIdx(dispStatus)];
  284. this.SetPicImage(dispStatus);
  285. string msg = message.Replace("\n", " ");
  286. dataGridView1.Rows.Add(String.Format("{0:yyyy}-{0:MM}-{0:dd} {0:HH}:{0:mm}:{0:ss}", DateTime.Now),
  287. msg, deviceMessage);
  288. }
  289. catch (Exception ex)
  290. {
  291. Util.UErrorMessage(ex, 0, 0);
  292. }
  293. }
  294. public void setMCCMessage(MappingStatus sta, string message, string deviceMessage)
  295. {
  296. try
  297. {
  298. ////Util.UDebugMessage("+setMCCMessage",0,0);
  299. MappingStatus dispStatus = sta;
  300. string dispMessage = message;
  301. string dispDeviceMessage = deviceMessage;
  302. //화면 표시 우선순위를 판별한다..
  303. EventLogInfo sEventLogMsg = null;
  304. //이벤트 로그
  305. this.eventLogInfos = parent.AryEventLogs;
  306. // cyim 2015.7.6 속도개선작업
  307. // 해쉬 리스트 구현 방법은 아래와 같다
  308. // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
  309. // 데이타 : EventLogInfo 클래스
  310. if (this.eventLogInfos != null && this.eventLogInfos.Count != 0)
  311. {
  312. int eventLogCnt = this.eventLogInfos.Count;
  313. string[] tmp_keys = new string[eventLogInfos.Keys.Count];
  314. this.eventLogInfos.Keys.CopyTo(tmp_keys, 0);
  315. sEventLogMsg = (EventLogInfo)this.eventLogInfos[tmp_keys[tmp_keys.Length - 1]];
  316. if (eventLogCnt > 0)
  317. {
  318. for (int i = tmp_keys.Length - 1; i >= 0; i--)
  319. //for (int i = eventLogCnt - 1; i > -1; i--)
  320. {
  321. EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[tmp_keys[i]];
  322. //EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[i];
  323. if (eventLogMsg.ReceiverID == parent.myReceiverID && eventLogMsg.CommId == 1 && eventLogMsg.BoardNo == 1 &&
  324. eventLogMsg.LoopNo == 0 && eventLogMsg.RepeaterNo == 127 && eventLogMsg.InoutType == "I" &&
  325. (eventLogMsg.EventType == "OL" || eventLogMsg.EventType == "XL" || eventLogMsg.EventType == "FA" || eventLogMsg.EventType == "FN")) // cyim 2015.7.9 아날로그 감지기 단선 상태가 리스트에 표시되지 않는 문제
  326. {
  327. sEventLogMsg = (EventLogInfo)eventLogMsg; //최종 메세지를 저장한다..
  328. ////Util.UDebugMessage(string.Format("setMCCMessage sEventLogMsg = {0}", sEventLogMsg.RepeaterNo), 0, 0);
  329. break;
  330. }
  331. }
  332. if (sEventLogMsg == null)
  333. {
  334. }
  335. else
  336. {
  337. for (int i = tmp_keys.Length - 1; i >= 0; i--)
  338. //for (int i = eventLogCnt - 1; i > -1; i--)
  339. {
  340. EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[tmp_keys[i]];
  341. //EventLogInfo eventLogMsg = (EventLogInfo)this.eventLogInfos[i];
  342. if (eventLogMsg.ReceiverID == parent.myReceiverID && eventLogMsg.CommId == 1 && eventLogMsg.BoardNo == 1 &&
  343. eventLogMsg.LoopNo == 0 && eventLogMsg.RepeaterNo == 127 && eventLogMsg.InoutType == "I" &&
  344. (eventLogMsg.EventType == "OL" || eventLogMsg.EventType == "XL" || eventLogMsg.EventType == "FA" || eventLogMsg.EventType == "FN") // cyim 2015.7.9 아날로그 감지기 단선 상태가 리스트에 표시되지 않는 문제
  345. )
  346. {
  347. if (eventLogMsg.LiveMsgFlag)
  348. { //둘다 Live한 메세지라면 EventStatus가 높은 메세지로 수정
  349. if (faultmode == true)
  350. {
  351. if (eventLogMsg.EventStatus == MappingStatus.FaultOn || eventLogMsg.EventStatus == MappingStatus.FaultOff)
  352. {
  353. if (statusLevel(sEventLogMsg.EventStatus) > statusLevel(eventLogMsg.EventStatus))
  354. {
  355. sEventLogMsg = eventLogMsg;
  356. if (!sEventLogMsg.LiveMsgFlag && eventLogMsg.LiveMsgFlag)
  357. {//이전메세지가 Live가 아니라면 표시메세지 수정
  358. sEventLogMsg = eventLogMsg;
  359. }
  360. }
  361. }
  362. }
  363. else
  364. {
  365. if (statusLevel(sEventLogMsg.EventStatus) > statusLevel(eventLogMsg.EventStatus))
  366. {
  367. sEventLogMsg = eventLogMsg;
  368. if (!sEventLogMsg.LiveMsgFlag && eventLogMsg.LiveMsgFlag)
  369. {//이전메세지가 Live가 아니라면 표시메세지 수정
  370. sEventLogMsg = eventLogMsg;
  371. }
  372. ////Util.UDebugMessage(string.Format("setMCCMessage sEventLogMsg = {0} :2", sEventLogMsg.RepeaterNo), 0, 0);
  373. }
  374. }
  375. }
  376. }
  377. }
  378. dispStatus = sEventLogMsg.EventStatus;
  379. dispMessage = sEventLogMsg.Message;
  380. dispDeviceMessage = sEventLogMsg.DeviceMessage;
  381. ////Util.UDebugMessage(string.Format("setMCCMessage dispMessage = {0} ", dispMessage), 0, 0);
  382. }
  383. }
  384. }
  385. if (dispStatus == MappingStatus.FireOn || dispStatus == MappingStatus.FireOff)
  386. {
  387. this.lblTitle.ForeColor = Color.Red;
  388. }
  389. else if (dispStatus == MappingStatus.WriteOn || dispStatus == MappingStatus.WriteOff)
  390. {
  391. this.lblTitle.ForeColor = Color.Blue;
  392. }
  393. else
  394. {
  395. this.lblTitle.ForeColor = Color.Black;
  396. }
  397. this.lblTitle.Text = StaTitleMsg(dispStatus);
  398. this.txtWarningMessage.Text = string.Format("{1}", dispMessage, dispDeviceMessage);
  399. //this.picTitle.Image = imgLstIcon.Images[StaTitleImageIdx(dispStatus)];
  400. this.SetPicImage(dispStatus);
  401. int ListTotalCnt = 10;
  402. if (dataGridView1.Rows.Count > ListTotalCnt)
  403. {
  404. int listRows = dataGridView1.Rows.Count;
  405. for (int i = ListTotalCnt; i < listRows; i++)
  406. dataGridView1.Rows.RemoveAt(i);
  407. }
  408. string msg = message.Replace("\n", " ");
  409. dataGridView1.Rows.Add(String.Format("{0:yyyy}-{0:MM}-{0:dd} {0:HH}:{0:mm}:{0:ss}", DateTime.Now),
  410. msg, deviceMessage);
  411. SetToggleColor();//2010.10.29,k.s.d, alram popup color toggle value set.
  412. timer_color_Tick(null, EventArgs.Empty);//2010.10.29,k.s.d, alram popup color toggle timer.
  413. timer_color.Enabled = true;
  414. }
  415. catch (Exception ex)
  416. {
  417. Util.UErrorMessage(ex, 0, 0);
  418. }
  419. }
  420. //각경고값의 상태를 레벨로 전환한다..
  421. private int statusLevel(MappingStatus dispStatus)
  422. {
  423. int lv = 99;
  424. try
  425. {
  426. lv = (int)dispStatus;//2010.10.29,k.s.d, pop up message level chnage.
  427. //
  428. // switch (dispStatus)
  429. // {
  430. // case MappingStatus.FireOn: lv = (int)dispStatus; break;
  431. // case MappingStatus.FireOff: lv = (int)MappingStatus.FireOn; break;
  432. // case MappingStatus.CommConnectError: lv = (int)dispStatus; break;
  433. // case MappingStatus.CommConnectNormal: lv = (int)MappingStatus.CommConnectError; break;
  434. // case MappingStatus.FaultOff: lv = (int)MappingStatus.FaultOn; break;
  435. // case MappingStatus.FaultOn: lv = (int)dispStatus; break;
  436. // case MappingStatus.AccumulateOff: lv = (int)MappingStatus.AccumulateOn; break;
  437. // case MappingStatus.AccumulateOn: lv = (int)dispStatus; break;
  438. // case MappingStatus.FireRecovery: lv = (int)dispStatus; break;
  439. // case MappingStatus.Normal: lv = (int)dispStatus; break;
  440. // case MappingStatus.PhoneOff: lv = (int)MappingStatus.PhoneOn; break;
  441. // case MappingStatus.PhoneOn: lv = (int)dispStatus; break;
  442. // case MappingStatus.ProgramEnd: lv = (int)MappingStatus.ProgramStart; break;
  443. // case MappingStatus.ProgramStart: lv = (int)dispStatus; break;
  444. // case MappingStatus.WriteOff: lv = (int)MappingStatus.WriteOn; break;
  445. // case MappingStatus.WriteOn: lv = (int)dispStatus; break;
  446. // }
  447. }
  448. catch (Exception ex)
  449. {
  450. Util.UErrorMessage(ex, 0, 0);
  451. }
  452. return lv;
  453. }
  454. private string StaTitleMsg(MappingStatus dispStatus)
  455. {
  456. string tle = "";
  457. try
  458. {
  459. switch (dispStatus)
  460. {
  461. case MappingStatus.FireOn: tle = "화재발생"; break;
  462. case MappingStatus.FireOff: tle = "화재해제"; break;
  463. case MappingStatus.CommConnectError: tle = "통신연결에러"; break;
  464. case MappingStatus.CommConnectNormal: tle = "통신연결해제"; break;
  465. case MappingStatus.FaultOff: tle = "FAULT해제"; break;
  466. case MappingStatus.FaultOn: tle = "FAULT발생"; break;
  467. case MappingStatus.AccumulateOff: tle = "축적화재해제"; break;
  468. case MappingStatus.AccumulateOn: tle = "축적화재발생"; break;
  469. case MappingStatus.FireRecovery: tle = "화재복구"; break;
  470. case MappingStatus.Normal: tle = "정상"; break;
  471. case MappingStatus.PhoneOff: tle = "전화해제"; break;
  472. case MappingStatus.PhoneOn: tle = "전화연결"; break;
  473. case MappingStatus.ProgramEnd: tle = "프로그램종료"; break;
  474. case MappingStatus.ProgramStart: tle = "프로그램시작"; break;
  475. case MappingStatus.WriteOff: tle = "설비종료"; break;
  476. case MappingStatus.WriteOn: tle = "설비작동"; break;
  477. case MappingStatus.DemonInit: tle = "초기화 중"; break;
  478. }
  479. }
  480. catch (Exception ex)
  481. {
  482. Util.UErrorMessage(ex, 0, 0);
  483. }
  484. return tle;
  485. }
  486. //private int StaTitleImageIdx(MappingStatus dispStatus) {
  487. // int imageIdx = 0;
  488. // try {
  489. // switch (dispStatus) {
  490. // ///
  491. // case MappingStatus.FireOn:
  492. // case MappingStatus.FireOff:
  493. // imageIdx = cstFireOnImageIdx;
  494. // break;
  495. // case MappingStatus.CommConnectError:
  496. // case MappingStatus.CommConnectNormal:
  497. // imageIdx = cstCommConnectImageIdx;
  498. // break;
  499. // case MappingStatus.FaultOff:
  500. // case MappingStatus.FaultOn:
  501. // imageIdx = cstFaultOnImageIdx;
  502. // break;
  503. // case MappingStatus.PhoneOff:
  504. // case MappingStatus.PhoneOn:
  505. // imageIdx = cstPhoneOnImageIdx;
  506. // break;
  507. // case MappingStatus.AccumulateOff:
  508. // case MappingStatus.AccumulateOn:
  509. // imageIdx = cstAccumulImageIdx;
  510. // break;
  511. // case MappingStatus.WriteOff:
  512. // case MappingStatus.WriteOn:
  513. // imageIdx = cstWriteOnImageIdx;
  514. // break;
  515. // case MappingStatus.FireRecovery:
  516. // imageIdx = cstFireRecoverImageIdx;
  517. // break;
  518. // case MappingStatus.DemonInit:
  519. // imageIdx = cstCommConnectImageIdx;
  520. // break;
  521. // //case MappingStatus.ProgramEnd: tle = "프로그램종료"; break;
  522. // //case MappingStatus.ProgramStart: tle = "프로그램시작"; break;
  523. // //case MappingStatus.Normal: tle = "정상"; break;
  524. // default:
  525. // imageIdx = cstFaultOnImageIdx;
  526. // break;
  527. // }
  528. // }
  529. // catch (Exception ex) {
  530. // Util.UErrorMessage(ex, 0, 0);
  531. // }
  532. // return imageIdx;
  533. //}
  534. private void SetPicImage(MappingStatus dispStatus)
  535. {
  536. try
  537. {
  538. switch (dispStatus)
  539. {
  540. case MappingStatus.FireOn:
  541. case MappingStatus.FireOff: this.ImageLoadingFireOn(); break;
  542. case MappingStatus.CommConnectError:
  543. case MappingStatus.CommConnectNormal: this.ImageLoadingCommConnect(); break;
  544. case MappingStatus.FaultOff:
  545. case MappingStatus.FaultOn: this.ImageLoadingFaultOn(); break;
  546. case MappingStatus.PhoneOff:
  547. case MappingStatus.PhoneOn: this.ImageLoadingPhoneOn(); break;
  548. case MappingStatus.AccumulateOff:
  549. case MappingStatus.AccumulateOn: this.ImageLoadingAccumul(); break;
  550. case MappingStatus.WriteOff:
  551. case MappingStatus.WriteOn: this.ImageLoadingWriteOn(); break;
  552. case MappingStatus.FireRecovery: this.ImageLoadingFireRecover(); break;
  553. case MappingStatus.DemonInit: this.ImageLoadingCommConnect(); break;
  554. default: this.ImageLoadingFaultOn(); break;
  555. }
  556. }
  557. catch (Exception ex)
  558. {
  559. Util.UErrorMessage(ex, 0, 0);
  560. }
  561. }
  562. public void setParent(MDIParent parent)
  563. {
  564. try
  565. {
  566. this.parent = parent;
  567. }
  568. catch (Exception ex)
  569. {
  570. Util.UErrorMessage(ex, 0, 0);
  571. }
  572. }
  573. private void frmWarningBox_FormClosed(object sender, FormClosedEventArgs e)
  574. {
  575. try
  576. {
  577. if (this.parent != null)
  578. {
  579. this.parent.CloseMessageForm();
  580. }
  581. }
  582. catch (Exception ex)
  583. {
  584. Util.UErrorMessage(ex, 0, 0);
  585. }
  586. }
  587. private void frmWarningBox_LostFocus(object sender, EventArgs e)
  588. {
  589. try
  590. {
  591. this.Select();
  592. }
  593. catch (Exception ex)
  594. {
  595. Util.UErrorMessage(ex, 0, 0);
  596. }
  597. }
  598. private void btnStatusYes_Click(object sender, EventArgs e)
  599. {
  600. try
  601. {
  602. this.Close();
  603. //이력내역보기
  604. parent.toolStripMenuItem4_Click(null, EventArgs.Empty);
  605. }
  606. catch (Exception ex)
  607. {
  608. Util.UErrorMessage(ex, 0, 0);
  609. }
  610. }
  611. private void lblDetailView_Click(object sender, EventArgs e)
  612. {
  613. try
  614. {
  615. if (chkDetailViewMode)
  616. {
  617. chkDetailViewMode = false;
  618. this.Size = new Size(583, 234);
  619. //lblDetailView.Text = "자세히보기>>";
  620. dataGridView1.Visible = false;
  621. }
  622. else
  623. {
  624. chkDetailViewMode = true;
  625. this.Size = new Size(583, 387);
  626. //lblDetailView.Text = "자세히보기닫기<<";
  627. dataGridView1.Visible = true;
  628. }
  629. }
  630. catch (Exception ex)
  631. {
  632. Util.UErrorMessage(ex, 0, 0);
  633. }
  634. }
  635. private void btnClose_Click(object sender, EventArgs e)
  636. {
  637. try
  638. {
  639. //this.Close();
  640. this.Hide();
  641. }
  642. catch (Exception ex)
  643. {
  644. Util.UErrorMessage(ex, 0, 0);
  645. }
  646. }
  647. private void btnWinClose_Click(object sender, EventArgs e)
  648. {
  649. try
  650. {
  651. //this.Close();
  652. this.Hide();
  653. }
  654. catch (Exception ex)
  655. {
  656. Util.UErrorMessage(ex, 0, 0);
  657. }
  658. }
  659. /********************************************************/
  660. /* 화면이동 */
  661. /********************************************************/
  662. private void lblWindowsMove_MouseDown(object sender, MouseEventArgs e)
  663. {
  664. try
  665. {
  666. if (WindowsMove)
  667. {
  668. mouseOffset = new Point(-(e.X + parent.Location.X), -(e.Y + 55 + parent.Location.Y));
  669. }
  670. }
  671. catch (Exception ex)
  672. {
  673. Util.UErrorMessage(ex, 0, 0);
  674. }
  675. }
  676. private void lblWindowsMove_MouseMove(object sender, MouseEventArgs e)
  677. {
  678. try
  679. {
  680. if (WindowsMove && (e.Button == MouseButtons.Left))
  681. {
  682. Point mousePos = Control.MousePosition;
  683. mousePos.Offset(mouseOffset.X, mouseOffset.Y);
  684. this.Location = mousePos;
  685. }
  686. }
  687. catch (Exception ex)
  688. {
  689. Util.UErrorMessage(ex, 0, 0);
  690. }
  691. }
  692. Color ToggleColor_set = Color.Transparent;
  693. Color ToggleColor_reset = Color.Transparent;
  694. Color ToggleFontColor_set = Color.Black;
  695. Color ToggleFontColor_reset = Color.Black;
  696. private void timer_color_Tick(object sender, EventArgs e)
  697. {
  698. try
  699. {
  700. if (this.lblTitle.BackColor == this.ToggleColor_reset)
  701. {
  702. this.lblTitle.BackColor = this.ToggleColor_set;
  703. this.lblTitle.ForeColor = this.ToggleFontColor_set;
  704. }
  705. else
  706. {
  707. this.lblTitle.BackColor = this.ToggleColor_reset;
  708. this.lblTitle.ForeColor = this.ToggleFontColor_reset;
  709. }
  710. }
  711. catch (Exception ex)
  712. {
  713. Util.UErrorMessage(ex, 0, 0);
  714. }
  715. }
  716. public void SetToggleColor()
  717. {
  718. try
  719. {
  720. if (this.lblTitle.Text == "화재발생")
  721. {
  722. this.ToggleColor_set = Color.Red;
  723. this.ToggleColor_reset = Color.Transparent;
  724. this.ToggleFontColor_set = Color.Black;
  725. this.ToggleFontColor_reset = Color.Red;
  726. }
  727. else if (this.lblTitle.Text == "축적화재발생")
  728. {
  729. this.ToggleColor_set = Color.Red;
  730. this.ToggleColor_reset = Color.Transparent;
  731. this.ToggleFontColor_set = Color.Black;
  732. this.ToggleFontColor_reset = Color.Red;
  733. }
  734. else if (this.lblTitle.Text == "FAULT발생")
  735. {
  736. this.ToggleColor_set = Color.OrangeRed;
  737. this.ToggleColor_reset = Color.Transparent;
  738. this.ToggleFontColor_set = Color.Black;
  739. this.ToggleFontColor_reset = Color.Black;
  740. }
  741. else if (this.lblTitle.Text == "통신연결에러")
  742. {
  743. this.ToggleColor_set = Color.OrangeRed;
  744. this.ToggleColor_reset = Color.Transparent;
  745. this.ToggleFontColor_set = Color.Black;
  746. this.ToggleFontColor_reset = Color.Black;
  747. }
  748. else if (this.lblTitle.Text == "설비작동")
  749. {
  750. this.ToggleColor_set = Color.Blue;
  751. this.ToggleColor_reset = Color.Transparent;
  752. this.ToggleFontColor_set = Color.White;
  753. this.ToggleFontColor_reset = Color.Blue;
  754. }
  755. else if (this.lblTitle.Text == "전화연결")
  756. {
  757. this.ToggleColor_set = Color.Blue;
  758. this.ToggleColor_reset = Color.Transparent;
  759. this.ToggleFontColor_set = Color.White;
  760. this.ToggleFontColor_reset = Color.Blue;
  761. }
  762. else if (this.lblTitle.Text == "화재해제")
  763. {
  764. this.ToggleColor_set = Color.Transparent;
  765. this.ToggleColor_reset = this.ToggleColor_set;
  766. this.ToggleFontColor_set = Color.Black;
  767. this.ToggleFontColor_reset = Color.Black;
  768. }
  769. else if (this.lblTitle.Text == "축적화재해제")
  770. {
  771. this.ToggleColor_set = Color.Transparent;
  772. this.ToggleColor_reset = this.ToggleColor_set;
  773. this.ToggleFontColor_set = Color.Black;
  774. this.ToggleFontColor_reset = Color.Black;
  775. }
  776. else if (this.lblTitle.Text == "화재복구")
  777. {
  778. this.ToggleColor_set = Color.Transparent;
  779. this.ToggleColor_reset = this.ToggleColor_set;
  780. this.ToggleFontColor_set = Color.Black;
  781. this.ToggleFontColor_reset = Color.Black;
  782. }
  783. else if (this.lblTitle.Text == "FAULT해제")
  784. {
  785. this.ToggleColor_set = Color.Transparent;
  786. this.ToggleColor_reset = this.ToggleColor_set;
  787. this.ToggleFontColor_set = Color.Black;
  788. this.ToggleFontColor_reset = Color.Black;
  789. }
  790. else if (this.lblTitle.Text == "통신연결해제")
  791. {
  792. this.ToggleColor_set = Color.Transparent;
  793. this.ToggleColor_reset = this.ToggleColor_set;
  794. this.ToggleFontColor_set = Color.Black;
  795. this.ToggleFontColor_reset = Color.Black;
  796. }
  797. else if (this.lblTitle.Text == "설비종료")
  798. {
  799. this.ToggleColor_set = Color.Transparent;
  800. this.ToggleColor_reset = this.ToggleColor_set;
  801. this.ToggleFontColor_set = Color.Black;
  802. this.ToggleFontColor_reset = Color.Black;
  803. }
  804. else if (this.lblTitle.Text == "전화해제")
  805. {
  806. this.ToggleColor_set = Color.Transparent;
  807. this.ToggleColor_reset = this.ToggleColor_set;
  808. this.ToggleFontColor_set = Color.Black;
  809. this.ToggleFontColor_reset = Color.Black;
  810. }
  811. else if (this.lblTitle.Text == "정상")
  812. {
  813. this.ToggleColor_set = Color.Transparent;
  814. this.ToggleColor_reset = this.ToggleColor_set;
  815. this.ToggleFontColor_set = Color.Black;
  816. this.ToggleFontColor_reset = Color.Black;
  817. }
  818. else if (this.lblTitle.Text == "프로그램종료")
  819. {
  820. this.ToggleColor_set = Color.Transparent;
  821. this.ToggleColor_reset = this.ToggleColor_set;
  822. this.ToggleFontColor_set = Color.Black;
  823. this.ToggleFontColor_reset = Color.Black;
  824. }
  825. else if (this.lblTitle.Text == "프로그램시작")
  826. {
  827. this.ToggleColor_set = Color.Transparent;
  828. this.ToggleColor_reset = this.ToggleColor_set;
  829. this.ToggleFontColor_set = Color.Black;
  830. this.ToggleFontColor_reset = Color.Black;
  831. }
  832. else
  833. {
  834. this.ToggleColor_set = Color.Transparent;
  835. this.ToggleColor_reset = this.ToggleColor_set;
  836. this.ToggleFontColor_set = Color.Black;
  837. this.ToggleFontColor_reset = Color.Black;
  838. }
  839. }
  840. catch (Exception ex)
  841. {
  842. Util.UErrorMessage(ex, 0, 0);
  843. }
  844. }
  845. /********************************************************/
  846. }
  847. }