123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Diagnostics;
- namespace FPER
- {
- public partial class frmBoardGroup : Form
- {
- public frmBoardGroup()
- {
- InitializeComponent();
- }
- MDIParent mdi = null;
- LogFileCreate LFC = new LogFileCreate();
- PictureBox[] PicBoard;
- Button[] Board_loop0;
- Button[] Board_loop1;
- Label[] lblBoardComm;
- delegate void deleFormInit();
- public void Form_Init()
- {
- try
- {
- if (this.InvokeRequired)
- {
- deleFormInit d = new deleFormInit(Form_Init);
- this.Invoke(d, new object[] { });
- }
- else
- {
- getData();
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
- }
- }
- private void frmBoardGroup_Load(object sender, EventArgs e)
- {
- // cyim 2013.8.1 : 더블버퍼링 적용
- SetStyle(ControlStyles.UserPaint, true);
- //this.UpdateStyles();
- SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- //this.UpdateStyles();
- SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
- this.UpdateStyles();
- try
- {
- mdi = (MDIParent)this.MdiParent;
- txtThisReceiverID.Text = string.Format("{0:00}", mdi.myReceiverID);
- this.PicBoard = new PictureBox[16]{
- picBoard1,picBoard2,picBoard3,picBoard4,picBoard5,picBoard6,picBoard7,picBoard8,
- picBoard9,picBoard10,picBoard11,picBoard12,picBoard13,picBoard14,picBoard15,picBoard16
- };
- this.Board_loop0 = new Button[16]{
- btnBoard1_loop0,btnBoard2_loop0,btnBoard3_loop0,btnBoard4_loop0,btnBoard5_loop0,btnBoard6_loop0,btnBoard7_loop0,btnBoard8_loop0,
- btnBoard9_loop0,btnBoard10_loop0,btnBoard11_loop0,btnBoard12_loop0,btnBoard13_loop0,btnBoard14_loop0,btnBoard15_loop0,btnBoard16_loop0
- };
- this.Board_loop1 = new Button[16]{
- btnBoard1_loop1,btnBoard2_loop1,btnBoard3_loop1,btnBoard4_loop1,btnBoard5_loop1,btnBoard6_loop1,btnBoard7_loop1,btnBoard8_loop1,
- btnBoard9_loop1,btnBoard10_loop1,btnBoard11_loop1,btnBoard12_loop1,btnBoard13_loop1,btnBoard14_loop1,btnBoard15_loop1,btnBoard16_loop1
- };
- this.lblBoardComm = new Label[16]{
- lblBoardComm1,lblBoardComm2,lblBoardComm3,lblBoardComm4,lblBoardComm5,lblBoardComm6,lblBoardComm7,lblBoardComm8,
- lblBoardComm9,lblBoardComm10,lblBoardComm11,lblBoardComm12,lblBoardComm13,lblBoardComm14,lblBoardComm15,lblBoardComm16
- };
- getData();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
- }
- }
- private void frmBoardGroup_Activated(object sender, EventArgs e)
- {
- try
- {
- this.mdi.SelectMenuIndex = 3;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmBoardGroup_Disposed(object sender, EventArgs e)
- {
- try
- {
- this.mdi.SelectMenuIndex = 0;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void getData()
- {
- try
- {
- if (this.InvokeRequired)
- {
- deleFormInit d = new deleFormInit(getData);
- this.Invoke(d, new object[] { });
- }
- else
- {
- init();
- if (mdi.ui == null) return;
- ReceiverTypeInfo receiverInfo = mdi.ui.MyReceiverTypeInfo;
- if (receiverInfo == null) return;
- BoardTypeInfo[] boardInfos = receiverInfo.MyBoardType; //전체통신보드
- if (boardInfos != null)
- {
- foreach (BoardTypeInfo brd in boardInfos)
- {
- if (brd != null)
- {
- if (brd.UseFlag)
- {
- if (brd.Loop0UseFlag)
- {
- this.Board_loop0[brd.BoardNo - 1].Visible = true;
- }
- if (brd.Loop1UseFlag)
- {
- this.Board_loop1[brd.BoardNo - 1].Visible = true;
- }
- }
- }
- }
- }
- btnCommand_Click(btnCommand, EventArgs.Empty);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void init()
- {
- try
- {
- for (int i = 0; i < 16; i++)
- {
- // cyim 2013.8.1 디자인개선작업 : 시스템정보 - 중계반상태보기 imageList1->imageList_RepeaterBoard
- this.PicBoard[i].BackgroundImage = imageList_RepeaterBoard.Images[3]; //비사용 -> 비활성화
- this.Board_loop0[i].Visible = false;
- this.Board_loop1[i].Visible = false;
- this.lblBoardComm[i].Visible = false;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnWinClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void btnCommand_Click(object sender, EventArgs e)
- {
- try
- {
- MDIParent mdi = (MDIParent)this.MdiParent;
- SocketUI ui = mdi.ui;
- //버튼 비활성 설정
- button_end(false);
- LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템정보-중계기 상태보기-읽기명령 클릭");
- //통신보드 전체 읽기 명령
- dCommandResponse d = new dCommandResponse(BoardInfoAll);
- //명령생성 및 실행
- //중계기 설정 데이터를 CmdInfo에 넣어준다..
- CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, 0, 0, d);
- cmd.CommandType = "BS";
- cmd.ApplyRange = "B"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
- ui.runCommand(cmd);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //화면 마우스 커서 및 버튼 다시 클릭 못하도록 설정 및 해제
- private void button_end(Boolean val)
- {
- try
- {
- if (val)
- {
- this.btnCommand.Enabled = true;
- this.Cursor = Cursors.Default;
- }
- else
- {
- this.btnCommand.Enabled = false;
- this.Cursor = Cursors.WaitCursor;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //*********************************************************************//
- // 통신보드 전체읽기 응답데이터 이벤트 //
- //*********************************************************************//
- public void BoardInfoAll(CmdInfo cmd)
- {
- //에러응답처리
- if (!Util.ComInfoErrProcess(cmd, mdi.ui.Connected, "RCVData_ReadCommandStatus")) // cyim 2015.7.23 NACK 처리 부분 오류
- {
- button_end(true);
- return;
- }
- try
- {
- RCVData_ReadCommandStatus resData = (RCVData_ReadCommandStatus)cmd.ResponseData;
- string[] status = resData.BoardConnStatus;
- for (int i = 0; i < 16; i++)
- {
- //
- // cyim 2013.8.1 디자인개선작업 : 시스템정보 - 중계반상태보기 imageList1->imageList_RepeaterBoard (회색,파랑,빨강)
- //
- // F-front,B-back,X-error,N-none 로 들어온다
- if (status[i].Equals("N"))
- {
- this.PicBoard[i].BackgroundImage = imageList_RepeaterBoard.Images[3]; //비사용 -> 비활성화
- }
- else if (status[i].Equals("F"))
- {
- this.PicBoard[i].BackgroundImage = imageList_RepeaterBoard.Images[1]; //사용
- // cyim 2013.8.1 디자인개선작업 : imageList_Loop 추가해서 버튼색상 반영
- this.Board_loop0[i].BackgroundImage = imageList_Loop.Images[1];
- this.Board_loop1[i].BackgroundImage = imageList_Loop.Images[1];
- }
- // cyim 2013.8.1 중계반상태보기 화면에서 통신에러는 이미지 표시가 안됨 E->X
- else if (status[i].Equals("X"))
- {
- this.PicBoard[i].BackgroundImage = imageList_RepeaterBoard.Images[2]; //통신에러
- // cyim 2013.8.1 디자인개선작업 : imageList_Loop 추가해서 버튼색상 반영
- this.Board_loop0[i].BackgroundImage = imageList_Loop.Images[2];
- this.Board_loop1[i].BackgroundImage = imageList_Loop.Images[2];
- // cyim 2013.8.1 중계반상태보기에서 통신에러 문구는 표시안함
- //this.lblBoardComm[i].Text = "통신에러";
- //this.lblBoardComm[i].Visible = true;
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- finally
- {
- //버튼 비활성 해제
- button_end(true);
- }
- }
- private void btnBoard1_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(1, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard1_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(1, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard2_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(2, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard2_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(2, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard3_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(3, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard3_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(3, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard4_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(4, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard4_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(4, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard5_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(5, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard5_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(5, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard6_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(6, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard6_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(6, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard7_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(7, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard7_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(7, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard8_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(8, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard8_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(8, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard16_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(16, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard16_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(16, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard15_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(15, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard15_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(15, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard14_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(14, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard14_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(14, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard13_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(13, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard13_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(13, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard12_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(12, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard12_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(12, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard11_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(11, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard11_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(11, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard10_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(10, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard10_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(10, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard9_loop0_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(9, 0);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnBoard9_loop1_Click(object sender, EventArgs e)
- {
- try
- {
- frmRepeaterGroup frm = new frmRepeaterGroup();
- frm.setBoardId(9, 1);
- mdi.ShowChildForm(frm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- }
- }
|