05a8e635e5cc72fcb16201d174b17143789b3150.svn-base 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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 FormBoardDataDownload : Form
  11. {
  12. //보드 데이터 다운로드 창 클래스
  13. frmReceiverConfig parent = null;
  14. MDIParent Mdi;
  15. public frmReceiverConfig frmReceiverConfig { get; private set; }
  16. public FormBoardDataDownload(frmReceiverConfig parent)
  17. {
  18. this.parent = parent;
  19. InitializeComponent();
  20. }
  21. public void SetMessage(string msg)
  22. {
  23. // 메시지 설정
  24. this.label1.Text = msg;
  25. }
  26. public void SetBoardData(List<CTBoard> LTBoard, MDIParent mdi)
  27. {
  28. // 보드 데이터 설정
  29. this.button1.Visible = false;
  30. this.button2.Visible = false;
  31. this.listView1.Items.Clear();
  32. // cyim 2016.12.07 : 수신기 모델별 내부 로직 변경
  33. int boardID_init = 0;
  34. int boardID_cnt = 0;
  35. int loopNo_init = 0;
  36. int LoopNo_cnt = 0;
  37. Mdi = mdi;
  38. // cyim 2017.01.12 : IFC3300 은 통신보드 0번이 존재한다
  39. if (mdi.ReceiverModel == "IFC3300")
  40. {
  41. boardID_init = 0;
  42. boardID_cnt = 65;
  43. loopNo_init = 0;
  44. LoopNo_cnt = 4;
  45. }
  46. else
  47. {
  48. boardID_init = 1;
  49. boardID_cnt = 17;
  50. loopNo_init = 0;
  51. LoopNo_cnt = 2;
  52. }
  53. // cyim 2016.11.03 : 통신보드(중계반)는 최대 64
  54. for (int i = boardID_init; i < boardID_cnt; i++)
  55. {
  56. if (mdi.ReceiverModel == "IFC3300")
  57. {
  58. //// LCH 2018.02.27 : 주석처리
  59. //if (i == 0)
  60. // LoopNo_cnt = 2;
  61. //else if(i >= 1 && i <= 8)
  62. // LoopNo_cnt = 2;
  63. //else
  64. LoopNo_cnt = 4;
  65. }
  66. // cyim 2016.10.31 : 계통정보는 0,1,2,3 으로 변경
  67. for (int j = loopNo_init; j < LoopNo_cnt; j++)
  68. {
  69. string name = string.Format("{0}-{1}계통", i, j);
  70. ListViewItem item = new ListViewItem(name);
  71. ListViewItem.ListViewSubItem itemStatus = new ListViewItem.ListViewSubItem();
  72. itemStatus.Text = "미설정";
  73. CTBoard board = null;
  74. foreach (CTBoard tboard in LTBoard)
  75. {
  76. if (tboard.boardID == i)
  77. board = tboard;
  78. }
  79. if (board == null) itemStatus.Text = "미설정";
  80. else if (board.use == false) itemStatus.Text = "미사용";
  81. // cyim 2016.10.31 : 계통정보는 0,1,2,3 으로 변경
  82. else if (j == 0)
  83. {
  84. if (board.loop0Use) itemStatus.Text = "대기";
  85. else itemStatus.Text = "미사용";
  86. }
  87. else if (j == 1)
  88. {
  89. if (board.loop1Use) itemStatus.Text = "대기";
  90. else itemStatus.Text = "미사용";
  91. }
  92. else if (j == 2)
  93. {
  94. if (board.loop2Use) itemStatus.Text = "대기";
  95. else itemStatus.Text = "미사용";
  96. }
  97. else if (j == 3)
  98. {
  99. if (board.loop3Use) itemStatus.Text = "대기";
  100. else itemStatus.Text = "미사용";
  101. }
  102. item.SubItems.Add(itemStatus);
  103. item.ForeColor = Color.Gray;
  104. this.listView1.Items.Add(item);
  105. }
  106. }
  107. }
  108. public void SetBoardDataDownloadResult(int boardID, int loopNo, int status, MDIParent mdi)
  109. {
  110. // cyim 2017.01.12 : 모델에 따라 선택할수 있는 통신보드가 틀리다
  111. int ItemCnt = 0;
  112. if (mdi.ReceiverModel == "IFC3300")
  113. ItemCnt = 65 * 4; // LCH 2018.02.27 : 아래 줄에서 수정됨
  114. //ItemCnt = 8 * 2 + 60 * 4 + 2; // 258 (0번 보드가 있다)
  115. else
  116. ItemCnt = 16 * 2; // 32 (15번 보드가 있다)
  117. if (this.listView1.Items.Count == ItemCnt)
  118. {
  119. // cyim 2017.01.12 : 모델에 따라 선택할수 있는 통신보드가 틀리다 : 아래의 코드로는 모델별 코드를 추가할 수 없다
  120. // ListViewItem item = this.listView1.Items[(boardID - 1) * 2 + loopNo];
  121. ListViewItem item = null;
  122. string name = string.Format("{0}-{1}계통", boardID, loopNo);
  123. foreach (ListViewItem lvItem in this.listView1.Items)
  124. {
  125. if (lvItem.Text == name)
  126. item = lvItem;
  127. }
  128. if (item == null)
  129. return;
  130. ListViewItem.ListViewSubItem itemStatus = item.SubItems[1];
  131. switch (status)
  132. {
  133. case 0:
  134. {
  135. item.ForeColor = Color.Red;
  136. itemStatus.Text = "실패";
  137. break;
  138. }
  139. case 1:
  140. {
  141. item.ForeColor = Color.Blue;
  142. itemStatus.Text = "성공";
  143. break;
  144. }
  145. }
  146. }
  147. }
  148. public void SetProgress(int position)
  149. {// progress 설정
  150. if (position >= this.progressBar1.Minimum && position <= this.progressBar1.Maximum)
  151. {
  152. this.progressBar1.Value = position;
  153. }
  154. }
  155. public void SetFinish() // LCH 2018.02.27 : 추가됨
  156. {
  157. this.progressBar1.Value = this.progressBar1.Maximum;
  158. this.button1.Visible = true;
  159. }
  160. public void SetSucess()
  161. {
  162. // 성공시
  163. this.SetMessage("설정정보 쓰기가 완료되었습니다. \r\n완료를 눌러 데몬을 Reset해 주십시오");
  164. this.button1.Visible = true;
  165. }
  166. public void SetFalse()
  167. {
  168. // 실패시
  169. this.SetMessage("설정정보 쓰기 일부 실패하였습니다. \r\n재시도하거나 완료를 눌러 데몬을 Reset해 주십시오");
  170. this.button1.Visible = true;
  171. // cyim 2013.9.17 데이타베이스 조회 컨셉변경 : 필요없는 루틴제거
  172. //this.button2.Visible = true;
  173. }
  174. private void button1_Click(object sender, EventArgs e)
  175. {// 완료 버튼 0.
  176. parent.timer.Enabled = false;
  177. this.SetMessage("데몬을 Reset 하였습니다. 잠시 기다려 주십시오");
  178. this.button1.Enabled = false; // cyim 2013.6.27 : 중계기 쓰기 버튼 데몬 2번 초기화 하지 못하도록 버튼 Disable
  179. parent.panel1.Enabled = true;
  180. Mdi.panel8.Enabled = true;
  181. //parent.btnReceiverConfigWriteAll.Enabled = true;
  182. parent.panel_Menu.Enabled = true;
  183. this.parent.ResetDemon();
  184. this.Close();
  185. }
  186. private void button2_Click(object sender, EventArgs e)
  187. {// 재시도 버튼
  188. this.parent.ReceiverConfigWriteAll();
  189. }
  190. private void FormBoardDataDownload_Load(object sender, EventArgs e)
  191. {
  192. this.button1.Visible = false;
  193. this.button2.Visible = false;
  194. this.TopMost = true;
  195. this.CenterToParent();
  196. }
  197. private void FormBoardDataDownload_Deactivate(object sender, EventArgs e)
  198. {
  199. this.Activate();
  200. }
  201. private void FormBoardDataDownload_MdiChildActivate(object sender, EventArgs e)
  202. {
  203. this.Activate();
  204. }
  205. private void FormBoardDataDownload_EnabledChanged(object sender, EventArgs e)
  206. {
  207. this.Activate();
  208. }
  209. private void FormBoardDataDownload_Leave(object sender, EventArgs e)
  210. {
  211. this.Activate();
  212. }
  213. }
  214. }