123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace FPER
- {
- public partial class FormBoardDataDownload : Form
- {
- //보드 데이터 다운로드 창 클래스
- frmReceiverConfig parent = null;
- MDIParent Mdi;
- public frmReceiverConfig frmReceiverConfig { get; private set; }
- public FormBoardDataDownload(frmReceiverConfig parent)
- {
- this.parent = parent;
- InitializeComponent();
- }
- public void SetMessage(string msg)
- {
- // 메시지 설정
- this.label1.Text = msg;
- }
- public void SetBoardData(List<CTBoard> LTBoard, MDIParent mdi)
- {
- // 보드 데이터 설정
- this.button1.Visible = false;
- this.button2.Visible = false;
- this.listView1.Items.Clear();
- // cyim 2016.12.07 : 수신기 모델별 내부 로직 변경
- int boardID_init = 0;
- int boardID_cnt = 0;
- int loopNo_init = 0;
- int LoopNo_cnt = 0;
- Mdi = mdi;
- // cyim 2017.01.12 : IFC3300 은 통신보드 0번이 존재한다
- if (mdi.ReceiverModel == "IFC3300")
- {
- boardID_init = 0;
- boardID_cnt = 65;
- loopNo_init = 0;
- LoopNo_cnt = 4;
- }
- else
- {
- boardID_init = 1;
- boardID_cnt = 17;
- loopNo_init = 0;
- LoopNo_cnt = 2;
- }
- // cyim 2016.11.03 : 통신보드(중계반)는 최대 64
- for (int i = boardID_init; i < boardID_cnt; i++)
- {
- if (mdi.ReceiverModel == "IFC3300")
- {
- //// LCH 2018.02.27 : 주석처리
- //if (i == 0)
- // LoopNo_cnt = 2;
- //else if(i >= 1 && i <= 8)
- // LoopNo_cnt = 2;
- //else
- LoopNo_cnt = 4;
- }
- // cyim 2016.10.31 : 계통정보는 0,1,2,3 으로 변경
- for (int j = loopNo_init; j < LoopNo_cnt; j++)
- {
- string name = string.Format("{0}-{1}계통", i, j);
- ListViewItem item = new ListViewItem(name);
- ListViewItem.ListViewSubItem itemStatus = new ListViewItem.ListViewSubItem();
- itemStatus.Text = "미설정";
- CTBoard board = null;
- foreach (CTBoard tboard in LTBoard)
- {
- if (tboard.boardID == i)
- board = tboard;
- }
- if (board == null) itemStatus.Text = "미설정";
- else if (board.use == false) itemStatus.Text = "미사용";
- // cyim 2016.10.31 : 계통정보는 0,1,2,3 으로 변경
- else if (j == 0)
- {
- if (board.loop0Use) itemStatus.Text = "대기";
- else itemStatus.Text = "미사용";
- }
- else if (j == 1)
- {
- if (board.loop1Use) itemStatus.Text = "대기";
- else itemStatus.Text = "미사용";
- }
- else if (j == 2)
- {
- if (board.loop2Use) itemStatus.Text = "대기";
- else itemStatus.Text = "미사용";
- }
- else if (j == 3)
- {
- if (board.loop3Use) itemStatus.Text = "대기";
- else itemStatus.Text = "미사용";
- }
- item.SubItems.Add(itemStatus);
- item.ForeColor = Color.Gray;
- this.listView1.Items.Add(item);
- }
- }
- }
- public void SetBoardDataDownloadResult(int boardID, int loopNo, int status, MDIParent mdi)
- {
- // cyim 2017.01.12 : 모델에 따라 선택할수 있는 통신보드가 틀리다
- int ItemCnt = 0;
- if (mdi.ReceiverModel == "IFC3300")
- ItemCnt = 65 * 4; // LCH 2018.02.27 : 아래 줄에서 수정됨
- //ItemCnt = 8 * 2 + 60 * 4 + 2; // 258 (0번 보드가 있다)
- else
- ItemCnt = 16 * 2; // 32 (15번 보드가 있다)
- if (this.listView1.Items.Count == ItemCnt)
- {
- // cyim 2017.01.12 : 모델에 따라 선택할수 있는 통신보드가 틀리다 : 아래의 코드로는 모델별 코드를 추가할 수 없다
- // ListViewItem item = this.listView1.Items[(boardID - 1) * 2 + loopNo];
- ListViewItem item = null;
- string name = string.Format("{0}-{1}계통", boardID, loopNo);
- foreach (ListViewItem lvItem in this.listView1.Items)
- {
- if (lvItem.Text == name)
- item = lvItem;
- }
- if (item == null)
- return;
- ListViewItem.ListViewSubItem itemStatus = item.SubItems[1];
- switch (status)
- {
- case 0:
- {
- item.ForeColor = Color.Red;
- itemStatus.Text = "실패";
- break;
- }
- case 1:
- {
- item.ForeColor = Color.Blue;
- itemStatus.Text = "성공";
- break;
- }
- }
- }
- }
- public void SetProgress(int position)
- {// progress 설정
- if (position >= this.progressBar1.Minimum && position <= this.progressBar1.Maximum)
- {
- this.progressBar1.Value = position;
- }
- }
- public void SetFinish() // LCH 2018.02.27 : 추가됨
- {
- this.progressBar1.Value = this.progressBar1.Maximum;
- this.button1.Visible = true;
- }
- public void SetSucess()
- {
- // 성공시
- this.SetMessage("설정정보 쓰기가 완료되었습니다. \r\n완료를 눌러 데몬을 Reset해 주십시오");
- this.button1.Visible = true;
- }
- public void SetFalse()
- {
- // 실패시
- this.SetMessage("설정정보 쓰기 일부 실패하였습니다. \r\n재시도하거나 완료를 눌러 데몬을 Reset해 주십시오");
- this.button1.Visible = true;
- // cyim 2013.9.17 데이타베이스 조회 컨셉변경 : 필요없는 루틴제거
- //this.button2.Visible = true;
- }
- private void button1_Click(object sender, EventArgs e)
- {// 완료 버튼 0.
- parent.timer.Enabled = false;
- this.SetMessage("데몬을 Reset 하였습니다. 잠시 기다려 주십시오");
- this.button1.Enabled = false; // cyim 2013.6.27 : 중계기 쓰기 버튼 데몬 2번 초기화 하지 못하도록 버튼 Disable
- parent.panel1.Enabled = true;
- Mdi.panel8.Enabled = true;
- //parent.btnReceiverConfigWriteAll.Enabled = true;
- parent.panel_Menu.Enabled = true;
- this.parent.ResetDemon();
- this.Close();
- }
- private void button2_Click(object sender, EventArgs e)
- {// 재시도 버튼
- this.parent.ReceiverConfigWriteAll();
- }
- private void FormBoardDataDownload_Load(object sender, EventArgs e)
- {
- this.button1.Visible = false;
- this.button2.Visible = false;
- this.TopMost = true;
- this.CenterToParent();
- }
- private void FormBoardDataDownload_Deactivate(object sender, EventArgs e)
- {
- this.Activate();
- }
- private void FormBoardDataDownload_MdiChildActivate(object sender, EventArgs e)
- {
- this.Activate();
- }
- private void FormBoardDataDownload_EnabledChanged(object sender, EventArgs e)
- {
- this.Activate();
- }
- private void FormBoardDataDownload_Leave(object sender, EventArgs e)
- {
- this.Activate();
- }
- }
- }
|