018ad028c74eff6853a425dab784cffafcdc5f5a.svn-base 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  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. namespace FPER
  9. {
  10. public partial class frmDriveTest : Form
  11. {
  12. public frmDriveTest()
  13. {
  14. InitializeComponent();
  15. // cyim 2016.03.25 : 전원값 화면에 표시못하는 문제 보완 (주기적으로 갱신)
  16. timer_Protect.Enabled = true;
  17. }
  18. LogFileCreate LFC = new LogFileCreate();
  19. MDIParent mdi = null;
  20. delegate void deleFormInit();
  21. bool sBatteryTestCommandStart = false;
  22. int sBatteryTestAction = 0;
  23. int sBatteryTestSecond = 20;
  24. int iStatusCount = 0;
  25. // bool sKeypadTestCommandStart = false;
  26. // int sKeypadTestAction = 0;
  27. delegate void SetVoltageCallback(float cnt);
  28. private void btnWinClose_Click(object sender, EventArgs e)
  29. {
  30. try
  31. {
  32. //DoBatteryTest(false);
  33. mdi.winDriveTestForm = null;//k.s.d 20101023, Driver Test form Handle set null ( init bug fix )
  34. this.Close();
  35. }
  36. catch (Exception ex)
  37. {
  38. Util.UErrorMessage(ex, 0, 0);
  39. }
  40. }
  41. public void Form_Init()
  42. {
  43. try
  44. {
  45. }
  46. catch (Exception ex)
  47. {
  48. Util.UErrorMessage(ex, 0, 0);
  49. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
  50. }
  51. }
  52. private void frmDriveTest_Load(object sender, EventArgs e)
  53. {
  54. // cyim 2013.8.1 : 더블버퍼링 적용
  55. SetStyle(ControlStyles.UserPaint, true);
  56. //this.UpdateStyles();
  57. SetStyle(ControlStyles.AllPaintingInWmPaint, true);
  58. //this.UpdateStyles();
  59. SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
  60. this.UpdateStyles();
  61. try
  62. {
  63. this.mdi = (MDIParent)this.MdiParent;
  64. txtThisReceiverID.Text = string.Format("{0:00}", mdi.myReceiverID);
  65. //foreach (Control currentControl in tabPage3.Controls)
  66. //{
  67. // if (currentControl is TextBox)
  68. // {
  69. // TextBox txt = (TextBox)currentControl;
  70. // txt.Text = "";
  71. // }
  72. //}
  73. foreach (Control currentControl in panel_Bottom.Controls)
  74. {
  75. if (currentControl is TextBox)
  76. {
  77. TextBox txt = (TextBox)currentControl;
  78. txt.Text = "";
  79. }
  80. }
  81. txtTestSecond.Text = string.Format("{0}초", sBatteryTestSecond);
  82. //전압읽기 명령 생성
  83. this.mdi.ui.Voltage_Read(null);
  84. }
  85. catch (Exception ex)
  86. {
  87. Util.UErrorMessage(ex, 0, 0);
  88. }
  89. }
  90. private void frmDriveTest_Activated(object sender, EventArgs e)
  91. {
  92. try
  93. {
  94. this.mdi.SelectMenuIndex = 5;
  95. // cyim 2015.3.31 예비전원 테스트시 오류나면 초기화
  96. // 차후에 데몬에서 교류 혹은 예비전원 이상이 되면 테스트를 종료시킨다
  97. // 단, 예비전원 테스트 폼이 활성화되어 있다는 전제하에서만 동작된다
  98. this.mdi.Form_Active_frmDriveTest = true; // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  99. }
  100. catch (Exception ex)
  101. {
  102. Util.UErrorMessage(ex, 0, 0);
  103. }
  104. }
  105. private void frmDriveTest_Disposed(object sender, EventArgs e)
  106. {
  107. try
  108. {
  109. this.mdi.SelectMenuIndex = 0;
  110. // cyim 2015.3.31 예비전원 테스트시 오류나면 초기화
  111. this.mdi.Form_Active_frmDriveTest = false; // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  112. // cyim 2016.03.21 테스트 도중에 다른 메뉴로 진입할때 테스트 종료를 데몬에 명령
  113. DoBatteryTest(false);
  114. }
  115. catch (Exception ex)
  116. {
  117. Util.UErrorMessage(ex, 0, 0);
  118. }
  119. }
  120. //전압 표시
  121. public void Display_24Voltage(float vol)
  122. {
  123. try
  124. {
  125. if (this.txt24Voltage.InvokeRequired)
  126. {
  127. Console.WriteLine("Display_24Voltage = {0}", vol);
  128. SetVoltageCallback d = new SetVoltageCallback(Display_24Voltage);
  129. this.txt24Voltage.Invoke(d, new object[] { vol });
  130. }
  131. else
  132. {
  133. this.txt24Voltage.Text = String.Format("{0:0.00}V", vol);
  134. }
  135. }
  136. catch (Exception ex)
  137. {
  138. Util.UErrorMessage(ex, 0, 0);
  139. }
  140. }
  141. //전압 표시
  142. public void Display_5Voltage(float vol)
  143. {
  144. try
  145. {
  146. if (this.txt5Voltage.InvokeRequired)
  147. {
  148. SetVoltageCallback d = new SetVoltageCallback(Display_5Voltage);
  149. this.txt5Voltage.Invoke(d, new object[] { vol });
  150. }
  151. else
  152. {
  153. this.txt5Voltage.Text = String.Format("{0:0.00}V", vol);
  154. }
  155. }
  156. catch (Exception ex)
  157. {
  158. Util.UErrorMessage(ex, 0, 0);
  159. }
  160. }
  161. //전압 표시
  162. public void Display_3Voltage(float vol)
  163. {
  164. try
  165. {
  166. if (this.txt3Voltage.InvokeRequired)
  167. {
  168. SetVoltageCallback d = new SetVoltageCallback(Display_3Voltage);
  169. this.txt3Voltage.Invoke(d, new object[] { vol });
  170. }
  171. else
  172. {
  173. this.txt3Voltage.Text = String.Format("{0:0.00}V", vol);
  174. }
  175. }
  176. catch (Exception ex)
  177. {
  178. Util.UErrorMessage(ex, 0, 0);
  179. }
  180. }
  181. //전압 표시
  182. public void Display_BatteryVoltage(float vol)
  183. {
  184. try
  185. {
  186. if (this.txtBatteryVoltage.InvokeRequired)
  187. {
  188. SetVoltageCallback d = new SetVoltageCallback(Display_BatteryVoltage);
  189. this.txtBatteryVoltage.Invoke(d, new object[] { vol }); // cyim 폼 전체를 invoke 하지 않도록 한다
  190. }
  191. else
  192. {
  193. this.txtBatteryVoltage.Text = String.Format("{0:0.00}V", vol);
  194. }
  195. }
  196. catch (Exception ex)
  197. {
  198. Util.UErrorMessage(ex, 0, 0);
  199. }
  200. }
  201. // 배터리 테스트 버튼을 눌렀을때..
  202. public void btnBatteryTest_Click(object sender, EventArgs e)
  203. {
  204. // 먼저 배터리 테스트 대기 메시지를 띄운다. (1초 이상 기다려야 하니까..)
  205. //lblBatteryTestResult.Text = "BATTERY 테스트 대기 (교류전원 확인)";
  206. // cyim 2015.3.31 예비전원 테스트시 오류나면 초기화
  207. if (mdi.AC_TestError == true && mdi.Battery_TestError == false) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  208. lblBatteryTestResult.Text = "BATTERY 테스트 대기 (교류전원 확인)";
  209. else if (mdi.Battery_TestError == true && mdi.AC_TestError == false) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  210. lblBatteryTestResult.Text = "BATTERY 테스트 대기 (예비전원 확인)";
  211. else
  212. lblBatteryTestResult.Text = "BATTERY 테스트 대기 (전원 확인)";
  213. LFC.Log("타입: 수신기 조작 로그, 메세지: BATTERY 테스트");
  214. // 비상전원 상태를 읽어오도록 한다.
  215. mdi.ui.ReadIO15Input();
  216. // 타이머를 활성화한다. (1초 후에 타이머 루틴으로 점프한다. 상태 확인을 위한 시간을 확보한다.)
  217. iStatusCount = 0; // cyim 2015.3.31 카운터 초기화
  218. StatusTimer.Enabled = true;
  219. }
  220. // 배터리 테스트 루틴. (키패드 배터리 테스트 입력에 대한 처리)
  221. public void DoBatteryTest2(bool status)
  222. {
  223. //lblBatteryTestResult.Text = "BATTERY 테스트 대기 (교류전원 확인)";
  224. if (status == false)
  225. {
  226. DoBatteryTest(false); // 배터리 테스트 종료
  227. }
  228. //mdi.ui.ReadIO15Input();
  229. //// 상태 확인용으로 지연시킨다.
  230. //StatusTimer.Enabled = true;
  231. //if (status == false) // 시작
  232. //{
  233. // sBatteryTestAction = 0; // 시작하기 위해서.. 배터리 테스트 상태를 종료로 세팅한다.
  234. //}
  235. // cyim 2015.3.31 예비전원 테스트 루틴 통일
  236. btnBatteryTest_Click(null, null);
  237. }
  238. // 배터리 테스트 루틴.
  239. public void DoBatteryTest(bool status)
  240. {
  241. try
  242. {
  243. if (status == true)
  244. {
  245. if ((mdi.ui.bPowerStatus == true) && (mdi.ui.bEmergencyPowerStatus == true)) // 전원 오류 상태가 아니라면
  246. {
  247. sBatteryTestAction = 1;//시작명령
  248. sBatteryTestCommandStart = true;
  249. btnBatteryTest.Text = " 시험종료";
  250. sBatteryTestCommandStart = true;
  251. timer1.Interval = 1000;
  252. timer1.Enabled = true;
  253. timer1.Start();
  254. lblBatteryTestResult.Text = "BATTERY 테스트 시작";
  255. lblBatteryTestResult.ForeColor = System.Drawing.Color.Blue;
  256. lblBatteryTestResult.Show();
  257. lblBatteryTestMessage.Show();
  258. lblBatteryTestMessage2.Show();
  259. }
  260. }
  261. else
  262. {
  263. sBatteryTestAction = 0; //종료명령
  264. sBatteryTestCommandStart = false;
  265. //sBatteryTestAction = 0;//시작명령
  266. btnBatteryTest.Text = " 시험시작";
  267. sBatteryTestSecond = 20;
  268. txtTestSecond.Text = string.Format("{0}초", sBatteryTestSecond);
  269. timer1.Enabled = false;
  270. lblBatteryTestResult.Text = "BATTERY 테스트 완료";
  271. lblBatteryTestResult.ForeColor = System.Drawing.Color.Blue;
  272. lblBatteryTestResult.Show();
  273. lblBatteryTestMessage.Hide();
  274. lblBatteryTestMessage2.Hide();
  275. }
  276. //완료이벤트
  277. dCommandResponse d = new dCommandResponse(BatteryTestComplete);
  278. //명령생성 및 실행
  279. CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 0, 0, 0, d);
  280. cmd.CommandType = "TB";
  281. cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
  282. cmd.CommandData = null;
  283. cmd.Status = sBatteryTestAction; //1-시작,0-종료
  284. mdi.ui.runCommand(cmd);
  285. }
  286. catch (Exception ex)
  287. {
  288. Util.UErrorMessage(ex, 0, 0);
  289. btnBatteryTest.Enabled = true;
  290. this.Cursor = Cursors.Default;
  291. }
  292. }
  293. //화면 마우스 커서 및 버튼 다시 클릭 못하도록 설정 및 해제
  294. private void button_end(Button btn, Boolean val)
  295. {
  296. if (val)
  297. {
  298. btn.Enabled = true;
  299. this.Cursor = Cursors.Default;
  300. }
  301. else
  302. {
  303. btn.Enabled = false;
  304. this.Cursor = Cursors.WaitCursor;
  305. }
  306. }
  307. //*********************************************************************//
  308. // 배터리 테스트 완료 응답데이터 이벤트 //
  309. //*********************************************************************//
  310. public void BatteryTestComplete(CmdInfo cmd)
  311. {
  312. try
  313. {
  314. //button_end(btnBatteryTest, true);
  315. btnBatteryTest.Enabled = true;
  316. this.Cursor = Cursors.Default;
  317. //에러응답처리
  318. if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_ReadCommandStatus")) // cyim 2015.7.23 NACK 처리 부분 오류
  319. {
  320. //에러가 발생하였으므로 원복
  321. sBatteryTestCommandStart = false;
  322. timer1.Stop();
  323. timer1.Enabled = false;
  324. // cyim 2015.3.31 예비전원 테스트시 오류나면 초기화
  325. DoBatteryTest(false);
  326. return;
  327. }
  328. sBatteryTestCommandStart = true;
  329. if (sBatteryTestAction == 1)
  330. {
  331. btnBatteryTest.Text = " 시험종료";
  332. sBatteryTestCommandStart = true;
  333. timer1.Interval = 1000;
  334. timer1.Enabled = true;
  335. timer1.Start();
  336. lblBatteryTestMessage.Show(); //k.s.d 20101023, Test End Message show, hide
  337. lblBatteryTestMessage2.Show();
  338. }
  339. else
  340. {
  341. sBatteryTestCommandStart = false;
  342. sBatteryTestAction = 0;//시작명령
  343. btnBatteryTest.Text = " 시험시작";
  344. sBatteryTestSecond = 20;
  345. txtTestSecond.Text = string.Format("{0}초", sBatteryTestSecond);
  346. timer1.Enabled = false;
  347. lblBatteryTestMessage.Hide(); //k.s.d 20101023, Test End Message show, hide
  348. lblBatteryTestMessage2.Hide();
  349. }
  350. this.mdi.ui.Voltage_Read(null);
  351. //RCVData_ReadCommandStatus resData2 = (RCVData_ReadCommandStatus)cmd.ResponseData;
  352. ////lblBatteryTestResult.Text = string.Format("배터리 테스트 {0}명령이 완료되었습니다.", sBatteryTestCommandStart ? "종료" : "시작");
  353. //string msg = string.Format("배터리 테스트 {0}명령이 완료되었습니다.", sBatteryTestCommandStart ? "종료" : "시작");
  354. //MessageBox.Show(msg, Application.ProductName);
  355. //button_end(btnBatteryTest,true);
  356. }
  357. catch (Exception ex)
  358. {
  359. Util.UErrorMessage(ex, 0, 0);
  360. }
  361. }
  362. // cyim 2016.03.21 : 전원값 화면에 표시못하는 문제 보완
  363. private int timer_Protect_Tick_Cnt = 0;
  364. private void timer_Protect_Tick(object sender, EventArgs e)
  365. {
  366. try
  367. {
  368. // cyim 2017.05.08 : 예외처리 코드 추가
  369. if (this.mdi == null
  370. || this.mdi.ui == null
  371. || this.txt24Voltage == null
  372. || this.timer1 == null
  373. || this.StatusTimer == null)
  374. return;
  375. // cyim 2016.03.25 : 전원값 화면에 표시못하는 문제 보완 (주기적 갱신)
  376. //다른 타이머가 동작중이면 사용못함
  377. if (this.timer1.Enabled == true || this.StatusTimer.Enabled == true)
  378. return;
  379. timer_Protect_Tick_Cnt++;
  380. if (timer_Protect_Tick_Cnt == 1)
  381. {
  382. this.mdi.ui.Voltage_Read(null);
  383. this.txt24Voltage.Text = mdi.Power_Main_vol24;
  384. timer_Protect_Tick_Cnt = 0;
  385. }
  386. }
  387. catch (Exception ex)
  388. {
  389. Util.UErrorMessage(ex, 0, 0);
  390. }
  391. }
  392. private void timer1_Tick(object sender, EventArgs e)
  393. {
  394. try
  395. {
  396. //timer1.Stop();
  397. //timer1.Enabled = false;
  398. // cyim 2016.03.21 : 전원값 화면에 표시못하는 문제 보완 : 데몬에게 테스트 종료 및 전원값 요청을 동시에 하지 않는다
  399. if (sBatteryTestSecond > 1 && sBatteryTestSecond < 20)
  400. this.mdi.ui.Voltage_Read(null);
  401. if (sBatteryTestCommandStart)
  402. {
  403. sBatteryTestSecond--;
  404. txtTestSecond.Text = string.Format("{0}초", sBatteryTestSecond);
  405. if (sBatteryTestSecond < 1)
  406. {
  407. sBatteryTestSecond = 0;
  408. sBatteryTestCommandStart = false;
  409. lblBatteryTestResult.Text = "BATTERY 테스트 완료";
  410. lblBatteryTestResult.ForeColor = System.Drawing.Color.Blue;
  411. lblBatteryTestResult.Show(); //k.s.d 20101023, Test End Message show, hide
  412. btnBatteryTest_Click(btnBatteryTest, System.EventArgs.Empty);
  413. }
  414. }
  415. // cyim 2015.3.31 예비전원 테스트시 오류나면 초기화
  416. if ((mdi.ui.bPowerStatus == false) || (mdi.ui.bEmergencyPowerStatus == false))
  417. {
  418. DoBatteryTest(false);
  419. }
  420. }
  421. catch (Exception ex)
  422. {
  423. Util.UErrorMessage(ex, 0, 0);
  424. }
  425. }
  426. private void frmDriverTestClose(object sender, FormClosedEventArgs e)
  427. { //k.s.d 20101023, test end when form close.
  428. try
  429. {
  430. DoBatteryTest(false);
  431. mdi.winDriveTestForm = null;
  432. }
  433. catch (Exception ex)
  434. {
  435. Util.UErrorMessage(ex, 0, 0);
  436. }
  437. }
  438. // IO15의 교류전원 상태를 확인하기 위해서.. 타이머를 사용했음.
  439. // 교류전원 응답이 늦게 올라오기 때문에.. 응답이 온 후에 (bReceivePowerStatus == true)
  440. // 배터리 테스트 처리를 수행함.
  441. private void StatusTimer_Tick(object sender, EventArgs e)
  442. {
  443. iStatusCount++;
  444. if (iStatusCount > 20)
  445. {
  446. StatusTimer.Enabled = false;
  447. iStatusCount = 0; // cyim 2015.3.31 카운터 초기화
  448. }
  449. // cyim 2016.03.21 배터리 테스트 버튼을 눌렀을때 늦게 전원정보가 오는 경우가 발생한다. 타이머를 조금 늦게 가동하자
  450. if (iStatusCount == 1) return;
  451. // cyim 2015.3.31 예비전원 테스트시 오류나면 초기화
  452. if (mdi.AC_TestError == true && mdi.Battery_TestError == false) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  453. lblBatteryTestResult.Text = "BATTERY 테스트 대기 (교류전원 확인)";
  454. else if (mdi.Battery_TestError == true && mdi.AC_TestError == false) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  455. lblBatteryTestResult.Text = "BATTERY 테스트 대기 (예비전원 확인)";
  456. else
  457. lblBatteryTestResult.Text = "BATTERY 테스트 대기 (전원 확인)";
  458. if (mdi.ui.bReceivePowerStatus == true)
  459. {
  460. // 교류전원 상태 확인용 타이머를 끈다.
  461. StatusTimer.Enabled = false;
  462. iStatusCount = 0; // cyim 2015.3.31 카운터 초기화
  463. // 배터리 테스트 중이면..
  464. if (sBatteryTestAction == 1)
  465. {
  466. //sBatteryTestAction = 0; //종료명령
  467. DoBatteryTest(false);
  468. //this.mdi.ui.Voltage_Read(null);
  469. Console.WriteLine("DoBatteryTest(false);");
  470. }
  471. else
  472. {
  473. DoBatteryTest(true);
  474. Console.WriteLine("DoBatteryTest(true);");
  475. }
  476. }
  477. else
  478. {
  479. // cyim 2015.7.23 MTB 보드가 없는 경우 예비전원테스트 화면에서 테스트 버튼 누르면 오류 발생
  480. if (mdi.AC_TestError == true && mdi.Battery_TestError == true) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  481. {
  482. lblBatteryTestResult.Text = "통신 응답 없음 ";
  483. lblBatteryTestResult.ForeColor = System.Drawing.Color.Blue;
  484. lblBatteryTestResult.Show();
  485. // 카운터 종료
  486. StatusTimer.Enabled = false;
  487. iStatusCount = 0;
  488. }
  489. }
  490. }
  491. //private void btnKeypadIn_1_Click(object sender, EventArgs e)
  492. //{
  493. // txtKeypadIn_Result_1.Text = "Pass";
  494. //}
  495. //private void btnKeypadIn_2_Click(object sender, EventArgs e)
  496. //{
  497. // txtKeypadIn_Result_2.Text = "Pass";
  498. //}
  499. //private void btnKeypadIn_3_Click(object sender, EventArgs e)
  500. //{
  501. // txtKeypadIn_Result_3.Text = "Pass";
  502. //}
  503. //private void btnKeypadIn_4_Click(object sender, EventArgs e)
  504. //{
  505. // txtKeypadIn_Result_4.Text = "Pass";
  506. //}
  507. //private void btnKeypadIn_5_Click(object sender, EventArgs e)
  508. //{
  509. // txtKeypadIn_Result_5.Text = "Pass";
  510. //}
  511. //private void btnKeypadIn_6_Click(object sender, EventArgs e)
  512. //{
  513. // txtKeypadIn_Result_6.Text = "Pass";
  514. //}
  515. //private void btnKeypadIn_7_Click(object sender, EventArgs e)
  516. //{
  517. // txtKeypadIn_Result_7.Text = "Pass";
  518. //}
  519. //private void btnKeyPadTest_Click(object sender, EventArgs e)
  520. //{
  521. // try
  522. // {
  523. // string msg = string.Format("키패드 테스트 {0}명령을 내리시겠습니까?", sKeypadTestAction == 1 ? "종료" : "시작");
  524. // if (MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
  525. // {
  526. // if (sKeypadTestAction == 1)
  527. // {
  528. // sKeypadTestAction = 0; //종료명령
  529. // }
  530. // else
  531. // {
  532. // sKeypadTestAction = 1;//시작명령
  533. // }
  534. // //버튼 비활성 설정
  535. // button_end(btnKeyPadTest, false);
  536. // //완료이벤트
  537. // dCommandResponse d = new dCommandResponse(KeypadTestComplete);
  538. // //명령생성 및 실행
  539. // CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 0, 0, 0, d);
  540. // cmd.CommandType = "TK";
  541. // cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
  542. // cmd.CommandData = null;
  543. // cmd.Status = sKeypadTestAction; //1-시작,0-종료
  544. // mdi.ui.runCommand(cmd);
  545. // }
  546. // }
  547. // catch (Exception ex)
  548. // {
  549. // MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  550. // }
  551. //}
  552. ////*********************************************************************//
  553. //// 키패드 테스트 완료 응답데이터 이벤트 //
  554. ////*********************************************************************//
  555. //public void KeypadTestComplete(CmdInfo cmd)
  556. //{
  557. // button_end(btnKeyPadTest, true);
  558. // //에러응답처리
  559. // if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected))
  560. // {
  561. // //에러가 발생하였으므로 원복
  562. // sKeypadTestCommandStart = false;
  563. // return;
  564. // }
  565. // sKeypadTestCommandStart = true;
  566. // if (sKeypadTestAction == 1)
  567. // {
  568. // KeypadTestButtonEnabled(true);
  569. // btnKeyPadTest.Text = "시험종료";
  570. // sKeypadTestCommandStart = true;
  571. // }
  572. // else
  573. // {
  574. // KeypadTestButtonEnabled(false);
  575. // sKeypadTestCommandStart = false;
  576. // sKeypadTestAction = 0; //시작명령
  577. // btnKeyPadTest.Text = "시험시작";
  578. // }
  579. // //RCVData_ReadCommandStatus resData2 = (RCVData_ReadCommandStatus)cmd.ResponseData;
  580. // ////lblBatteryTestResult.Text = string.Format("배터리 테스트 {0}명령이 완료되었습니다.", sBatteryTestCommandStart ? "종료" : "시작");
  581. // //string msg = string.Format("배터리 테스트 {0}명령이 완료되었습니다.", sBatteryTestCommandStart ? "종료" : "시작");
  582. // //MessageBox.Show(msg, Application.ProductName);
  583. // //button_end(btnBatteryTest,true);
  584. //}
  585. //private void KeypadTestButtonEnabled(bool action)
  586. //{
  587. // btnKeypadIn_1.Enabled = action;
  588. // btnKeypadIn_2.Enabled = action;
  589. // btnKeypadIn_3.Enabled = action;
  590. // btnKeypadIn_4.Enabled = action;
  591. // btnKeypadIn_5.Enabled = action;
  592. // btnKeypadIn_6.Enabled = action;
  593. // btnKeypadIn_7.Enabled = action;
  594. // btnKeypadOut_1.Enabled = action;
  595. // btnKeypadOut_2.Enabled = action;
  596. // btnKeypadOut_3.Enabled = action;
  597. // btnKeypadOut_4.Enabled = action;
  598. // btnKeypadOut_5.Enabled = action;
  599. // btnKeypadOut_6.Enabled = action;
  600. // btnKeypadOut_7.Enabled = action;
  601. // btnKeypadOut_8.Enabled = action;
  602. // btnKeypadOut_9.Enabled = action;
  603. // btnKeypadOut_10.Enabled = action;
  604. // btnKeypadOut_11.Enabled = action;
  605. // btnKeypadOut_12.Enabled = action;
  606. // btnKeypadOut_13.Enabled = action;
  607. // btnKeypadOut_14.Enabled = action;
  608. // btnKeypadOut_15.Enabled = action;
  609. // btnKeypadOut_16.Enabled = action;
  610. // btnKeypadOut_17.Enabled = action;
  611. //}
  612. //private void btnKeypadOut_1_Click(object sender, EventArgs e)
  613. //{
  614. // try
  615. // {
  616. // if (sKeypadTestAction != 1)
  617. // {
  618. // MessageBox.Show("키패드 테스트가 시작되지 않았습니다.", Application.ProductName);
  619. // return;
  620. // }
  621. // if (MessageBox.Show("키패드 화재 테스트 출력명령을 내리시겠습니까?"
  622. // , Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
  623. // {
  624. // //버튼 비활성 설정
  625. // button_end(btnKeypadOut_1, false);
  626. // ////완료이벤트
  627. // //dCommandResponse d = new dCommandResponse(KeypadOutButtonComplete);
  628. // ////명령생성 및 실행
  629. // //CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 0, 0, 0, d);
  630. // //cmd.CommandType = "TK";
  631. // //cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
  632. // //cmd.CommandData = null;
  633. // //cmd.Status = sKeypadTestAction; //1-시작,0-종료
  634. // //mdi.ui.runCommand(cmd);
  635. // }
  636. // }
  637. // catch (Exception ex)
  638. // {
  639. // MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  640. // }
  641. //}
  642. //public void KeypadOutButtonComplete(CmdInfo cmd)
  643. //{
  644. // button_end(btnKeypadOut_1, true);
  645. // //에러응답처리
  646. // if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected))
  647. // {
  648. // //에러가 발생하였으므로 원복
  649. // sKeypadTestCommandStart = false;
  650. // return;
  651. // }
  652. // sKeypadTestCommandStart = true;
  653. // if (sKeypadTestAction == 1)
  654. // {
  655. // KeypadTestButtonEnabled(true);
  656. // btnKeyPadTest.Text = "시험종료";
  657. // sKeypadTestCommandStart = true;
  658. // }
  659. // else
  660. // {
  661. // KeypadTestButtonEnabled(false);
  662. // sKeypadTestCommandStart = false;
  663. // sKeypadTestAction = 0; //시작명령
  664. // btnKeyPadTest.Text = "시험시작";
  665. // }
  666. // //RCVData_ReadCommandStatus resData2 = (RCVData_ReadCommandStatus)cmd.ResponseData;
  667. // ////lblBatteryTestResult.Text = string.Format("배터리 테스트 {0}명령이 완료되었습니다.", sBatteryTestCommandStart ? "종료" : "시작");
  668. // //string msg = string.Format("배터리 테스트 {0}명령이 완료되었습니다.", sBatteryTestCommandStart ? "종료" : "시작");
  669. // //MessageBox.Show(msg, Application.ProductName);
  670. // //button_end(btnBatteryTest,true);
  671. //}
  672. }
  673. }