frmVersion_BigReceiver.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  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 frmVersion_BigReceiver : Form
  11. {
  12. public frmVersion_BigReceiver()
  13. {
  14. InitializeComponent();
  15. // cyim 2013.7.12 디자인개선작업 : 시스템정보 - 버전정보 : 기본결과
  16. this.button_Menu_BasicSet.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_주황_100_30;
  17. }
  18. MDIParent mdi = null;
  19. delegate void deleFormInit();
  20. //int glb_boardNo = 1;
  21. private void btnWinClose_Click(object sender, EventArgs e)
  22. {
  23. try
  24. {
  25. this.Close();
  26. }
  27. catch (Exception ex)
  28. {
  29. Util.UErrorMessage(ex, 0, 0);
  30. }
  31. }
  32. public void Form_Init()
  33. {
  34. try
  35. {
  36. }
  37. catch (Exception ex)
  38. {
  39. Util.UErrorMessage(ex, 0, 0);
  40. }
  41. }
  42. private void frmVersion_Load(object sender, EventArgs e)
  43. {
  44. // cyim 2013.8.1 : 더블버퍼링 적용
  45. SetStyle(ControlStyles.UserPaint, true);
  46. //this.UpdateStyles();
  47. SetStyle(ControlStyles.AllPaintingInWmPaint, true);
  48. //this.UpdateStyles();
  49. SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
  50. this.UpdateStyles();
  51. try
  52. {
  53. mdi = (MDIParent)this.MdiParent;
  54. txtThisReceiverID.Text = string.Format("{0:00}", mdi.myReceiverID);
  55. //this.mdi.SelectMenuIndex = 7;
  56. txtUIVersion.Text = Application.ProductVersion;
  57. txtDemonVersion.Text = "";
  58. txtFileVersion.Text = "0.0.0.0";
  59. Grid_init();
  60. this.Cursor = Cursors.WaitCursor;
  61. //완료이벤트
  62. dCommandResponse d = new dCommandResponse(VersionInfoComplete);
  63. //명령생성 및 실행
  64. CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, 0, 0, d);
  65. cmd.CommandType = "VI";
  66. cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
  67. cmd.CommandData = null;
  68. mdi.ui.runCommand(cmd);
  69. }
  70. catch (Exception ex)
  71. {
  72. Util.UErrorMessage(ex, 0, 0);
  73. }
  74. }
  75. private void frmVersion_Activated(object sender, EventArgs e)
  76. {
  77. try
  78. {
  79. //this.mdi.SelectMenuIndex = 7;
  80. }
  81. catch (Exception ex)
  82. {
  83. Util.UErrorMessage(ex, 0, 0);
  84. }
  85. }
  86. private void frmVersion_Disposed(object sender, EventArgs e)
  87. {
  88. //if (mdi.ui.CommResponseReading)
  89. //{
  90. // //MessageBox.Show("응답 대기중입니다.. 잠시만 기다려 주십시요..");
  91. // return;
  92. //}
  93. try
  94. {
  95. //this.mdi.SelectMenuIndex = 0;
  96. }
  97. catch (Exception ex)
  98. {
  99. Util.UErrorMessage(ex, 0, 0);
  100. }
  101. }
  102. //*********************************************************************//
  103. // 버젼정보 완료 응답데이터 이벤트 //
  104. //*********************************************************************//
  105. public void VersionInfoComplete(CmdInfo cmd)
  106. {
  107. try
  108. {
  109. this.Cursor = Cursors.Default;
  110. //에러응답처리
  111. if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_ReadCommandStatus")) // cyim 2015.7.23 NACK 처리 부분 오류
  112. {
  113. return;
  114. }
  115. RCVData_ReadCommandStatus resData2 = (RCVData_ReadCommandStatus)cmd.ResponseData;
  116. string demonVer = string.Format("{0}.{1}.{2}.{3}", resData2.Reply_value1, resData2.Reply_value2, resData2.Reply_value3, resData2.Reply_value4);
  117. txtDemonVersion.Text = demonVer;
  118. }
  119. catch (Exception ex)
  120. {
  121. Util.UErrorMessage(ex, 0, 0);
  122. }
  123. }
  124. //*********************************************************************//
  125. // 버젼정보 완료 응답데이터 이벤트 //
  126. //*********************************************************************//
  127. private void BrdVersionInfoComplete(CmdInfo cmd)
  128. {
  129. try
  130. {
  131. this.Cursor = Cursors.Default;
  132. //에러응답처리
  133. if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_ReadTBoardStatus")) // cyim 2015.7.23 NACK 처리 부분 오류
  134. {
  135. button_end(true);
  136. return;
  137. }
  138. if (cmd != null)
  139. {
  140. //TextBox txt = (TextBox)Util.FineControl(tabPage2, string.Format("txtBoardVer_{0}", glb_boardNo));
  141. //if (txt != null)
  142. //{
  143. // RCVData_ReadTBoardStatus res = (RCVData_ReadTBoardStatus)cmd.ResponseData;
  144. // txt.Text = string.Format("{0}.{1}", res.TBD_MainVersion, res.TBD_SubVersion);
  145. //}
  146. // cyim 2016.10.31 : 대용량 수신기용 UI 변경
  147. RCVData_ReadTBoardStatus res = (RCVData_ReadTBoardStatus)cmd.ResponseData;
  148. Label txt = (Label)Util.FineControl(tabPage2, string.Format("lbl_COMM{0}", res.TBD_ID));
  149. if (txt != null)
  150. {
  151. if (!txt.Text.Contains(":"))
  152. {
  153. txt.Text = txt.Text + " : " + string.Format("{0}.{1}", res.TBD_MainVersion, res.TBD_SubVersion);
  154. }
  155. }
  156. }
  157. if (cmd == null)
  158. {
  159. if (mdi.ui == null) return;
  160. ReceiverTypeInfo receiverInfo = mdi.ui.MyReceiverTypeInfo;
  161. if (receiverInfo == null) return;
  162. BoardTypeInfo[] boardInfos = receiverInfo.MyBoardType; //전체통신보드
  163. if (boardInfos != null)
  164. {
  165. foreach (BoardTypeInfo brd in boardInfos)
  166. {
  167. if (brd != null)
  168. {
  169. if (brd.UseFlag)
  170. {
  171. try
  172. {
  173. if (brd.BoardNo <= 64)
  174. {
  175. CmdInfo cmd2 = new CmdInfo(prt_cmd_define.resd_tbd_state, mdi.myReceiverID);
  176. cmd2.boardNo = brd.BoardNo;
  177. dCommandResponse d = new dCommandResponse(BrdVersionInfoComplete); //응답후 이벤트 읽기 명령으로 이동
  178. cmd2.dEvent = d;
  179. this.mdi.ui.runCommand(cmd2);
  180. }
  181. else
  182. {
  183. button_end(true);
  184. }
  185. }
  186. catch (Exception ex)
  187. {
  188. Util.UErrorMessage(ex, 0, 0);
  189. button_end(true);
  190. }
  191. }
  192. }
  193. }
  194. }
  195. }
  196. }
  197. catch (Exception ex)
  198. {
  199. Util.UErrorMessage(ex, 0, 0);
  200. button_end(true);
  201. return;
  202. }
  203. //try
  204. //{
  205. // // cyim 2016.10.31 : 대용량 수신기용 UI 변경
  206. // if (glb_boardNo <= 64)
  207. // {
  208. // CmdInfo cmd2 = new CmdInfo(prt_cmd_define.resd_tbd_state, mdi.myReceiverID);
  209. // cmd2.boardNo = glb_boardNo;
  210. // dCommandResponse d = new dCommandResponse(BrdVersionInfoComplete); //응답후 이벤트 읽기 명령으로 이동
  211. // cmd2.dEvent = d;
  212. // this.mdi.ui.runCommand(cmd2);
  213. // }
  214. // else
  215. // {
  216. // button_end(true);
  217. // }
  218. //}
  219. //catch (Exception ex)
  220. //{
  221. // Util.UErrorMessage(ex, 0, 0);
  222. // button_end(true);
  223. //}
  224. }
  225. private void Grid_init()
  226. {
  227. try
  228. {
  229. if (mdi.ui == null) return;
  230. ReceiverTypeInfo receiverInfo = mdi.ui.MyReceiverTypeInfo;
  231. if (receiverInfo == null) return;
  232. /************************************************************************/
  233. /* 통신보드 화면 초기화 */
  234. /************************************************************************/
  235. BoardTypeInfo[] boardInfos = receiverInfo.MyBoardType; //전체통신보드
  236. if (boardInfos != null)
  237. {
  238. foreach (BoardTypeInfo brd in boardInfos)
  239. {
  240. if (brd != null)
  241. {
  242. if (brd.UseFlag)
  243. {
  244. //Label lbl = (Label)Util.FineControl(tabPage2, string.Format("lblBoardID_{0}", brd.BoardNo));
  245. //if (lbl != null)
  246. //{
  247. // lbl.Enabled = true;
  248. //}
  249. //TextBox txt = (TextBox)Util.FineControl(tabPage2, string.Format("txtBoardVer_{0}", brd.BoardNo));
  250. // cyim 2016.10.31 : 대용량 수신기용 UI 변경
  251. Label txt = (Label)Util.FineControl(tabPage2, string.Format("lbl_COMM{0}", brd.BoardNo));//glb_boardNo
  252. if (txt != null)
  253. {
  254. txt.Enabled = true;
  255. }
  256. }
  257. }
  258. }
  259. }
  260. /************************************************************************/
  261. }
  262. catch (Exception ex)
  263. {
  264. Util.UErrorMessage(ex, 0, 0);
  265. throw ex;
  266. }
  267. }
  268. private void btnCommRead_Click(object sender, EventArgs e)
  269. {
  270. try
  271. {
  272. //버튼 비활성 설정
  273. button_end(false);
  274. //glb_boardNo = 1;
  275. //통신보드 버젼읽기 명령 시작
  276. BrdVersionInfoComplete(null);
  277. }
  278. catch (Exception ex)
  279. {
  280. Util.UErrorMessage(ex, 0, 0);
  281. button_end(true);
  282. }
  283. }
  284. //화면 마우스 커서 및 버튼 다시 클릭 못하도록 설정 및 해제
  285. private void button_end(Boolean val)
  286. {
  287. try
  288. {
  289. if (val)
  290. {
  291. this.btnCommRead.Enabled = true;
  292. this.Cursor = Cursors.Default;
  293. }
  294. else
  295. {
  296. this.btnCommRead.Enabled = false;
  297. this.Cursor = Cursors.WaitCursor;
  298. }
  299. }
  300. catch (Exception ex)
  301. {
  302. Util.UErrorMessage(ex, 0, 0);
  303. }
  304. }
  305. bool CheckBoardVersion = false;//2010.10.29,k.s.d, check flag.
  306. private void tabPage2_Enter(object sender, EventArgs e)
  307. {//2010.10.29,k.s.d, if tab enter , read board version.
  308. try
  309. {
  310. if (CheckBoardVersion == false)
  311. {
  312. //glb_boardNo = 1;
  313. BrdVersionInfoComplete(null);
  314. }
  315. CheckBoardVersion = true;
  316. }
  317. catch (Exception ex)
  318. {
  319. Util.UErrorMessage(ex, 0, 0);
  320. }
  321. }
  322. //
  323. // cyim 2013.7.12 디자인개선작업 : 시스템정보 - 버전정보
  324. //
  325. private void button_Menu_BasicSet_Click(object sender, EventArgs e)
  326. {
  327. button_Menu_Color_Init();
  328. this.tabControl1.SelectTab(0);
  329. this.button_Menu_BasicSet.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_주황_100_30;
  330. this.panel_Menu.Focus();
  331. }
  332. private void button_Menu_CommBoard_Click(object sender, EventArgs e)
  333. {
  334. button_Menu_Color_Init();
  335. this.tabControl1.SelectTab(1);
  336. this.button_Menu_CommBoard.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_주황_100_30;
  337. this.panel_Menu.Focus();
  338. }
  339. private void button_Menu_Color_Init()
  340. {
  341. this.button_Menu_BasicSet.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_회색_100_30;
  342. this.button_Menu_CommBoard.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_회색_100_30;
  343. }
  344. }
  345. }